blob: f303dca0ff5ee66b962191f92469cef78ac7bb6d [file] [log] [blame]
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chrome_build.gni")
import("//build/config/crypto.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//build_overrides/v8.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//testing/test.gni")
content_tests_gypi_values =
exec_script("//build/gypi_to_gn.py",
[
rebase_path("../content_tests.gypi"),
"--replace=<(SHARED_INTERMEDIATE_DIR)=$root_gen_dir",
],
"scope",
[ "../content_tests.gypi" ])
# GYP version //content/content_tests.gypi:test_support_content
source_set("test_support") {
testonly = true
configs += [
"//build/config:precompiled_headers",
"//v8:external_startup_data",
]
public_deps = [
"//content/public/app:both",
"//content/public/browser",
"//content/public/common",
]
deps = [
"//cc/blink",
"//net:test_support",
"//skia",
"//storage/common",
"//testing/gmock",
"//testing/gtest",
"//ui/accessibility:ax_gen",
"//ui/base",
"//ui/base:test_support",
"//ui/base/ime",
"//ui/events:dom_keycode_converter",
"//ui/events:events_base",
"//ui/events:gesture_detection",
"//ui/events:test_support",
"//ui/gfx:test_support",
"//ui/gl",
"//ui/gl:test_support",
"//ui/resources",
"//url",
]
if (is_ios) {
sources = [
"public/test/content_test_suite_base.cc",
"public/test/mock_notification_observer.cc",
"public/test/mock_resource_context.cc",
"public/test/test_browser_thread.cc",
"public/test/test_content_client_initializer.cc",
"public/test/test_notification_tracker.cc",
"public/test/test_utils.cc",
"public/test/unittest_test_suite.cc",
"test/content_test_suite.cc",
"test/test_content_browser_client.cc",
"test/test_content_client.cc",
]
} else {
sources =
rebase_path(content_tests_gypi_values.test_support_content_sources,
".",
"//content")
if (is_android) {
sources -= [
"mock_google_streaming_server.cc",
"mock_google_streaming_server.h",
]
}
public_deps += [ "//third_party/WebKit/public:blink" ]
deps += [
":content_test_mojo_bindings",
"//cc",
"//cc:test_support",
"//components/scheduler:scheduler",
"//components/scheduler:test_support",
"//content/browser/speech/proto",
"//content/gpu",
"//content/public/child",
"//content/public/plugin",
"//content/public/renderer",
"//content/public/utility",
"//content/shell:pak",
"//ipc:test_support",
"//ipc/mojo",
"//media",
"//mojo/environment:chromium",
"//mojo/shell/public/cpp:cpp_for_chromium",
"//storage/browser",
"//storage/common",
"//third_party/mojo/src/mojo/edk/test:test_support",
"//ui/compositor:test_support",
"//ui/surface",
"//v8",
]
}
if (enable_plugins) {
deps += [
"//content/ppapi_plugin",
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/proxy:test_support",
"//ppapi/shared_impl",
"//ppapi/shared_impl:test_support",
]
} else if (!is_ios) {
sources -= [ "ppapi_unittest.cc" ]
}
if (enable_webrtc) {
sources += [
"../renderer/media/mock_data_channel_impl.cc",
"../renderer/media/mock_data_channel_impl.h",
"../renderer/media/mock_media_stream_dispatcher.cc",
"../renderer/media/mock_media_stream_dispatcher.h",
"../renderer/media/mock_peer_connection_impl.cc",
"../renderer/media/mock_peer_connection_impl.h",
"../renderer/media/mock_web_rtc_peer_connection_handler_client.cc",
"../renderer/media/mock_web_rtc_peer_connection_handler_client.h",
"../renderer/media/webrtc/mock_peer_connection_dependency_factory.cc",
"../renderer/media/webrtc/mock_peer_connection_dependency_factory.h",
]
deps += [
"//third_party/libjingle:libjingle_webrtc",
"//third_party/libjingle:libpeerconnection",
"//third_party/webrtc/modules/video_capture",
]
}
if (use_glib) {
configs += [ "//build/config/linux:glib" ]
}
if (use_aura) {
deps += [
"//ui/aura:test_support",
"//ui/resources:ui_test_pak",
"//ui/wm",
]
}
if (use_aura || is_mac) {
deps += [
"//third_party/libvpx_new",
"//ui/compositor",
]
sources += [
"../browser/compositor/test/no_transport_image_transport_factory.cc",
"../browser/compositor/test/no_transport_image_transport_factory.h",
]
}
if (use_ozone) {
deps += [ "//ui/ozone" ]
}
if (is_win) {
deps += [
"//content:sandbox_helper_win",
"//third_party/iaccessible2",
]
}
if (is_android && !use_aura) {
deps += [
"//ui/android",
"//ui/shell_dialogs",
]
}
if (is_win) {
deps += [ "//sandbox" ]
}
if (v8_use_external_startup_data) {
deps += [ "//gin:gin" ]
}
}
source_set("browsertest_support") {
testonly = true
sources = [
"../public/test/content_browser_test.cc",
"../public/test/content_browser_test.h",
"../public/test/content_browser_test_utils.cc",
"../public/test/content_browser_test_utils.h",
"../public/test/content_browser_test_utils_mac.mm",
"content_browser_test_utils_internal.cc",
"content_browser_test_utils_internal.h",
"content_test_launcher.cc",
]
deps = [
"//content/shell:content_shell_lib",
"//skia",
"//testing/gtest",
"//ui/accessibility:ax_gen",
]
if (is_android) {
deps += [ "//content/public/app:both" ]
} else {
deps += [ "//content/public/browser" ]
}
configs += [ "//v8:external_startup_data" ]
}
mojom("content_test_mojo_bindings") {
sources = [
"../public/test/test_mojo_service.mojom",
]
}
mojom("web_ui_test_mojo_bindings") {
sources = [
"data/web_ui_test_mojo_bindings.mojom",
]
}
if (!is_ios) {
# GYP version //content/content_tests.gypi:layouttest_support_content
static_library("layouttest_support") {
testonly = true
sources = rebase_path(
content_tests_gypi_values.layouttest_support_content_sources,
".",
"//content")
deps = [
":test_support",
"//cc",
"//cc/blink",
"//components/test_runner:test_runner",
"//content/public/common",
"//skia",
"//third_party/mojo/src/mojo/edk/test:test_support",
"//ui/accessibility:ax_gen",
"//v8",
]
if (is_android) {
deps += [ ":jni" ]
}
}
if (is_android) {
import("//build/config/android/rules.gni")
generate_jni("jni") {
sources = [
"../public/test/android/javatests/src/org/chromium/content/browser/test/NestedSystemMessageHandler.java",
]
jni_package = "content/public/test"
}
}
} # !is_ios
if (is_android) {
jinja_template("content_browsertests_manifest") {
testonly = true
input =
"//content/shell/android/browsertests_apk/AndroidManifest.xml.jinja2"
output =
"${target_gen_dir}/content_browsertests_manifest/AndroidManifest.xml"
}
android_library("content_browsertests_java") {
testonly = true
DEPRECATED_java_in_dir = "//content/shell/android/browsertests_apk/src"
deps = [
":content_browsertests_resources",
"//base:base_java",
"//content/public/android:content_java",
"//content/public/test/android:content_java_test_support",
"//content/shell/android:content_shell_browsertests_java",
"//testing/android/native_test:native_test_java",
"//ui/android:ui_java",
]
}
android_resources("content_browsertests_resources") {
testonly = true
resource_dirs = [ "//content/shell/android/browsertests_apk/res" ]
custom_package = "org.chromium.content_browsertests_apk"
}
}
# TODO(GYP): Delete this after we've converted everything to GN.
# The _run targets exist only for compatibility w/ GYP.
group("content_browsertests_run") {
testonly = true
deps = [
":content_browsertests",
]
}
test("content_browsertests") {
sources = rebase_path(content_tests_gypi_values.content_browsertests_sources,
".",
"//content")
if (is_android || is_linux || is_mac || is_win) {
data = [
"data/",
"//net/data/",
"//media/test/data/",
]
if (is_android) {
data += [ "$root_out_dir/content_shell_assets/content_shell.pak" ]
} else {
data += [
"$root_out_dir/content_shell.pak",
"//net/tools/testserver/",
"//ppapi/tests/test_case.html",
"//ppapi/tests/test_page.css",
"//third_party/pyftpdlib/",
"//third_party/pywebsocket/",
"//third_party/tlslite/",
]
if (is_mac) {
data += [
"$root_out_dir/Content Shell.app/",
"$root_out_dir/plugins/test_netscape_plugin.plugin/",
]
}
if (is_win) {
data += [ "$root_out_dir/plugins/np_test_netscape_plugin.dll" ]
}
}
}
defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
configs += [
"//build/config:precompiled_headers",
"//build/config/compiler:no_size_t_to_int_warning",
]
deps = [
":browsertest_support",
":web_ui_test_mojo_bindings",
"//base/allocator",
"//base/test:test_support",
"//content:resources",
"//content/browser/background_sync:background_sync_proto",
"//content/common:mojo_bindings",
"//content/gpu",
"//content/public/common",
"//content/public/plugin",
"//content/public/renderer",
"//content/shell:content_shell_lib",
"//content/shell:pak",
"//content/test:test_support",
"//device/battery",
"//device/battery:mojo_bindings",
"//device/vibration:mojo_bindings",
"//gin",
"//gpu",
"//ipc:test_support",
"//media:media_features",
"//media:shared_memory_support",
"//media:test_support",
"//media/audio:test_support",
"//media/base:test_support",
"//mojo/environment:chromium",
"//mojo/public/cpp/bindings",
"//mojo/public/js",
"//mojo/shell/public/cpp:cpp_for_chromium",
"//mojo/test:test_support",
"//net:test_support",
"//testing/gmock",
"//testing/gtest",
"//third_party/WebKit/public:blink",
"//third_party/leveldatabase",
"//third_party/mesa:osmesa",
"//third_party/mojo/src/mojo/edk/system",
"//third_party/mojo/src/mojo/edk/test:test_support",
"//third_party/zlib",
"//ui/accessibility",
"//ui/accessibility:ax_gen",
"//ui/base",
"//ui/base/ime",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/gl",
"//ui/gl:test_support",
"//ui/resources",
"//ui/shell_dialogs",
"//ui/snapshot",
]
data_deps = [
"//third_party/mesa:osmesa",
]
if (enable_plugins) {
deps += [
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/proxy:ipc",
"//ppapi/shared_impl",
]
data_deps += [ "//ppapi:ppapi_tests" ]
}
if (is_win) {
sources +=
rebase_path(content_tests_gypi_values.content_browsertests_win_sources,
".",
"//content")
deps += [
"//content/app/strings",
"//net:net_resources",
"//third_party/WebKit/public:resources",
"//third_party/iaccessible2",
"//third_party/isimpledom",
]
libs = [ "oleacc.lib" ]
}
if (is_android) {
sources += rebase_path(
content_tests_gypi_values.content_browsertests_android_sources,
".",
"//content")
sources -=
[ "../browser/battery_status/battery_monitor_impl_browsertest.cc" ]
deps += [
":content_browsertests_java",
":content_browsertests_manifest",
"//content/shell:content_shell_lib",
"//content/shell/android:content_shell_assets",
"//content/shell/android:content_shell_jni_headers",
"//testing/android/native_test:native_test_support",
]
deps -= [ "//device/battery" ]
android_manifest =
"${target_gen_dir}/content_browsertests_manifest/AndroidManifest.xml"
isolate_file = "//content/content_browsertests.isolate"
use_default_launcher = false
}
if (is_mac) {
sources += [ "../renderer/external_popup_menu_browsertest.cc" ]
deps += [
# Needed for Content Shell.app's Helper.
#"//content/shell:content_shell", #TODO(GYP) enable for mac
]
}
if (use_aura && !is_win) {
deps += [ "//ui/events:test_support" ]
}
if (!use_aura && !is_mac) {
sources -=
[ "../browser/compositor/image_transport_factory_browsertest.cc" ]
}
if (enable_webrtc) {
sources += rebase_path(
content_tests_gypi_values.content_browsertests_webrtc_sources,
".",
"//content")
deps += [ "//testing/perf" ]
}
if (enable_plugins) {
sources += rebase_path(
content_tests_gypi_values.content_browsertests_plugins_sources,
".",
"//content")
data_deps += [ "//ppapi:ppapi_tests" ]
}
if (enable_web_speech) {
sources += rebase_path(
content_tests_gypi_values.content_browsertests_speech_sources,
".",
"//content")
}
if (!is_chrome_branded) {
sources += rebase_path(
content_tests_gypi_values.content_browsertests_unofficial_build_sources,
".",
"//content")
}
if (use_aura) {
deps += [
"//ui/touch_selection:test_support",
"//ui/touch_selection:touch_selection",
]
} else {
sources -= [
"../browser/accessibility/touch_accessibility_aura_browsertest.cc",
"../browser/renderer_host/input/touch_selection_controller_client_aura_browsertest.cc",
"../browser/web_contents/web_contents_view_aura_browsertest.cc",
]
}
}
# TODO(GYP): Delete this after we've converted everything to GN.
# The _run targets exist only for compatibility w/ GYP.
group("content_unittests_run") {
testonly = true
deps = [
":content_unittests",
]
}
test("content_unittests") {
defines = []
sources = rebase_path(content_tests_gypi_values.content_unittests_sources,
".",
"//content")
if (is_android || is_linux || is_mac || is_win) {
data = [
"data/",
"//net/data/ssl/certificates/",
"//media/test/data/",
]
if (is_android) {
data += [ "$root_out_dir/content_shell_assets/content_shell.pak" ]
} else {
data += [ "$root_out_dir/content_shell.pak" ]
}
}
configs += [ "//build/config:precompiled_headers" ]
deps = [
":test_support",
"//base/allocator",
"//base/test:test_support",
"//content/browser/background_sync:background_sync_proto",
"//content/browser/cache_storage:cache_storage_proto",
"//content/browser/notifications:notification_proto",
"//content/browser/service_worker:service_worker_proto",
"//content/browser/speech/proto",
"//content/common:mojo_bindings",
"//content/public/browser",
"//content/public/common",
"//content/public/common:mojo_bindings",
"//crypto",
"//device/battery",
"//device/battery:mojo_bindings",
"//mojo/environment:chromium",
"//mojo/public/cpp/bindings",
"//net:extras",
"//net:test_support",
"//skia",
"//sql",
"//sql:test_support",
"//testing/gmock",
"//testing/gtest",
"//third_party/mojo/src/mojo/edk/test:test_support",
"//third_party/re2",
"//ui/accessibility",
"//ui/base",
"//ui/events/blink",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/gfx/ipc",
]
if (!is_ios) {
deps += [
"//base/third_party/dynamic_annotations",
"//cc",
"//cc:test_support",
"//cc/surfaces",
"//content:resources",
"//content/gpu",
"//content/public/browser",
"//content/public/child",
"//content/public/plugin",
"//content/public/renderer",
"//gin",
"//gpu",
"//gpu:test_support",
"//ipc:test_support",
"//media:shared_memory_support",
"//media:test_support",
"//media/audio:test_support",
"//media/base:test_support",
"//media/midi:midi",
"//storage/browser",
"//storage/common",
"//third_party/WebKit/public:blink",
"//third_party/icu",
"//third_party/leveldatabase",
"//third_party/libjingle",
"//ui/compositor:test_support",
"//ui/gl",
"//ui/gl:test_support",
]
}
data_deps = [
"//third_party/mesa:osmesa",
]
if (!is_win) {
sources += [ "../browser/file_descriptor_info_impl_unittest.cc" ]
}
if (enable_plugins) {
sources +=
rebase_path(content_tests_gypi_values.content_unittests_plugins_sources,
".",
"//content")
}
if (enable_webrtc) {
sources +=
rebase_path(content_tests_gypi_values.content_unittests_webrtc_sources,
".",
"//content")
deps += [
"//third_party/libjingle:libjingle_webrtc",
"//third_party/libjingle:libpeerconnection",
"//third_party/webrtc/modules/video_capture",
]
if (is_linux || is_mac || is_win) {
sources +=
[ "../browser/media/capture/desktop_capture_device_unittest.cc" ]
deps += [ "//third_party/webrtc/modules/desktop_capture" ]
}
if (is_chromeos) {
sources +=
[ "../browser/media/capture/desktop_capture_device_aura_unittest.cc" ]
}
if (is_android || is_chromecast) {
sources -= [
"../renderer/media/audio_track_recorder_unittest.cc",
"../renderer/media/media_recorder_handler_unittest.cc",
"../renderer/media/video_track_recorder_unittest.cc",
]
}
}
if (enable_web_speech) {
sources +=
rebase_path(content_tests_gypi_values.content_unittests_speech_sources,
".",
"//content")
}
if (is_linux) {
if (use_dbus) {
deps += [ "//dbus:test_support" ]
} else {
sources -=
[ "../browser/geolocation/wifi_data_provider_linux_unittest.cc" ]
}
}
if (is_win) {
deps += [ "//third_party/iaccessible2" ]
}
if (is_mac) {
# These flags are needed to run the test on Mac.
# Search for comments about "xcode_settings" in chrome_tests.gypi.
ldflags = [ "-Wl,-ObjC" ]
deps += [ "//third_party/ocmock" ]
}
if (is_chromeos) {
sources -= [ "../browser/geolocation/wifi_data_provider_linux_unittest.cc" ]
deps += [ "//chromeos" ]
}
if (is_android) {
sources +=
rebase_path(content_tests_gypi_values.content_unittests_android_sources,
".",
"//content")
sources -= [
"../browser/geolocation/network_location_provider_unittest.cc",
"../browser/geolocation/wifi_data_provider_common_unittest.cc",
"../browser/power_usage_monitor_impl_unittest.cc",
"../browser/renderer_host/begin_frame_observer_proxy_unittest.cc",
"../browser/webui/url_data_manager_backend_unittest.cc",
]
deps -= [ "//device/battery" ]
deps += [
"//base:base_java_unittest_support",
"//content/public/android:content_java",
"//v8:v8_external_startup_data_assets",
]
defines += [ "APPCACHE_USE_SIMPLE_CACHE" ]
}
if (!is_android && !is_ios) {
deps += [ "//third_party/libvpx_new" ]
}
if (use_aura) {
deps += [
"//ui/aura",
"//ui/aura_extra",
"//ui/wm",
]
} else {
sources -= [
"../browser/renderer_host/render_widget_host_view_aura_unittest.cc",
"../browser/renderer_host/web_input_event_aura_unittest.cc",
"../browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc",
"../browser/web_contents/aura/overscroll_window_animation_unittest.cc",
"../browser/web_contents/aura/overscroll_window_delegate_unittest.cc",
"../browser/web_contents/web_contents_view_aura_unittest.cc",
]
}
# Avoid windows due to non-availability of cursor resources in test.
if (!use_aura || is_win) {
sources -= [ "../browser/media/capture/cursor_renderer_aura_unittest.cc" ]
}
if (use_aura || toolkit_views) {
deps += [ "//ui/events:test_support" ]
}
if (!use_aura && !is_mac) {
sources -= [
"../browser/compositor/buffer_queue_unittest.cc",
"../browser/compositor/reflector_impl_unittest.cc",
"../browser/compositor/software_browser_compositor_output_surface_unittest.cc",
]
}
if (!is_win && !is_mac) {
sources -= [ "../common/plugin_list_unittest.cc" ]
}
if (use_ozone) {
deps += [
"//ui/ozone",
"//ui/ozone:ozone_base",
]
} else {
sources -=
[ "../browser/compositor/software_output_device_ozone_unittest.cc" ]
}
if (is_mac && use_openssl) {
deps += [ "//third_party/boringssl" ]
}
}
test("content_perftests") {
sources = [
"../browser/renderer_host/input/input_router_impl_perftest.cc",
"../common/cc_messages_perftest.cc",
"../test/run_all_perftests.cc",
]
deps = [
"//base/allocator",
"//base/test:test_support",
"//cc",
"//content/public/browser",
"//content/public/common",
"//content/test:test_support",
"//skia",
"//testing/gtest",
"//testing/perf",
"//ui/gfx",
"//ui/gfx/geometry",
]
if (is_android) {
deps += [ "//testing/android/native_test:native_test_native_code" ]
}
}
# TODO(GYP): Delete this after we've converted everything to GN.
# The _run targets exist only for compatibility w/ GYP.
group("content_gl_tests_run") {
testonly = true
deps = [
":content_gl_tests",
]
}
test("content_gl_tests") {
sources = [
"../common/gpu/client/gl_helper_unittest.cc",
"../common/gpu/client/gpu_in_process_context_tests.cc",
]
deps = [
":test_support",
"//base/allocator",
"//base/test:test_support",
"//content/public/common",
"//gpu/blink",
"//gpu/command_buffer/common",
"//testing/gtest",
"//third_party/WebKit/public:blink",
"//ui/base",
"//ui/gfx",
"//ui/gfx:test_support",
"//ui/gfx/geometry",
"//ui/gl",
"//ui/gl:test_support",
"//v8",
]
if (is_android) {
deps += [
"//content/public/test/android:content_java_test_support",
"//content/shell/android:content_shell_assets",
]
} else {
data_deps = [
"//third_party/ffmpeg",
"//third_party/mesa:osmesa",
]
}
}
test("content_gl_benchmark") {
sources = [
"../common/gpu/client/gl_helper_benchmark.cc",
]
deps = [
":test_support",
"//base/allocator",
"//base/test:test_support",
"//content/public/common",
"//gpu/blink",
"//testing/gtest",
"//third_party/WebKit/public:blink",
"//ui/base",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/gl",
"//ui/gl:test_support",
]
}
if (is_android) {
# TODO(GYP): Port Windows and ChromeOS logic.
test("video_decode_accelerator_unittest") {
deps = [
"//base",
"//content",
"//media",
"//testing/gtest",
"//ui/base",
"//ui/gfx",
"//ui/gfx:test_support",
"//ui/gfx/geometry",
"//ui/gl",
"//ui/gl:test_support",
]
configs += [ "//third_party/khronos:khronos_headers" ]
sources = [
"//content/common/gpu/media/video_accelerator_unittest_helpers.h",
]
if (is_android) {
sources += [ "//content/common/gpu/media/android_video_decode_accelerator_unittest.cc" ]
} else {
sources += [
"//content/common/gpu/media/rendering_helper.cc",
"//content/common/gpu/media/rendering_helper.h",
"//content/common/gpu/media/video_decode_accelerator_unittest.cc",
]
}
if (is_android) {
deps += [
"//gpu:test_support",
"//media/base/android",
"//media/base/android:media_java",
"//testing/gmock",
"//ui/android:ui_java",
]
}
}
}