Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9632)

Unified Diff: chrome/test/BUILD.gn

Issue 880873003: Add unit tests target to GN build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | chrome/tools/convert_dict/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/BUILD.gn
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index c5a23315979d4de080848db776aefea2bc98fb5a..588a4b441928c80d3a3e627f1b44065971a5ed7d 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/config/crypto.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//build/module_args/v8.gni")
@@ -102,6 +103,7 @@ source_set("test_support") {
"//components/ownership",
"//components/password_manager/core/browser:test_support",
"//components/pref_registry:test_support",
+ "//components/rappor:test_support",
"//components/search_engines:test_support",
"//components/signin/core/browser:test_support",
"//components/sync_driver:test_support",
@@ -134,6 +136,7 @@ source_set("test_support") {
"//components/captive_portal:test_support",
"//components/infobars/core",
"//components/sessions:test_support",
+ "//components/web_resource:test_support",
"//google_apis:test_support",
"//ipc:test_support",
"//media:test_support",
@@ -1160,4 +1163,517 @@ if (!is_android && (!is_win || link_chrome_on_windows)) {
# ]
#}
}
+
+ unit_gypi_values = exec_script("//build/gypi_to_gn.py",
+ [ rebase_path("../chrome_tests_unit.gypi") ],
+ "scope",
+ [ "../chrome_tests_unit.gypi" ])
+
+ test("unit_tests") {
+ sources =
+ rebase_path(unit_gypi_values.chrome_unit_tests_sources, ".", "//chrome")
+
+ defines = []
+
+ deps = [
+ # NOTE: New depndencies should generally be added in the OS!="ios"
+ # dependencies block below, rather than here.
+ # Unit tests should only depend on:
+ # 1) everything that the chrome binaries depend on:
+ "//chrome:browser_dependencies",
+ "//chrome:child_dependencies",
+
+ # 2) test-specific support libraries:
+ ":test_support_unit",
+ "//base/test:test_support",
+ "//chrome/test:test_support",
+ "//components/resources",
+ "//components/content_settings/core/test:test_support",
+ "//content/test:test_support",
+ "//content/public/app:both",
+ "//crypto:platform",
+ "//crypto:test_support",
+ "//net",
+ "//net:test_support",
+ "//sync:test_support_sync_api",
+ "//sync:test_support_sync_core",
+ "//sync:test_support_sync_internal_api",
+ "//testing/gmock",
+ "//testing/gtest",
+
+ # 3) anything tests directly depend on
+ "//base/allocator",
+ "//chrome:resources",
+ "//chrome:strings",
+ "//courgette:courgette_lib",
+ "//google_apis",
+ "//skia",
+ "//third_party/cacheinvalidation",
+ "//third_party/icu",
+ "//third_party/libxml",
+ "//ui/accelerometer",
+ "//ui/base:test_support",
+ "//ui/gfx:test_support",
+ "//ui/resources",
+ ]
+ data_deps = []
+
+ # TODO(GYP) Windows stuff
+ # ['incremental_chrome_dll==1', {
+ # 'UseLibraryDependencyInputs': "true",
+
+ if (!is_ios) {
+ deps += [
+ "//components/autofill/content/browser:test_support",
+ "//components/metrics/proto",
+ "//components/data_reduction_proxy/core/browser:test_support",
+ "//components/webdata_services:test_support",
+ "//components/strings",
+ "//content/app/resources",
+ "//gpu:test_support",
+ "//media:test_support",
+
+ #'../ppapi/ppapi_internal.gyp:ppapi_unittest_shared', TODO(GYP)
+ "//third_party/leveldatabase",
+ "//third_party/libaddressinput",
+ "//third_party/libjingle",
+ "//third_party/libphonenumber",
+ "//tools/json_schema_compiler/test",
+ "//ui/gl",
+ "//v8",
+ ]
+ }
+
+ if (is_android) {
+ deps -= [ "//third_party/libaddressinput" ]
+
+ # Some android targets still depend on --gc-sections to link.
+ # TODO: remove --gc-sections for Debug builds (crbug.com/159847).
+ ldflags = [ "-Wl,--gc-sections" ]
+ deps += [ "//testing/android:native_test_native_code" ]
+ } else {
+ sources +=
+ rebase_path(unit_gypi_values.chrome_unit_tests_non_android_sources,
+ ".",
+ "//chrome")
+ }
+
+ if (is_ios || is_chromeos) {
+ sources -=
+ [ "../browser/metrics/signin_status_metrics_provider_unittest.cc" ]
+ }
+ if (enable_background) {
+ sources +=
+ rebase_path(unit_gypi_values.chrome_unit_tests_background_sources,
+ ".",
+ "//chrome")
+ }
+ if (enable_spellcheck) {
+ sources +=
+ rebase_path(unit_gypi_values.chrome_unit_tests_spellchecker_sources,
+ ".",
+ "//chrome")
+ if (is_mac && !is_ios) {
+ deps += [ "//third_party/hunspell" ]
+ }
+ }
+
+ if (enable_one_click_signin) {
+ sources += rebase_path(
+ unit_gypi_values.chrome_unit_tests_one_click_signin_sources,
+ ".",
+ "//chrome")
+ if (is_chromeos) {
+ sources -= [
+ "../browser/ui/sync/one_click_signin_helper_unittest.cc",
+ "../browser/ui/sync/one_click_signin_sync_starter_unittest.cc",
+ ]
+ }
+ if (!toolkit_views) {
+ sources -= [ "../browser/ui/views/sync/one_click_signin_bubble_view_unittest.cc" ]
+ }
+ }
+ if (enable_nacl) {
+ sources += rebase_path(unit_gypi_values.chrome_unit_tests_nacl_sources,
+ ".",
+ "//chrome")
+ }
+ if (enable_extensions) {
+ sources +=
+ rebase_path(unit_gypi_values.chrome_unit_tests_extensions_sources,
+ ".",
+ "//chrome")
+ deps += [
+ "//chrome/common/extensions/api",
+ "//extensions:extensions_resources",
+ "//extensions/strings",
+ ]
+ if (enable_configuration_policy) {
+ sources += rebase_path(
+ unit_gypi_values.chrome_unit_tests_extensions_policy_sources,
+ ".",
+ "//chrome")
+ }
+ if (!is_chromeos) {
+ sources += rebase_path(
+ unit_gypi_values.chrome_unit_tests_extensions_non_chromeos_sources,
+ ".",
+ "//chrome")
+ }
+ }
+ if (toolkit_views) {
+ deps += [
+ "//components/web_modal:test_support",
+ "//ui/views",
+ "//ui/views:test_support",
+ ]
+ if (!is_mac) {
+ # TODO(tapted): Enable toolkit-views unit_tests on Mac when their
+ # respective implementations are linked in. http://crbug.com/412234.
+ sources += rebase_path(unit_gypi_values.chrome_unit_tests_views_sources,
+ ".",
+ "//chrome")
+ }
+ }
+ if (use_ash) {
+ sources += rebase_path(unit_gypi_values.chrome_unit_tests_ash_sources,
+ ".",
+ "//chrome")
+ deps += [
+ "//ash:test_support",
+ "//ash/resources",
+ "//ash/strings",
+ ]
+
+ # We eventually want to compile both in Win Aura builds, see
+ # http://crbug.com/155545.
+ if (!is_win) {
+ sources -= [ "../browser/ui/window_sizer/window_sizer_unittest.cc" ]
+ }
+ }
+ if (use_aura) {
+ sources += [ "//ui/views/controls/webview/webview_unittest.cc" ]
+ deps += [
+ "//ui/wm",
+ "//ui/aura:test_support",
+ "//ui/views:test_support",
+ ]
+ }
+ if (!is_chromeos && is_linux) {
+ sources +=
+ rebase_path(unit_gypi_values.chrome_unit_tests_desktop_linux_sources,
+ ".",
+ "//chrome")
+ }
+ if (!is_chromeos && !use_ozone && is_linux) {
+ deps += [
+ "//chrome/browser/ui/libgtk2ui",
+ "//build/config/linux:gio",
+ ]
+ if (!is_component_build) {
+ # TODO(erg): This file does not compile in shared library mode because
+ # it is reaching into the internals of libgtk2ui, which shouldn't be
+ # linked with the rest of chrome. This should either be fixed by
+ # creating a separate unit test target, or by deleting the test.
+ sources += [ "../browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2_unittest.cc" ]
+ }
+ }
+
+ if (enable_task_manager) {
+ sources +=
+ rebase_path(unit_gypi_values.chrome_unit_tests_task_manager_sources,
+ ".",
+ "//chrome")
+ }
+ if (enable_mdns) {
+ sources += rebase_path(unit_gypi_values.chrome_unit_tests_mdns_sources,
+ ".",
+ "//chrome")
+ }
+ if (enable_service_discovery) {
+ sources += rebase_path(
+ unit_gypi_values.chrome_unit_tests_service_discovery_sources,
+ ".",
+ "//chrome")
+ }
+ if (enable_configuration_policy) {
+ sources += rebase_path(
+ unit_gypi_values.chrome_unit_tests_configuration_policy_sources,
+ ".",
+ "//chrome")
+ if (is_chromeos) {
+ sources -=
+ [ "../browser/policy/cloud/user_policy_signin_service_unittest.cc" ]
+ } else if (is_android) {
+ sources -= [ "../browser/policy/policy_path_parser_unittest.cc" ]
+ }
+ if (!is_android && !is_ios && !is_chromeos) {
+ sources +=
+ [ "../browser/net/disk_cache_dir_policy_handler_unittest.cc" ]
+ }
+ if (!is_android && !is_ios) {
+ sources +=
+ [ "../browser/download/download_dir_policy_handler_unittest.cc" ]
+ }
+ }
+ if (enable_web_speech) {
+ sources += rebase_path(unit_gypi_values.chrome_unit_tests_speech_sources,
+ ".",
+ "//chrome")
+ }
+ if (enable_notifications) {
+ sources +=
+ rebase_path(unit_gypi_values.chrome_unit_tests_notifications_sources,
+ ".",
+ "//chrome")
+ if (is_android) {
+ sources -= [
+ # Android does not use the Message Center notification system.
+ "../browser/notifications/message_center_notifications_unittest.cc",
+ "../browser/notifications/message_center_settings_controller_unittest.cc",
+ ]
+ }
+ }
+ if (safe_browsing_mode == 1) {
+ # TODO(sgurun): enable tests for safe_browsing==2.
+ sources += rebase_path(
+ unit_gypi_values.chrome_unit_tests_full_safe_browsing_sources,
+ ".",
+ "//chrome")
+ defines += [ "FULL_SAFE_BROWSING" ]
+ if (is_chromeos) {
+ sources -= [ "../browser/safe_browsing/download_protection_service_unittest.cc" ]
+ } else if (is_android) {
+ sources -= [
+ # Android doesn't support download feedbacks.
+ "../browser/safe_browsing/download_feedback_unittest.cc",
+ "../browser/safe_browsing/download_feedback_service_unittest.cc",
+ "../browser/safe_browsing/download_protection_service_unittest.cc",
+ "../browser/safe_browsing/two_phase_uploader_unittest.cc",
+ ]
+ }
+ }
+ if (enable_autofill_dialog && !is_android) {
+ sources += rebase_path(
+ unit_gypi_values.chrome_unit_tests_autofill_dialog_sources,
+ ".",
+ "//chrome")
+ }
+ if (enable_plugins) {
+ sources += rebase_path(unit_gypi_values.chrome_unit_tests_plugins_sources,
+ ".",
+ "//chrome")
+ }
+ if (enable_print_preview) {
+ sources +=
+ rebase_path(unit_gypi_values.chrome_unit_tests_print_preview_sources,
+ ".",
+ "//chrome")
+ }
+ if (enable_captive_portal_detection) {
+ sources +=
+ rebase_path(unit_gypi_values.chrome_unit_tests_captive_portal_sources,
+ ".",
+ "//chrome")
+ }
+ if (enable_session_service) {
+ sources += rebase_path(
+ unit_gypi_values.chrome_unit_tests_session_service_sources,
+ ".",
+ "//chrome")
+ }
+ if (enable_webrtc) {
+ sources += rebase_path(unit_gypi_values.chrome_unit_tests_webrtc_sources,
+ ".",
+ "//chrome")
+ }
+ if (is_chromeos) {
+ sources +=
+ rebase_path(unit_gypi_values.chrome_unit_tests_chromeos_sources,
+ ".",
+ "//chrome")
+ deps += [
+ "//ash/resources",
+ "//ui/chromeos/resources",
+ ]
+ sources -= [
+ "../browser/signin/signin_global_error_unittest.cc",
+ "../browser/signin/signin_manager_unittest.cc",
+ "../browser/signin/signin_names_io_thread_unittest.cc",
+ "../browser/ui/views/app_list/linux/app_list_linux_unittest.cc",
+ "../browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc",
+ ]
+ }
+ if (use_x11) {
+ deps += [ "//ui/events/devices" ]
+ data_deps += [ "//tools/xdisplaycheck" ]
+ } else {
+ sources -= [ "../browser/password_manager/password_store_x_unittest.cc" ]
+ }
+ if (cld_version == 0 || cld_version == 2) {
+ # Unit tests should be independent of the CLD2 access mechanism, just use
+ # static for simplicity.
+ deps += [ "//third_party/cld_2:cld2_static" ]
+ }
+ if (is_desktop_linux && cpu_arch == "x64") {
+ # Only add this test for 64 bit builds because otherwise we need the 32
+ # bit library on 64 bit systems when running this test.
+ sources +=
+ [ "../browser/password_manager/native_backend_gnome_x_unittest.cc" ]
+ configs += [
+ "//chrome/browser:gnome_keyring",
+ "//chrome/browser:gnome_keyring_direct",
+ ]
+ }
+ if (is_linux && !is_chromeos) {
+ sources +=
+ [ "../browser/password_manager/native_backend_libsecret_unittest.cc" ]
+ }
+ if (is_linux && use_aura) {
+ deps += [
+ "//dbus",
+ "//dbus:test_support",
+ "//ui/aura:test_support",
+ ]
+ }
+ if (is_linux && is_chrome_branded && cpu_arch == "x86") {
+ ldflags = [ "-Wl,--strip-debug" ]
+ }
+ if (is_mac) {
+ sources += rebase_path(unit_gypi_values.chrome_unit_tests_mac_sources,
+ ".",
+ "//chrome")
+ sources -= [
+ "../browser/ui/tests/ui_gfx_image_unittest.cc",
+ "../tools/convert_dict/convert_dict_unittest.cc",
+ "../renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc",
+ ]
+
+ # The test fetches resources which means Mac need the app bundle to exist
+ # on disk so it can pull from it.
+ deps += [
+ "//third_party/google_toolbox_for_mac",
+ "//third_party/ocmock",
+ ]
+
+ # TODO(mark): We really want this for all non-static library targets,
+ # but when we tried to pull it up to the common.gypi level, it broke
+ # other things like the ui and startup tests. *shrug*
+ ldflags = [ "-Wl,-ObjC" ]
+ }
+ if (!is_mac && !is_ios) {
+ deps += [
+ "//third_party/hunspell",
+ "//chrome:packed_extra_resources",
+ "//chrome:packed_resources",
+ "//chrome/tools/convert_dict:lib",
+ ]
+ }
+ if (is_win || is_mac) {
+ sources += rebase_path(unit_gypi_values.chrome_unit_tests_win_mac_sources,
+ ".",
+ "//chrome")
+ }
+ if (is_win || is_mac || is_chromeos) {
+ sources += [ "../common/extensions/api/networking_private/networking_private_crypto_unittest.cc" ]
+ }
+ if (enable_rlz) {
+ deps += [ "//rlz:test_support" ]
+ } else {
+ sources -= [ "../browser/rlz/rlz_unittest.cc" ]
+ }
+ if (is_win) {
+ if (!is_component_build) {
+ # Unit_tests pdb files can get too big when incremental linking is
+ # on, disabling for this target.
+ #'LinkIncremental': '<(msvs_debug_link_nonincremental)', TODO(GYP)
+ }
+
+ sources += rebase_path(unit_gypi_values.chrome_unit_tests_win_sources,
+ ".",
+ "//chrome")
+ sources += [
+ # TODO: It would be nice to have these pulled in
+ # automatically from direct_dependent_settings in
+ # their various targets (net.gyp:net_resources, etc.),
+ # but that causes errors in other targets when
+ # resulting .res files get referenced multiple times.
+ #'<(SHARED_INTERMEDIATE_DIR)/chrome_version/other_version.rc', TODO(GYP)
+ #'<(SHARED_INTERMEDIATE_DIR)/installer_util_strings/installer_util_strings.rc', TODO(GYP)
+ #'<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_unscaled_resources.rc', TODO(GYP)
+ ]
+
+ deps += [
+ #'browser/safe_browsing/verifier_test/verifier_unittest.gyp:verifier_test_dll_1', TODO(GYP)
+ #'browser/safe_browsing/verifier_test/verifier_unittest.gyp:verifier_test_dll_2', TODO(GYP)
+ #'chrome_version_resources', TODO(GYP)
+ "//chrome_elf:blacklist_test_dll_1",
+ "//third_party/iaccessible2",
+ "//third_party/isimpledom",
+ "//third_party/wtl",
+ ]
+
+ libs = [
+ "comsupp.lib",
+ "oleacc.lib",
+ "rpcrt4.lib",
+ "urlmon.lib",
+ "winmm.lib",
+ ]
+ }
+ if (is_android || is_ios) {
+ sources -= [
+ "../browser/devtools/device/webrtc/devtools_bridge_instances_request_unittest.cc",
+ "../browser/ui/sync/sync_promo_ui_unittest.cc",
+ ]
+ } else {
+ sources -= [
+ "../browser/metrics/variations/variations_request_scheduler_mobile_unittest.cc",
+ "../browser/web_resource/promo_resource_service_mobile_ntp_unittest.cc",
+ ]
+ deps += [ "//chrome/tools/profile_reset:jtl_compiler_lib" ]
+ }
+ if (!is_android && !is_chromeos) {
+ sources += rebase_path(
+ unit_gypi_values.chrome_unit_tests_non_android_or_chromeos_sources,
+ ".",
+ "//chrome")
+ }
+ if (enable_themes) {
+ sources += rebase_path(unit_gypi_values.chrome_unit_tests_themes_sources,
+ ".",
+ "//chrome")
+ }
+ if (!is_android && (use_nss_certs || use_openssl_certs)) {
+ sources += [ "../common/net/x509_certificate_model_unittest.cc" ]
+ }
+ if (enable_supervised_users) {
+ sources += rebase_path(
+ unit_gypi_values.chrome_unit_tests_supervised_user_sources,
+ ".",
+ "//chrome")
+ }
+ if (safe_browsing_mode == 1 && enable_extensions) {
+ sources += [ "../browser/extensions/blacklist_unittest.cc" ]
+ }
+ if (cld_version == 1) {
+ sources += [ "//third_party/cld/encodings/compact_lang_det/compact_lang_det_unittest_small.cc" ]
+ defines += [ "CLD_WINDOWS" ]
+ deps += [ "//third_party/cld" ]
+ }
+ if (enable_app_list) {
+ sources +=
+ rebase_path(unit_gypi_values.chrome_unit_tests_app_list_sources,
+ ".",
+ "//chrome")
+ deps += [ "//ui/app_list:test_support" ]
+ }
+ if (use_ozone) {
+ # crbug.com/354036
+ sources -= [ "browser/chromeos/events/event_rewriter_unittest.cc" ]
+ }
+ if (!enable_plugin_installation) {
+ sources -= [ "../browser/plugins/plugin_installer_unittest.cc" ]
+ }
+ }
}
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | chrome/tools/convert_dict/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698