Roll src/third_party/WebKit 9301d6f:4619053 (svn 201058:201059)
[chromium-blink-merge.git] / chrome / test / BUILD.gn
blob020f5f2241e97c30d5565f06c410b9eca0552fae
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/config/chrome_build.gni")
6 import("//build/config/crypto.gni")
7 import("//build/config/features.gni")
8 import("//build/config/ui.gni")
9 import("//chrome/chrome_tests.gni")
10 import("//chrome/test/base/js2gtest.gni")
11 import("//testing/test.gni")
13 declare_args() {
14   # TODO(GYP) http://crbug.com/462791
15   enable_nacl_browsertests = false
18 # This target exists to reference other test executables to bring these files
19 # into the build.
20 group("test") {
21   testonly = true
24 # GYP version: chrome/chrome_tests_unit.gypi:test_support_common
25 source_set("test_support") {
26   defines = []
27   testonly = true
29   sources = [
30     "base/chrome_process_util.cc",
31     "base/chrome_process_util.h",
32     "base/chrome_process_util_mac.cc",
33     "base/chrome_render_view_host_test_harness.cc",
34     "base/chrome_render_view_host_test_harness.h",
35     "base/chrome_test_launcher.cc",
36     "base/chrome_test_launcher.h",
37     "base/chrome_test_suite.cc",
38     "base/chrome_test_suite.h",
39     "base/chrome_unit_test_suite.cc",
40     "base/chrome_unit_test_suite.h",
41     "base/dialog_test_browser_window.cc",
42     "base/dialog_test_browser_window.h",
43     "base/find_in_page_observer.cc",
44     "base/find_in_page_observer.h",
45     "base/history_index_restore_observer.cc",
46     "base/history_index_restore_observer.h",
47     "base/in_process_browser_test.cc",
48     "base/in_process_browser_test.h",
49     "base/in_process_browser_test_mac.cc",
50     "base/profile_mock.cc",
51     "base/profile_mock.h",
52     "base/scoped_browser_locale.cc",
53     "base/scoped_browser_locale.h",
54     "base/scoped_bundle_swizzler_mac.h",
55     "base/scoped_bundle_swizzler_mac.mm",
56     "base/scoped_testing_local_state.cc",
57     "base/scoped_testing_local_state.h",
58     "base/test_browser_window.cc",
59     "base/test_browser_window.h",
60     "base/test_launcher_utils.cc",
61     "base/test_launcher_utils.h",
62     "base/test_switches.cc",
63     "base/test_switches.h",
64     "base/testing_browser_process.cc",
65     "base/testing_browser_process.h",
66     "base/testing_browser_process_platform_part.cc",
67     "base/testing_browser_process_platform_part.h",
68     "base/testing_io_thread_state.cc",
69     "base/testing_io_thread_state.h",
70     "base/testing_pref_service_syncable.cc",
71     "base/testing_pref_service_syncable.h",
72     "base/testing_profile.cc",
73     "base/testing_profile.h",
74     "base/testing_profile_manager.cc",
75     "base/testing_profile_manager.h",
76     "base/tracing.cc",
77     "base/tracing.h",
78     "base/ui_test_utils.cc",
79     "base/ui_test_utils.h",
80     "logging/win/file_logger.cc",
81     "logging/win/file_logger.h",
82     "logging/win/log_file_printer.cc",
83     "logging/win/log_file_printer.h",
84     "logging/win/log_file_reader.cc",
85     "logging/win/log_file_reader.h",
86     "logging/win/mof_data_parser.cc",
87     "logging/win/mof_data_parser.h",
88     "logging/win/test_log_collector.cc",
89     "logging/win/test_log_collector.h",
90   ]
92   configs += [ "//build/config:precompiled_headers" ]
94   # New deps should go in the non-iOS section below.
95   public_deps = [
96     "//content/test:test_support",
97   ]
98   deps = [
99     "//base:prefs_test_support",
100     "//base/test:test_support",
101     "//chrome:resources",
102     "//chrome:strings",
103     "//chrome/app:test_support",
105     #"//chrome/app/theme:theme_resources",
106     "//chrome/browser:test_support",
107     "//chrome/common:test_support",
108     "//chrome/renderer:test_support",
109     "//components/bookmarks/test",
110     "//components/gcm_driver:test_support",
111     "//components/gcm_driver/instance_id:test_support",
112     "//components/history/core/test:test",
113     "//components/metrics:test_support",
114     "//components/omnibox/browser:test_support",
115     "//components/password_manager/core/browser:test_support",
116     "//components/pref_registry:test_support",
117     "//components/rappor:test_support",
118     "//components/search_engines:test_support",
119     "//components/signin/core/browser:test_support",
120     "//components/sync_driver:test_support",
121     "//components/update_client:test_support",
122     "//content/public/app:both",
123     "//ui/gfx:test_support",
124     "//net",
125     "//net:test_support",
126     "//skia",
127     "//sql",
128     "//sql:test_support",
129     "//sync",
130     "//testing/gmock",
131     "//testing/gtest",
132     "//third_party/zlib",
133     "//ui/message_center:test_support",
134   ]
136   if (!is_ios) {
137     deps += [
138       "//chrome/child",
139       "//chrome/plugin",
140       "//chrome/renderer",
141       "//chrome/utility",
142       "//content/public/child",
143       "//content/public/common",
144       "//content/public/plugin",
145       "//content/public/renderer",
146       "//content/public/utility",
147       "//components/autofill/core/browser:test_support",
148       "//components/captive_portal:test_support",
149       "//components/guest_view/browser:test_support",
150       "//components/infobars/core",
151       "//components/sessions:test_support",
152       "//components/user_manager:test_support",
153       "//components/web_resource:test_support",
154       "//google_apis:test_support",
155       "//ipc:test_support",
156       "//media:test_support",
157       "//ppapi/shared_impl",
158       "//sql:test_support",
159       "//third_party/leveldatabase",
160       "//ui/base",
161       "//ui/events:events_base",
162       "//ui/gl",
163     ]
164   }
166   if (enable_extensions) {
167     deps += [
168       "//chrome/common/extensions/api",
169       "//extensions:test_support",
170     ]
171   }
173   if (is_linux) {
174     deps += [ "//crypto:platform" ]
175   }
176   if (is_mac) {
177     # deps += [ '../third_party/ocmock/ocmock.gyp:ocmock' ] TODO(GYP)
178   }
179   if (is_win) {
180     deps += [ "//third_party/wtl" ]
181     if (use_aura) {
182       deps += [
183         "//win8:test_registrar_constants",
184         "//win8:test_support_win8",
185       ]
186     }
187   }
188   if (is_chromeos) {
189     deps += [ "//components/ownership" ]
190   }
192   if (use_aura) {
193     sources += [
194       "base/test_browser_window_aura.cc",
195       "base/test_browser_window_aura.h",
196     ]
197   }
199   if (enable_plugins) {
200     sources += [
201       "ppapi/ppapi_test.cc",
202       "ppapi/ppapi_test.h",
203     ]
204     deps += [ "//pdf" ]
205   }
207   if (use_ash) {
208     deps += [ "//ash:test_support" ]
209   }
210   if (toolkit_views) {
211     deps += [ "//ui/views:test_support" ]
212   }
214   if (enable_extensions) {
215     deps += [
216       "//chrome/common/extensions/api",
217       "//extensions:test_support",
218     ]
219   }
222 if (!is_android) {
223   import("//third_party/protobuf/proto_library.gni")
225   # GYP version: chrome/chrome_tests_unit.gypi:ipc_protobuf_message_test_proto
226   proto_library("test_proto") {
227     sources = [
228       "../common/safe_browsing/ipc_protobuf_message_test.proto",
229     ]
230   }
232   # TODO(GYP): Delete this after we've converted everything to GN.
233   # The _run targets exist only for compatibility w/ GYP.
234   group("interactive_ui_tests_run") {
235     testonly = true
236     deps = [
237       ":interactive_ui_tests",
238     ]
239   }
241   test("interactive_ui_tests") {
242     sources =
243         rebase_path(chrome_tests_gypi_values.chrome_interactive_ui_test_sources,
244                     ".",
245                     "//chrome")
247     configs += [ "//build/config:precompiled_headers" ]
249     data = [
250       "data/",
251       "//net/data/ssl/certificates/",
252       "//net/tools/testserver/",
253       "//ppapi/tests/test_case.html",
254       "//ppapi/tests/test_case.html.mock-http-headers",
255       "//ppapi/tests/test_page.css",
256       "//ppapi/tests/test_page.css.mock-http-headers",
257       "//third_party/pyftpdlib/",
258       "//third_party/pywebsocket/",
259       "//third_party/tlslite/",
260       "//third_party/zlib/google/test/data/",
261       "//tools/metrics/histograms/histograms.xml",
262       "$root_out_dir/pyproto/google/",
263       "$root_out_dir/resources.pak",
264       "$root_out_dir/ui_test.pak",
265     ]
266     if (is_linux || is_win) {
267       data += [
268         "$root_out_dir/chrome_100_percent.pak",
269         "$root_out_dir/locales/en-US.pak",
270         "$root_out_dir/locales/fr.pak",
271       ]
272     }
273     if (is_linux) {
274       data += [ "$root_out_dir/libppapi_tests.so" ]
275     }
277     defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
278     ldflags = []
280     deps = [
281       "//base/allocator",
282       "//chrome/browser",
283       "//chrome/browser/devtools",
284       "//chrome/renderer",
285       "//chrome/test:test_support",
286       "//chrome:resources",
287       "//chrome:strings",
288       "//chrome:packed_extra_resources",
289       "//chrome:packed_resources",
290       "//components/resources",
291       "//content/app/resources",
292       "//crypto:platform",
293       "//crypto:test_support",
294       "//google_apis:test_support",
295       "//net",
296       "//net:net_resources",
297       "//net:test_support",
298       "//skia",
299       "//sync",
300       "//testing/gmock",
301       "//testing/gtest",
302       "//third_party/hunspell",
303       "//third_party/icu",
304       "//third_party/libpng",
305       "//third_party/zlib",
306       "//ui/base:test_support",
307       "//ui/resources:ui_test_pak",
308       "//ui/web_dialogs:test_support",
309     ]
311     # TODO(rockot) bug 505926: The chrome_extensions_interactive_uitests target
312     # should be deleted and this line removed. See the
313     # chrome_extensions_interactive_uitests target for more.
314     deps += [ "//extensions:chrome_extensions_interactive_uitests" ]
316     # Runtime dependencies
317     data_deps = [
318       "//ppapi:ppapi_tests",
319       "//third_party/mesa:osmesa",
320     ]
322     if (toolkit_views) {
323       sources += rebase_path(
324               chrome_tests_gypi_values.chrome_interactive_ui_test_views_sources,
325               ".",
326               "//chrome")
327       deps += [
328         "//ui/views",
329         "//ui/views:test_support",
330         "//ui/views/controls/webview:test_support",
331       ]
332       if (!is_mac) {
333         sources += rebase_path(
334                 chrome_tests_gypi_values.chrome_interactive_ui_test_views_non_mac_sources,
335                 ".",
336                 "//chrome")
337       }
338       if (is_linux) {
339         # TODO(gbillock): aura linux does not support the automation for
340         # SendMouseMoveNotifyWhenDone
341         sources -= [ "../browser/ui/views/toolbar/toolbar_button_test.cc" ]
342       }
343       if (is_chromeos || !use_x11) {
344         sources -= [
345           "../../ui/views/widget/desktop_aura/desktop_window_tree_host_x11_interactive_uitest.cc",
346           "../../ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc",
347         ]
348       }
349       if (use_aura) {
350         deps += [ "//ui/touch_selection" ]
351       }
352     }
354     if (is_linux && !is_chromeos) {
355       # Desktop linux.
356       sources -= [
357         # TODO(port): This times out. Attempts have been made to fix the
358         # individual failures, but each time I disable a test from these
359         # suites, it seems like one or another starts timing out too.
360         "../browser/ui/views/keyboard_access_browsertest.cc",
361       ]
362     } else {
363       # Everything but desktop Linux.
364       sources += rebase_path(
365               chrome_tests_gypi_values.chrome_interactive_ui_test_non_desktop_linux_sources,
366               ".",
367               "//chrome")
368     }
370     if (is_chromeos) {
371       sources += rebase_path(
372               chrome_tests_gypi_values.chrome_interactive_ui_test_chromeos_sources,
373               ".",
374               "//chrome")
375       sources += [ "../browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc" ]
376       sources -= [
377         # Use only the _chromeos version on ChromeOS.
378         "base/view_event_test_platform_part_ash.cc",
379       ]
381       deps += [
382         "//ash/resources",
383         "//chromeos",
384       ]
386       if (enable_nacl) {
387         deps += [
388           "//native_client/src/trusted/service_runtime/linux:munge_nacl_helper_bootstrap",
389           "//components/nacl:nacl_helper",
391           # '../components/nacl_nonsfi.gyp:nacl_helper_nonsfi',  TODO(GYP)
392         ]
393       }
395       if (is_chrome_branded) {
396         sources -= [
397           # These tests are failing on official cros bots. crbug.com/431450.
398           "../browser/ui/views/bookmarks/bookmark_bar_view_test.cc",
399         ]
400       }
401     } else {
402       # ChromeOS doesn't use panels, everybody else does.
403       sources += rebase_path(
404               chrome_tests_gypi_values.chrome_interactive_ui_test_panels_sources,
405               ".",
406               "//chrome")
408       # TODO(tapted): Include on mac when views panels are ported.
409       if (toolkit_views && !is_mac) {
410         sources += rebase_path(
411                 chrome_tests_gypi_values.chrome_interactive_ui_test_panels_views_sources,
412                 ".",
413                 "//chrome")
414       }
415     }
417     if (!is_linux) {
418       # Non-Linux platforms (Linux includes ChromeOS here).
419       sources += rebase_path(
420               chrome_tests_gypi_values.chrome_interactive_ui_test_non_linux_and_chromeos_sources,
421               ".",
422               "//chrome")
423     }
425     if (is_win) {
426       sources += rebase_path(
427               chrome_tests_gypi_values.chrome_interactive_ui_test_win_sources,
428               ".",
429               "//chrome")
430       deps += [
431         "//chrome:other_version",
432         "//third_party/isimpledom",
433         "//third_party/wtl",
434         "//ui/resources",
435       ]
437       configs -= [ "//build/config/win:default_incremental_linking" ]
438       configs +=
439           [ "//build/config/win:default_large_module_incremental_linking" ]
441       libs = [ "oleacc.lib" ]
442     }
444     if (is_mac) {
445       data_deps += [ "//chrome" ]
447       # TODO(mark): We really want this for all non-static library targets, but
448       # when we tried to pull it up to the common.gypi level, it broke other
449       # things like the ui and startup tests. *shrug*
450       ldflags += [ "-Wl,-ObjC" ]
451     }
453     if (cld_version == 2) {
454       # Interactive tests should use whatever CLD2 data access mode that the
455       # application embedder is using.
456       deps += [ "//third_party/cld_2:cld2_platform_impl" ]
457     }
459     if (use_x11) {
460       configs += [ "//build/config/linux:xtst" ]
461       data_deps += [ "//tools/xdisplaycheck" ]
462     }
464     if (enable_app_list) {
465       sources += rebase_path(
466               chrome_tests_gypi_values.chrome_interactive_ui_test_app_list_sources,
467               ".",
468               "//chrome")
469     }
471     if (use_ash) {
472       sources += rebase_path(
473               chrome_tests_gypi_values.chrome_interactive_ui_test_ash_sources,
474               ".",
475               "//chrome")
476       deps += [ "//ash:interactive_ui_test_support" ]
477     }
479     if (enable_notifications) {
480       sources += rebase_path(
481               chrome_tests_gypi_values.chrome_interactive_ui_test_notifications_sources,
482               ".",
483               "//chrome")
485       # Non-ChromeOS notifications tests (ChromeOS does not use cross-platform
486       # panels).
487       if (!is_chromeos) {
488         sources += [
489           "../browser/notifications/notification_browsertest.cc",
490           "../browser/notifications/platform_notification_service_browsertest.cc",
491         ]
492       }
494       if (is_android) {
495         sources -= [
496           # Android does not use the message center-based Notification system.
497           "../browser/notifications/message_center_notifications_browsertest.cc",
499           # TODO(peter): Enable the Notification browser tests.
500           "../browser/notifications/notification_browsertest.cc",
501           "../browser/notifications/platform_notification_service_browsertest.cc",
502         ]
503       }
504     }  # enable_notifications
506     if (use_aura || is_chromeos) {
507       sources -=
508           [ "../../ui/views/corewm/desktop_capture_controller_unittest.cc" ]
509     }
510   }
512   source_set("sync_integration_test_support") {
513     testonly = true
514     sources = rebase_path(
515             chrome_tests_gypi_values.test_support_sync_integration_sources,
516             ".",
517             "//chrome")
518     public_deps = [
519       "//chrome/browser",
520     ]
521     deps = [
522       ":test_support",
523       "//base",
524       "//chrome",
525       "//components/invalidation/impl",
526       "//components/invalidation/impl:test_support",
527       "//net",
528       "//skia",
529       "//sync",
530       "//sync:test_support_sync_testserver",
531       "//sync:test_support_sync_fake_server",
532       "//ui/app_list:test_support",
533     ]
535     if (is_mac) {
536       sources -= [
537         "../browser/sync/test/integration/dictionary_helper.cc",
538         "../browser/sync/test/integration/dictionary_helper.h",
539         "../browser/sync/test/integration/dictionary_load_observer.cc",
540         "../browser/sync/test/integration/dictionary_load_observer.h",
541       ]
542     }
543     if (!enable_app_list) {
544       sources -= [
545         "../browser/sync/test/integration/sync_app_list_helper.cc",
546         "../browser/sync/test/integration/sync_app_list_helper.h",
547       ]
548     }
549     if (!is_chromeos) {
550       sources -= [
551         "../browser/sync/test/integration/wifi_credentials_helper.cc",
552         "../browser/sync/test/integration/wifi_credentials_helper.h",
553       ]
554     }
555   }
557   js2gtest("browser_tests_js_webui") {
558     test_type = "webui"
559     sources = rebase_path(
560             chrome_tests_gypi_values.chrome_browser_tests_webui_js_sources,
561             ".",
562             "//chrome")
563     if (is_chrome_branded) {
564       # crbug.com/230471
565       sources -= [ "data/webui/accessibility_audit_browsertest.js" ]
566     }
567     if (!is_chromeos) {
568       sources -= [ "data/webui/certificate_viewer_dialog_test.js" ]
569     }
570     if (!enable_app_list) {
571       sources -= [ "../browser/ui/webui/app_list/start_page_browsertest.js" ]
572     }
573     if (!enable_supervised_users) {
574       sources -=
575           [ "../browser/ui/webui/downloads_ui_supervised_browsertest.js" ]
576     }
577     if (!enable_print_preview) {
578       sources -= [ "data/webui/print_preview.js" ]
579     }
580     if (enable_media_router) {
581       sources +=
582           [ "data/webui/media_router/media_router_elements_browsertest.js" ]
583     }
584     deps = [
585       "//chrome/browser/ui",
586       "//skia",
587     ]
588     defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
589   }
591   # TODO(GYP): Delete this after we've converted everything to GN.
592   # The _run targets exist only for compatibility w/ GYP.
593   group("tab_capture_end2end_tests_run") {
594     testonly = true
595     deps = [
596       ":browser_tests",
597     ]
598   }
600   # TODO(GYP): Delete this after we've converted everything to GN.
601   # The _run targets exist only for compatibility w/ GYP.
602   group("browser_tests_run") {
603     testonly = true
604     deps = [
605       ":browser_tests",
606     ]
607   }
609   test("browser_tests") {
610     sources = [
611       "base/browser_tests_main.cc",
612     ]
613     sources +=
614         rebase_path(chrome_tests_gypi_values.chrome_browser_tests_sources,
615                     ".",
616                     "//chrome")
617     sources += rebase_path(
618             chrome_tests_gypi_values.chrome_browser_extensions_test_support_sources,
619             ".",
620             "//chrome")
622     configs += [ "//build/config:precompiled_headers" ]
624     data = [
625       "data/",
626       "//chrome/browser/policy/test/asn1der.py",
627       "//chrome/browser/policy/test/policy_testserver.py",
628       "//chrome/common/extensions/docs/examples/apps/calculator/",
629       "//chrome/third_party/mock4js/",
630       "//content/test/data/",
631       "//google_apis/test/",
632       "//media/test/data/",
633       "//net/data/",
634       "//net/tools/testserver/",
635       "//ppapi/tests/test_case.html",
636       "//ppapi/tests/test_case.html.mock-http-headers",
637       "//ppapi/tests/test_page.css",
638       "//ppapi/tests/test_page.css.mock-http-headers",
639       "//testing/test_env.py",
640       "//third_party/accessibility-audit/axs_testing.js",
641       "//third_party/mocha/mocha.js",
642       "//third_party/pyftpdlib/",
643       "//third_party/pywebsocket/",
644       "//third_party/safe_browsing/",
645       "//third_party/simplejson/",
646       "//third_party/tlslite/",
647       "//ui/webui/resources/js/",
648       "$root_out_dir/pyproto/",
649       "$root_out_dir/browser_tests.pak",
650       "$root_out_dir/chrome_100_percent.pak",
651       "$root_out_dir/locales/",
652       "$root_out_dir/remoting/unittests/",
653       "$root_out_dir/resources.pak",
654       "$root_out_dir/resources/extension/",
655       "$root_out_dir/test_case.html",
656       "$root_out_dir/test_case.html.mock-http-headers",
657       "$root_out_dir/test_data/",
658       "$root_out_dir/test_page.css",
659       "$root_out_dir/test_page.css.mock-http-headers",
660       "$root_out_dir/test_url_loader_data/",
661     ]
663     deps = [
664       ":browser_tests_js_webui",
665       ":sync_integration_test_support",
666       ":test_support",
667       "//base",
668       "//base:i18n",
669       "//base/allocator",
670       "//base/test:test_support",
671       "//chrome:browser_tests_pak",
672       "//chrome:packed_extra_resources",
673       "//chrome:packed_resources",
674       "//chrome:resources",
675       "//chrome:strings",
676       "//chrome/browser",
677       "//chrome/browser/resources:extension_resource_demo",
678       "//chrome/common/extensions/api",
679       "//chrome/renderer",
680       "//components/autofill/content/browser:risk_proto",
681       "//components/autofill/content/browser/wallet:test_support",
682       "//components/autofill/content/renderer:test_support",
683       "//components/captive_portal:test_support",
684       "//components/dom_distiller/content:content_browser",
685       "//components/dom_distiller/core:test_support",
686       "//components/guest_view/browser:test_support",
687       "//components/resources",
688       "//components/strings",
689       "//components/translate/core/common",
690       "//components/user_manager:test_support",
691       "//crypto:platform",
692       "//crypto:test_support",
693       "//device/bluetooth:mocks",
694       "//device/serial:test_support",
695       "//extensions/common/api",
696       "//google_apis:test_support",
697       "//media",
698       "//media/base:test_support",
699       "//media/cast:test_support",
700       "//net",
701       "//net:test_support",
702       "//sdch",
703       "//skia",
704       "//sync",
705       "//sync:test_support_sync_api",
706       "//testing/gmock",
707       "//testing/gtest",
708       "//testing/perf",
709       "//third_party/cacheinvalidation",
710       "//third_party/icu",
711       "//third_party/leveldatabase",
712       "//third_party/libaddressinput",
713       "//third_party/libjingle",
714       "//third_party/safe_browsing:test_support",
715       "//third_party/webrtc/modules/desktop_capture",
716       "//third_party/widevine/cdm:version_h",
717       "//ui/accessibility:test_support",
718       "//ui/base:test_support",
719       "//ui/compositor:test_support",
720       "//ui/resources",
721       "//ui/web_dialogs:test_support",
722       "//v8",
723     ]
725     # TODO(rockot) bug 505926: The chrome_extensions_browsertests target should
726     # be deleted and this line removed. See the chrome_extensions_browsertests
727     # target for more.
728     deps += [ "//extensions:chrome_extensions_browsertests" ]
730     # Runtime dependencies
731     data_deps = [
732       "//ppapi:ppapi_tests",
733       "//ppapi:power_saver_test_plugin",
734       "//remoting/webapp:browser_test_resources",
735       "//remoting/webapp:unit_tests",
736       "//third_party/mesa:osmesa",
737       "//third_party/widevine/cdm:widevine_test_license_server",
738     ]
740     defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
742     if (!enable_nacl_browsertests) {
743       defines += [ "DISABLE_NACL_BROWSERTESTS" ]
744     }
746     # TODO(GYP) if (is_win) {
747     #       ['incremental_chrome_dll==1', {
748     #         'UseLibraryDependencyInputs': "true",
749     # }
751     if (cld_version == 2) {
752       # Because the browser_tests use translate, they need CLD data.
753       deps += [ "//third_party/cld_2:cld2_platform_impl" ]
754     }
756     if (!enable_one_click_signin) {
757       sources -= [ "../browser/ui/sync/one_click_signin_bubble_links_delegate_browsertest.cc" ]
758     }
759     if (!enable_nacl_browsertests) {
760       sources -= [ "../browser/extensions/api/hotword_private/hotword_private_apitest.cc" ]
761     } else if (enable_nacl) {
762       sources += [
763         "../browser/extensions/extension_nacl_browsertest.cc",
764         "../browser/nacl_host/test/gdb_debug_stub_browsertest.cc",
765       ]
766       deps += [ "//components/nacl/renderer/plugin:nacl_trusted_plugin" ]
768       if (enable_nacl_untrusted) {
769         sources += [
770           "nacl/nacl_browsertest.cc",
771           "nacl/nacl_browsertest_uma.cc",
772           "nacl/nacl_browsertest_util.cc",
773           "nacl/nacl_browsertest_util.h",
774           "nacl/pnacl_header_test.cc",
775           "nacl/pnacl_header_test.h",
776         ]
778         # TODO(GYP): Make NaCl work in other configs and update the irt
779         # dependency as appropriate. We should probably push this
780         # dependency into ppapi/native_client so that clients don't need
781         # to know all of the different toolchain options.
782         assert(current_cpu == "x64")
783         data_deps += [
784           # "test/data/nacl:shared_test_files",  # TODO(GYP) bug 512902
785           "//ppapi/native_client:nacl_irt(//native_client/build/toolchain/nacl:irt_x64)",
786           # "../ppapi/ppapi_nacl.gyp:ppapi_nacl_tests",  # TODO(GYP) bug 512901
787           # "../ppapi/tests/extensions/extensions.gyp:ppapi_tests_extensions_background_keepalive",  # TODO(GYP) bug 512900
788           # "../ppapi/tests/extensions/extensions.gyp:ppapi_tests_extensions_media_galleries",  # TODO(GYP) bug 512900
789           # "../ppapi/tests/extensions/extensions.gyp:ppapi_tests_extensions_packaged_app",  # TODO(GYP) bug 512900
790         ]
791         if (is_chromeos) {
792           sources += [ "//third_party/liblouis/nacl_wrapper/liblouis_wrapper_browsertest.cc" ]
793           deps += [
794             "//chrome/browser/chromeos",
795             #'../third_party/liblouis/liblouis_nacl.gyp:liblouis_test_data',  TODO(GYP) bug 512906
796           ]
797         }
798       }
799       if (is_win || is_linux) {
800         sources += [ "../browser/nacl_host/test/nacl_gdb_browsertest.cc" ]
801         deps += [ "//chrome/browser/nacl_host/test:mock_nacl_gdb" ]
802       }
803       if (is_win) {
804         # TODO(halyavin) NaCl on Windows can't open debug stub socket in
805         # browser process as needed by this test. See http://crbug.com/157312.
806         sources -= [ "../browser/nacl_host/test/gdb_debug_stub_browsertest.cc" ]
807         deps += [
808           #'chrome.gyp:chrome_nacl_win64',  TODO(GYP) bug 512869
809         ]
810         configs -= [ "//build/config/win:default_incremental_linking" ]
811         configs +=
812             [ "//build/config/win:default_large_module_incremental_linking" ]
813       }
814       if (is_linux) {
815         deps += [
816           "//native_client/src/trusted/service_runtime/linux:munge_nacl_helper_bootstrap",
817           "//components/nacl:nacl_helper",
819           # "//components/nacl_nonsfi.gyp:nacl_helper_nonsfi",  # TODO(GYP) bug 512912.
820         ]
821       }
822     }
823     if (debug_devtools) {
824       defines += [ "DEBUG_DEVTOOLS=1" ]
825     }
826     if (use_ash) {
827       deps += [ "//ash:test_support" ]
828     }
829     if (use_aura || toolkit_views) {
830       deps += [ "//ui/events:test_support" ]
831     }
832     if (toolkit_views) {
833       sources += rebase_path(
834               chrome_tests_gypi_values.chrome_browser_tests_views_sources,
835               ".",
836               "//chrome")
837       deps += [ "//ui/views" ]
838       if (!is_mac) {
839         sources += rebase_path(
840                 chrome_tests_gypi_values.chrome_browser_tests_views_non_mac_sources,
841                 ".",
842                 "//chrome")
843       }
844     }
845     if (is_chromeos) {
846       sources += rebase_path(
847               chrome_tests_gypi_values.chrome_browser_tests_chromeos_sources,
848               ".",
849               "//chrome")
850       sources -= [
851         "../../apps/load_and_launch_browsertest.cc",
852         "../browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc",
853         "../browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc",
855         # chromeos does not support profile list avatar menu
856         "../browser/profiles/profile_list_desktop_browsertest.cc",
857         "../browser/service_process/service_process_control_browsertest.cc",
859         # chromeos does not use cross-platform panels
860         "../browser/ui/panels/panel_extension_browsertest.cc",
862         # chromeos does not use the desktop user manager
863         "../browser/ui/webui/signin/user_manager_ui_browsertest.cc",
864       ]
865       deps += [
866         "//dbus",
867         "//dbus:test_support",
868         "//ui/login:resources",
869       ]
870     } else {
871       sources -= [
872         "../browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc",
873         "../browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc",
874         "../browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc",
875         "../browser/extensions/api/terminal/terminal_private_apitest.cc",
876         "../browser/invalidation/profile_invalidation_provider_factory_browsertest.cc",
877         "../browser/net/nss_context_chromeos_browsertest.cc",
878         "../browser/ui/ash/keyboard_controller_browsertest.cc",
879         "data/webui/certificate_viewer_ui_test-inl.h",
880       ]
881       if (toolkit_views) {
882         sources -= [ "../browser/ui/views/select_file_dialog_extension_browsertest.cc" ]
883       }
884     }
885     if (enable_configuration_policy) {
886       sources += rebase_path(
887               chrome_tests_gypi_values.chrome_browser_tests_policy_sources,
888               ".",
889               "//chrome")
890     }
891     if (enable_web_speech) {
892       sources += rebase_path(
893               chrome_tests_gypi_values.chrome_browser_tests_speech_sources,
894               ".",
895               "//chrome")
896     }
897     if (safe_browsing_mode == 1) {
898       sources += rebase_path(
899               chrome_tests_gypi_values.chrome_browser_tests_full_safe_browsing_sources,
900               ".",
901               "//chrome")
902     }
903     if (enable_captive_portal_detection) {
904       sources += [ "../browser/captive_portal/captive_portal_browsertest.cc" ]
905     }
906     if (!enable_webrtc) {
907       sources -= [
908         "../browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc",
909         "../browser/extensions/api/webrtc_logging_private/webrtc_logging_private_apitest.cc",
910         "../browser/media/chrome_webrtc_browsertest.cc",
911         "../browser/media/chrome_webrtc_disable_encryption_flag_browsertest.cc",
912         "../browser/media/chrome_webrtc_getmediadevices_browsertest.cc",
913       ]
914     }
915     if (enable_media_router) {
916       sources += rebase_path(
917               chrome_tests_gypi_values.chrome_browser_tests_media_router_sources,
918               ".",
919               "//chrome")
920       deps += [ "//chrome/browser/media/router:test_support" ]
921     }
922     if (is_win) {
923       deps += [
924         "//chrome:other_version",
925         "//third_party/wtl",
926         "//ui/resources",
927       ]
928     } else {
929       sources -= [
930         "../app/chrome_command_ids.h",
931         "../app/chrome_dll_resource.h",
932         "../app/chrome_version.rc.version",
933         "../browser/media_galleries/fileapi/iapps_finder_impl_win_browsertest.cc",
934       ]
935     }
936     if (!is_chromeos && use_aura) {
937       sources -= [
938         # On Windows and Linux, we currently don't support enough of the
939         # ash environment to run these unit tests.
940         #
941         # TODO: enable these on windows and linux.
942         "../browser/ui/ash/accelerator_commands_browsertest.cc",
943         "../browser/ui/ash/accelerator_controller_browsertest.cc",
944         "../browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc",
945         "../browser/ui/ash/launcher/launcher_favicon_loader_browsertest.cc",
946         "../browser/ui/ash/shelf_browsertest.cc",
947         "../browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc",
948       ]
949     }
950     if (is_mac) {
951       # TODO(mark): We really want this for all non-static library
952       # targets, but when we tried to pull it up to the common.gypi
953       # level, it broke other things like the ui and startup tests. *shrug*
954       ldflags = [ "-Wl,-ObjC" ]
956       # Other platforms only need
957       # chrome_resources.gyp:{packed_extra_resources,packed_resources},
958       # and can build this target standalone much faster.
959       deps += [
960         #'app_mode_app_support',  TODO(GYP)
961         "//chrome",
963         #'../components/components.gyp:breakpad_stubs',  TODO(GYP)
964         "//third_party/ocmock",
965       ]
966       sources += [
967         "../browser/media_galleries/fileapi/iphoto_data_provider_browsertest.cc",
968         "../browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm",
969         "../browser/spellchecker/spellcheck_message_filter_platform_mac_browsertest.cc",
970       ]
971       sources -= [
972         # TODO(groby): This test depends on hunspell and we cannot run it on
973         # Mac, which does not use hunspell by default.
974         "../browser/spellchecker/spellcheck_service_browsertest.cc",
976         # TODO(rouslan): This test depends on the custom dictionary UI,
977         # which is disabled on Mac.
978         # TODO(GYP): This should be added somewhere first ...
979         # "../browser/ui/webui/options/edit_dictionary_browsertest.js",
981         # TODO(rouslan): This test depends on hunspell and we cannot run it
982         # on Mac, which does use hunspell by default.
983         # TODO(GYP): This should be added somewhere first ...
984         # "../browser/ui/webui/options/language_options_dictionary_download_browsertest.js",
986         # ProcessSingletonMac doesn"t do anything.
987         "../browser/process_singleton_browsertest.cc",
989         # This test depends on GetCommandLineForRelaunch, which is not
990         # available on Mac.
991         "../browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc",
993         # single-process mode hangs on Mac sometimes because of multiple UI
994         # message loops. See 306348
995         "../renderer/safe_browsing/phishing_classifier_browsertest.cc",
996         "../renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc",
997         "../renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc",
998       ]
999     }
1000     if (is_mac || is_win) {
1001       sources += [
1002         "../browser/extensions/api/networking_private/networking_private_apitest.cc",
1003         "../browser/extensions/api/networking_private/networking_private_service_client_apitest.cc",
1004         "../browser/media_galleries/fileapi/itunes_data_provider_browsertest.cc",
1005         "../browser/media_galleries/fileapi/picasa_data_provider_browsertest.cc",
1006       ]
1007       deps += [ "//components/wifi:test_support" ]
1008     }
1009     if (!is_posix || is_chromeos) {
1010       sources -= [ "../common/time_format_browsertest.cc" ]
1011     }
1012     if (is_android) {
1013       sources -= [
1014         "../browser/policy/cloud/component_cloud_policy_browsertest.cc",
1015         "../browser/prefs/pref_hash_browsertest.cc",
1016         "../renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc",
1017         "../renderer/spellchecker/spellcheck_unittest.cc",
1018       ]
1019     }
1020     if (is_chromeos) {
1021       sources += [
1022         "../browser/extensions/api/networking_private/networking_private_apitest.cc",
1023         "../browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc",
1024       ]
1025     }
1026     if (!is_android && !is_ios && enable_nacl_browsertests) {
1027       sources +=
1028           [ "../browser/copresence/chrome_whispernet_client_browsertest.cc" ]
1029       deps += [ "//components/copresence" ]
1030     }
1031     if (enable_app_list) {
1032       sources += rebase_path(
1033               chrome_tests_gypi_values.chrome_browser_tests_app_list_sources,
1034               ".",
1035               "//chrome")
1036     }
1037     if (enable_supervised_users) {
1038       sources += rebase_path(
1039               chrome_tests_gypi_values.chrome_browser_tests_supervised_user_sources,
1040               ".",
1041               "//chrome")
1042     }
1043     if (enable_pepper_cdms) {
1044       # Runtime dependencies.
1045       data_deps += [
1046         "//media/cdm/ppapi:clearkeycdmadapter",
1047         "//third_party/widevine/cdm:widevinecdmadapter",
1048       ]
1049     }
1050     if (!enable_print_preview) {
1051       sources -= [
1052         "../browser/extensions/api/cloud_print_private/cloud_print_private_apitest.cc",
1053         "../browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc",
1054         "../browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc",
1055         "../browser/printing/print_preview_dialog_controller_browsertest.cc",
1056         "../browser/printing/print_preview_pdf_generated_browsertest.cc",
1057         "../browser/service_process/service_process_control_browsertest.cc",
1058         "../browser/ui/webui/print_preview/print_preview_ui_browsertest.cc",
1059         "data/webui/print_preview.cc",
1060         "data/webui/print_preview.h",
1061       ]
1062     }
1063     if (enable_mdns) {
1064       sources += [ "../browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc" ]
1065     }
1066     if (use_brlapi) {
1067       deps += [ "//build/config/linux:libbrlapi" ]
1068     } else {
1069       sources -= [ "../browser/extensions/api/braille_display_private/braille_display_private_apitest.cc" ]
1070     }
1071     if (is_chrome_branded) {
1072       sources -= [
1073         # These tests depend on single process mode, which is disabled in
1074         # official builds.
1075         "../renderer/safe_browsing/phishing_classifier_browsertest.cc",
1076         "../renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc",
1077         "../renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc",
1078       ]
1079     }
1080     if (!enable_autofill_dialog || is_android || is_ios) {
1081       deps -= [ "//third_party/libaddressinput" ]
1082     }
1083     if (enable_remoting) {
1084       sources += rebase_path(
1085               chrome_tests_gypi_values.chrome_browser_tests_remoting_sources,
1086               ".",
1087               "//chrome")
1088       #deps += [ "//remoting:remoting_webapp" ]  TODO(GYP)
1089     }
1090     if (use_x11) {
1091       deps += [ "//tools/xdisplaycheck" ]
1092     }
1093   }
1095   # TODO(GYP): Delete this after we've converted everything to GN.
1096   # The _run targets exist only for compatibility w/ GYP.
1097   group("sync_integration_tests_run") {
1098     testonly = true
1099     deps = [
1100       ":sync_integration_tests",
1101     ]
1102   }
1104   test("sync_integration_tests") {
1105     sources =
1106         rebase_path(chrome_tests_gypi_values.sync_integration_tests_sources,
1107                     ".",
1108                     "//chrome")
1110     data = [
1111       "//chrome/test/data/sync/",
1112       "//net/tools/testserver/",
1113       "//sync/tools/testserver/",
1114       "//third_party/pyftpdlib/",
1115       "//third_party/pywebsocket/",
1116       "//third_party/tlslite/",
1117       "$root_out_dir/pyproto/",
1118       "$root_out_dir/resources.pak",
1119     ]
1121     if (is_linux || is_win) {
1122       data += [
1123         "$root_out_dir/chrome_100_percent.pak",
1124         "$root_out_dir/locales/en-US.pak",
1125       ]
1126     }
1128     # TODO(phajdan.jr): Only temporary, to make transition easier.
1129     defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
1131     deps = [
1132       ":sync_integration_test_support",
1133       ":test_support",
1134       "//base/allocator",
1135       "//chrome:packed_extra_resources",
1136       "//chrome:packed_resources",
1137       "//chrome:resources",
1138       "//chrome:strings",
1139       "//chrome/common",
1140       "//chrome/renderer",
1141       "//crypto:platform",
1142       "//sync",
1143       "//testing/gmock",
1144       "//testing/gtest",
1145       "//third_party/icu",
1146       "//third_party/leveldatabase",
1147       "//third_party/WebKit/public:blink",
1148     ]
1150     data_deps = [ "//third_party/mesa:osmesa" ]
1152     if (cld_version == 2) {
1153       # Language detection is irrelevant to sync, so it can depend on any
1154       # implementation for CLD2. Dynamic is smaller, so go with dynamic.
1155       deps += [ "//third_party/cld_2:cld2_dynamic" ]
1156     }
1157     if (is_mac) {
1158       # Dictionary sync is disabled on Mac.
1159       sources -= [
1160         "../browser/sync/test/integration/multiple_client_dictionary_sync_test.cc",
1161         "../browser/sync/test/integration/single_client_dictionary_sync_test.cc",
1162         "../browser/sync/test/integration/two_client_dictionary_sync_test.cc",
1163       ]
1165       # The sync_integration_tests do not run on mac without this flag.
1166       # Search for comments about "xcode_settings" elsewhere in this file.
1167       ldflags = [ "-Wl,-ObjC" ]
1168     }
1169     if (is_win) {
1170       deps += [
1171         "//chrome:other_version",
1172         "//third_party/wtl",
1173         "//ui/resources",
1174       ]
1176       configs -= [ "//build/config/win:default_incremental_linking" ]
1177       configs +=
1178           [ "//build/config/win:default_large_module_incremental_linking" ]
1179     } else {
1180       sources -= [ "../app/chrome_version.rc.version" ]
1181     }
1182     if (!is_chromeos) {
1183       sources -= [
1184         "../browser/sync/test/integration/single_client_wifi_credentials_sync_test.cc",
1185         "../browser/sync/test/integration/two_client_wifi_credentials_sync_test.cc",
1186       ]
1187     }
1189     if (toolkit_views) {
1190       deps += [ "//ui/views" ]
1191     }
1192     if (enable_basic_printing || enable_print_preview) {
1193       deps += [ "//printing" ]
1194     }
1195     if (!enable_app_list) {
1196       sources -= [
1197         "../browser/sync/test/integration/single_client_app_list_sync_test.cc",
1198         "../browser/sync/test/integration/two_client_app_list_sync_test.cc",
1199       ]
1200     }
1201     if (!enable_supervised_users) {
1202       sources -= [ "../browser/sync/test/integration/single_client_supervised_user_settings_sync_test.cc" ]
1203     }
1204   }
1206   test("sync_performance_tests") {
1207     sources =
1208         rebase_path(chrome_tests_gypi_values.sync_performance_tests_sources,
1209                     ".",
1210                     "//chrome")
1212     defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
1214     deps = [
1215       ":sync_integration_test_support",
1216       "//base/allocator",
1217       "//crypto:platform",
1218       "//sync",
1219       "//testing/gmock",
1220       "//testing/gtest",
1221     ]
1223     if (cld_version == 2) {
1224       # Language detection is irrelevant to sync, so it can depend on any
1225       # implementation for CLD2. Dynamic is smaller, so go with dynamic.
1226       deps += [ "//third_party/cld_2:cld2_dynamic" ]
1227     }
1229     if (is_mac) {
1230       # Dictionary sync is disabled on Mac.
1231       sources -= [ "../browser/sync/test/integration/performance/dictionary_sync_perf_test.cc" ]
1233       # The sync_performance_tests do not run on mac without this flag.
1234       # Search for comments about "xcode_settings" elsewhere in this file.
1235       ldflags = [ "-Wl,-ObjC" ]
1236     }
1237     if (is_win) {
1238       deps += [
1239         "//chrome:other_version",
1240         "//chrome/installer/util:strings",
1241         "//third_party/wtl",
1242         "//ui/resources",
1243       ]
1244       configs -= [ "//build/config/win:default_incremental_linking" ]
1245       configs +=
1246           [ "//build/config/win:default_large_module_incremental_linking" ]
1247     } else {
1248       sources -= [ "../app/chrome_version.rc.version" ]
1249     }
1251     if (toolkit_views) {
1252       deps += [ "//ui/views" ]
1253     }
1254   }
1256   # Executable to measure time to load libraries.
1257   test("load_library_perf_tests") {
1258     sources = [
1259       "../browser/load_library_perf_test.cc",
1260     ]
1262     deps = [
1263       "//base/test:test_support_perf",
1264       "//testing/gtest",
1265       "//testing/perf",
1266       "//third_party/widevine/cdm:version_h",
1267     ]
1269     if (enable_pepper_cdms) {
1270       data_deps = [
1271         "//media/cdm/ppapi:clearkeycdmadapter",
1272         "//third_party/widevine/cdm:widevinecdmadapter",
1273       ]
1274     }
1275   }
1277   js2gtest("unit_tests_js") {
1278     test_type = "unit"
1279     sources = rebase_path(
1280             chrome_tests_unit_gypi_values.chrome_unit_tests_gtestjs_sources,
1281             ".",
1282             "//chrome")
1283     extra_js_files =
1284         rebase_path(chrome_tests_unit_gypi_values.chrome_unit_tests_js_sources,
1285                     ".",
1286                     "//chrome")
1287     if (is_chromeos) {
1288       sources += rebase_path(
1289               chrome_tests_unit_gypi_values.chrome_unit_tests_chromeos_gtestjs_sources,
1290               ".",
1291               "//chrome")
1292       extra_js_files += rebase_path(
1293               chrome_tests_unit_gypi_values.chrome_unit_tests_chromeos_js_sources,
1294               ".",
1295               "//chrome")
1296     }
1297   }
1299   # TODO(GYP): Delete this after we've converted everything to GN.
1300   # The _run targets exist only for compatibility w/ GYP.
1301   group("unit_tests_run") {
1302     testonly = true
1303     deps = [
1304       ":unit_tests",
1305     ]
1306   }
1308   test("unit_tests") {
1309     sources =
1310         rebase_path(chrome_tests_unit_gypi_values.chrome_unit_tests_sources,
1311                     ".",
1312                     "//chrome")
1314     configs += [ "//build/config:precompiled_headers" ]
1316     data = [
1317       "data/",
1318       "//base/test/data/",
1319       "//chrome/third_party/mock4js/",
1320       "//components/test/data/",
1321       "//extensions/test/data/",
1322       "//google_apis/test/data/",
1323       "//net/data/",
1324       "//net/tools/testserver/",
1325       "//third_party/accessibility-audit/axs_testing.js",
1326       "//third_party/hunspell_dictionaries/",
1327       "//third_party/pyftpdlib/",
1328       "//third_party/pywebsocket/",
1329       "//third_party/tlslite/",
1330       "//third_party/zlib/google/test/data/",
1331       "//tools/metrics/histograms/histograms.xml",
1332       "$root_out_dir/pyproto/google/",
1333       "$root_out_dir/test_data/chrome/browser/resources/google_now/",
1334       "$root_out_dir/test_data/chrome/browser/resources/print_preview/",
1335       "$root_out_dir/test_data/chrome/renderer/resources/extensions/",
1336       "$root_out_dir/test_data/ui/webui/",
1337       "$root_out_dir/resources.pak",
1338     ]
1339     if (is_android || is_linux || is_win) {
1340       data += [
1341         "$root_out_dir/chrome_100_percent.pak",
1342         "$root_out_dir/locales/en-US.pak",
1343       ]
1344     }
1346     defines = []
1348     deps = [
1349       # NOTE: New depndencies should generally be added in the OS!="ios"
1350       # dependencies block below, rather than here.
1351       # Unit tests should only depend on:
1352       # 1) everything that the chrome binaries depend on:
1353       "//chrome:browser_dependencies",
1354       "//chrome:child_dependencies",
1356       # 2) test-specific support libraries:
1357       ":test_support_unit",
1358       "//base/test:test_support",
1359       "//chrome/test:test_support",
1360       "//components/resources",
1361       "//components/content_settings/core/test:test_support",
1362       "//content/test:test_support",
1363       "//content/public/app:both",
1364       "//crypto:platform",
1365       "//crypto:test_support",
1366       "//net",
1367       "//net:test_support",
1368       "//sync:test_support_sync_api",
1369       "//sync:test_support_sync_core",
1370       "//sync:test_support_sync_internal_api",
1371       "//testing/gmock",
1372       "//testing/gtest",
1374       # 3) anything tests directly depend on
1375       "//base/allocator",
1376       "//chrome:resources",
1377       "//chrome:strings",
1378       "//courgette:courgette_lib",
1379       "//google_apis",
1380       "//skia",
1381       "//third_party/cacheinvalidation",
1382       "//third_party/icu",
1383       "//third_party/libxml",
1384       "//ui/base:test_support",
1385       "//ui/gfx:test_support",
1386       "//ui/resources",
1387     ]
1388     data_deps = []
1390     # TODO(GYP) Windows stuff
1391     # ['incremental_chrome_dll==1', {
1392     #   'UseLibraryDependencyInputs': "true",
1394     if (!is_ios) {
1395       deps += [
1396         ":unit_tests_js",
1397         "//components/audio_modem:test_support",
1398         "//components/autofill/content/browser/wallet:test_support",
1399         "//components/autofill/content/renderer:test_support",
1400         "//components/metrics/proto",
1401         "//components/data_reduction_proxy/core/browser:test_support",
1402         "//components/safe_json:test_support",
1403         "//components/webdata_services:test_support",
1404         "//components/strings",
1405         "//device/bluetooth:mocks",
1406         "//content/app/resources",
1407         "//gpu:test_support",
1408         "//media:test_support",
1410         #'../ppapi/ppapi_internal.gyp:ppapi_unittest_shared',  TODO(GYP)
1411         "//third_party/leveldatabase",
1412         "//third_party/libaddressinput",
1413         "//third_party/libjingle",
1414         "//third_party/libphonenumber",
1415         "//third_party/webrtc/modules/desktop_capture",
1416         "//tools/json_schema_compiler/test",
1417         "//ui/gl",
1418         "//v8",
1419       ]
1420     }
1422     if (is_android) {
1423       deps -= [ "//third_party/libaddressinput" ]
1425       # Some android targets still depend on --gc-sections to link.
1426       # TODO: remove --gc-sections for Debug builds (crbug.com/159847).
1427       ldflags = [ "-Wl,--gc-sections" ]
1428       deps += [ "//testing/android/native_test:native_test_native_code" ]
1429       isolate_file = "../unit_tests.isolate"
1430     } else {
1431       sources += rebase_path(
1432               chrome_tests_unit_gypi_values.chrome_unit_tests_non_android_sources,
1433               ".",
1434               "//chrome")
1435     }
1436     if (is_ios || is_chromeos) {
1437       sources -=
1438           [ "../browser/metrics/signin_status_metrics_provider_unittest.cc" ]
1439     }
1440     if (enable_background) {
1441       sources += rebase_path(
1442               chrome_tests_unit_gypi_values.chrome_unit_tests_background_sources,
1443               ".",
1444               "//chrome")
1445     }
1446     if (enable_spellcheck) {
1447       sources += rebase_path(
1448               chrome_tests_unit_gypi_values.chrome_unit_tests_spellchecker_sources,
1449               ".",
1450               "//chrome")
1451       if (is_mac && !is_ios) {
1452         deps += [ "//third_party/hunspell" ]
1453       }
1454     }
1456     if (enable_one_click_signin) {
1457       sources += [
1458         "../browser/ui/sync/one_click_signin_sync_observer_unittest.cc",
1459         "../browser/ui/sync/one_click_signin_sync_starter_unittest.cc",
1460       ]
1461     }
1463     if (enable_extensions) {
1464       sources += rebase_path(
1465               chrome_tests_unit_gypi_values.chrome_unit_tests_extensions_sources,
1466               ".",
1467               "//chrome")
1468       deps += [
1469         "//chrome/common/extensions/api",
1470         "//device/usb:mocks",
1471         "//extensions:extensions_resources",
1472         "//extensions/strings",
1473       ]
1474       if (enable_configuration_policy) {
1475         sources += rebase_path(
1476                 chrome_tests_unit_gypi_values.chrome_unit_tests_extensions_policy_sources,
1477                 ".",
1478                 "//chrome")
1479       }
1480       if (!is_chromeos) {
1481         sources += rebase_path(
1482                 chrome_tests_unit_gypi_values.chrome_unit_tests_extensions_non_chromeos_sources,
1483                 ".",
1484                 "//chrome")
1485       }
1486     }
1487     if (toolkit_views) {
1488       deps += [
1489         "//components/web_modal:test_support",
1490         "//ui/views",
1491         "//ui/views:test_support",
1492       ]
1493       sources += rebase_path(
1494               chrome_tests_unit_gypi_values.chrome_unit_tests_views_sources,
1495               ".",
1496               "//chrome")
1497       if (!is_chromeos && (!is_mac || mac_views_browser)) {
1498         sources += rebase_path(
1499                 chrome_tests_unit_gypi_values.chrome_unit_tests_views_non_chromeos_sources,
1500                 ".",
1501                 "//chrome")
1502       }
1503       if (!is_mac) {
1504         sources += rebase_path(
1505                 chrome_tests_unit_gypi_values.chrome_unit_tests_views_non_mac_sources,
1506                 ".",
1507                 "//chrome")
1508       }
1509     }
1510     if (use_ash) {
1511       sources += rebase_path(
1512               chrome_tests_unit_gypi_values.chrome_unit_tests_ash_sources,
1513               ".",
1514               "//chrome")
1515       deps += [
1516         "//ash:test_support",
1517         "//ash/resources",
1518         "//ash/strings",
1519       ]
1521       # We eventually want to compile both in Win Aura builds, see
1522       # http://crbug.com/155545.
1523       if (!is_win) {
1524         sources -= [ "../browser/ui/window_sizer/window_sizer_unittest.cc" ]
1525       }
1526     }
1527     if (use_aura) {
1528       sources += [ "//ui/views/controls/webview/webview_unittest.cc" ]
1529       deps += [
1530         "//ui/wm",
1531         "//ui/aura:test_support",
1532         "//ui/views:test_support",
1533       ]
1534     }
1535     if (!is_chromeos && is_linux) {
1536       sources += rebase_path(
1537               chrome_tests_unit_gypi_values.chrome_unit_tests_desktop_linux_sources,
1538               ".",
1539               "//chrome")
1540     }
1541     if (!is_chromeos && !use_ozone && is_linux) {
1542       deps += [
1543         "//chrome/browser/ui/libgtk2ui",
1544         "//build/config/linux:gio",
1545       ]
1546     }
1548     if (enable_task_manager) {
1549       sources += rebase_path(
1550               chrome_tests_unit_gypi_values.chrome_unit_tests_task_manager_sources,
1551               ".",
1552               "//chrome")
1553     }
1554     if (enable_mdns) {
1555       sources += rebase_path(
1556               chrome_tests_unit_gypi_values.chrome_unit_tests_mdns_sources,
1557               ".",
1558               "//chrome")
1559     }
1560     if (enable_service_discovery) {
1561       sources += rebase_path(
1562               chrome_tests_unit_gypi_values.chrome_unit_tests_service_discovery_sources,
1563               ".",
1564               "//chrome")
1565     }
1566     if (enable_configuration_policy) {
1567       sources += rebase_path(
1568               chrome_tests_unit_gypi_values.chrome_unit_tests_configuration_policy_sources,
1569               ".",
1570               "//chrome")
1571       if (is_chromeos) {
1572         sources -=
1573             [ "../browser/policy/cloud/user_policy_signin_service_unittest.cc" ]
1574       } else if (is_android) {
1575         sources -= [ "../browser/policy/policy_path_parser_unittest.cc" ]
1576       }
1577       if (!is_android && !is_ios && !is_chromeos) {
1578         sources +=
1579             [ "../browser/net/disk_cache_dir_policy_handler_unittest.cc" ]
1580       }
1581       if (!is_android && !is_ios) {
1582         sources +=
1583             [ "../browser/download/download_dir_policy_handler_unittest.cc" ]
1584       }
1585     }
1586     if (enable_web_speech) {
1587       sources += rebase_path(
1588               chrome_tests_unit_gypi_values.chrome_unit_tests_speech_sources,
1589               ".",
1590               "//chrome")
1591     }
1592     if (enable_notifications) {
1593       sources += rebase_path(
1594               chrome_tests_unit_gypi_values.chrome_unit_tests_notifications_sources,
1595               ".",
1596               "//chrome")
1597       if (is_android) {
1598         sources -= [
1599           # Android does not use the Message Center notification system.
1600           "../browser/notifications/message_center_notifications_unittest.cc",
1601           "../browser/notifications/message_center_settings_controller_unittest.cc",
1602         ]
1603       }
1604     }
1605     if (safe_browsing_mode == 1) {
1606       # TODO(sgurun): enable tests for safe_browsing==2.
1607       sources += rebase_path(
1608               chrome_tests_unit_gypi_values.chrome_unit_tests_full_safe_browsing_sources,
1609               ".",
1610               "//chrome")
1611       deps += [ ":test_proto" ]
1612       if (is_android) {
1613         deps -= [ ":test_proto" ]
1614         sources -= [
1615           # Android doesn't support download feedbacks.
1616           "../browser/safe_browsing/download_feedback_service_unittest.cc",
1617           "../browser/safe_browsing/download_feedback_unittest.cc",
1618           "../browser/safe_browsing/download_protection_service_unittest.cc",
1619           "../browser/safe_browsing/two_phase_uploader_unittest.cc",
1620           "../common/safe_browsing/ipc_protobuf_message_test_messages.h",
1621           "../common/safe_browsing/ipc_protobuf_message_unittest.cc",
1622         ]
1623       }
1624     }
1625     if (enable_autofill_dialog && !is_android) {
1626       sources += rebase_path(
1627               chrome_tests_unit_gypi_values.chrome_unit_tests_autofill_dialog_sources,
1628               ".",
1629               "//chrome")
1630     }
1631     if (enable_plugins) {
1632       sources += rebase_path(
1633               chrome_tests_unit_gypi_values.chrome_unit_tests_plugins_sources,
1634               ".",
1635               "//chrome")
1636     }
1637     if (enable_print_preview) {
1638       sources += rebase_path(
1639               chrome_tests_unit_gypi_values.chrome_unit_tests_print_preview_sources,
1640               ".",
1641               "//chrome")
1642     }
1643     if (enable_captive_portal_detection) {
1644       sources += rebase_path(
1645               chrome_tests_unit_gypi_values.chrome_unit_tests_captive_portal_sources,
1646               ".",
1647               "//chrome")
1648     }
1649     if (enable_session_service) {
1650       sources += rebase_path(
1651               chrome_tests_unit_gypi_values.chrome_unit_tests_session_service_sources,
1652               ".",
1653               "//chrome")
1654     }
1655     if (enable_media_router) {
1656       sources += rebase_path(
1657               chrome_tests_unit_gypi_values.chrome_unit_tests_media_router_sources,
1658               ".",
1659               "//chrome")
1660       deps += [ "//chrome/browser/media/router:test_support" ]
1661       if (!is_android) {
1662         sources += rebase_path(
1663                 chrome_tests_unit_gypi_values.chrome_unit_tests_media_router_non_android_sources,
1664                 ".",
1665                 "//chrome")
1666       }
1667       if (!toolkit_views) {
1668         sources -= [ "../browser/ui/views/media_router/media_router_ui_browsertest.cc" ]
1669       }
1670     }
1671     if (enable_webrtc) {
1672       sources += rebase_path(
1673               chrome_tests_unit_gypi_values.chrome_unit_tests_webrtc_sources,
1674               ".",
1675               "//chrome")
1676     }
1677     if (is_chromeos) {
1678       deps += [ "//chrome/browser/chromeos:unit_tests" ]
1679       sources -= [
1680         "../browser/signin/signin_global_error_unittest.cc",
1681         "../browser/signin/signin_manager_unittest.cc",
1682       ]
1683     }
1684     if (use_x11) {
1685       deps += [ "//ui/events/devices" ]
1686       data_deps += [ "//tools/xdisplaycheck" ]
1687     } else {
1688       sources -= [ "../browser/password_manager/password_store_x_unittest.cc" ]
1689     }
1690     if (cld_version == 2) {
1691       # Unit tests should be independent of the CLD2 access mechanism, just use
1692       # static for simplicity.
1693       deps += [ "//third_party/cld_2:cld2_static" ]
1694     }
1695     if (is_desktop_linux && current_cpu == "x64") {
1696       # Only add this test for 64 bit builds because otherwise we need the 32
1697       # bit library on 64 bit systems when running this test.
1698       sources +=
1699           [ "../browser/password_manager/native_backend_gnome_x_unittest.cc" ]
1700       configs += [
1701         "//chrome/browser:gnome_keyring",
1702         "//chrome/browser:gnome_keyring_direct",
1703       ]
1704     }
1705     if (is_linux && !is_chromeos) {
1706       sources +=
1707           [ "../browser/password_manager/native_backend_libsecret_unittest.cc" ]
1708     }
1709     if (is_linux && use_aura) {
1710       deps += [
1711         "//dbus",
1712         "//dbus:test_support",
1713         "//ui/aura:test_support",
1714       ]
1715     }
1716     if (is_linux && is_chrome_branded && current_cpu == "x86") {
1717       ldflags = [ "-Wl,--strip-debug" ]
1718     }
1719     if (is_mac) {
1720       sources += rebase_path(
1721               chrome_tests_unit_gypi_values.chrome_unit_tests_mac_sources,
1722               ".",
1723               "//chrome")
1724       sources -= [
1725         "../browser/ui/tests/ui_gfx_image_unittest.cc",
1726         "../renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc",
1727         "../tools/convert_dict/convert_dict_unittest.cc",
1728       ]
1730       # The test fetches resources which means Mac need the app bundle to exist
1731       # on disk so it can pull from it.
1732       deps += [
1733         "//third_party/google_toolbox_for_mac",
1734         "//third_party/ocmock",
1735       ]
1737       # TODO(mark): We really want this for all non-static library targets,
1738       # but when we tried to pull it up to the common.gypi level, it broke
1739       # other things like the ui and startup tests. *shrug*
1740       ldflags = [ "-Wl,-ObjC" ]
1741     }
1742     if (!is_mac && !is_ios) {
1743       deps += [
1744         "//chrome/tools/convert_dict:lib",
1745         "//chrome:packed_extra_resources",
1746         "//chrome:packed_resources",
1747         "//third_party/hunspell",
1748       ]
1749     }
1750     if (is_win || is_mac) {
1751       sources += rebase_path(
1752               chrome_tests_unit_gypi_values.chrome_unit_tests_win_mac_sources,
1753               ".",
1754               "//chrome")
1755     }
1756     if (is_win || is_mac || is_chromeos) {
1757       sources += [ "../common/extensions/api/networking_private/networking_private_crypto_unittest.cc" ]
1758     }
1759     if (enable_rlz_support) {
1760       sources += [ "../browser/rlz/chrome_rlz_tracker_delegate_unittest.cc" ]
1761       deps += [
1762         "//chrome/browser:rlz",
1763         "//components/rlz",
1764         "//rlz:test_support",
1765       ]
1766     }
1767     if (is_win) {
1768       # The PDB gets too large for incremental linking.
1769       configs -= [ "//build/config/win:default_incremental_linking" ]
1770       configs += [ "//build/config/win:no_incremental_linking" ]
1772       sources += rebase_path(
1773               chrome_tests_unit_gypi_values.chrome_unit_tests_win_sources,
1774               ".",
1775               "//chrome")
1776       deps += [
1777         #'browser/safe_browsing/incident_reporting/verifier_test/verifier_unittest.gyp:verifier_test_dll_1',  TODO(GYP) bug 512919
1778         #'browser/safe_browsing/incident_reporting/verifier_test/verifier_unittest.gyp:verifier_test_dll_2',  TODO(GYP) bug 512919
1779         "//chrome:other_version",
1780         "//chrome_elf:blacklist_test_dll_1",
1781         "//chrome/installer/util:strings",
1782         "//third_party/iaccessible2",
1783         "//third_party/isimpledom",
1784         "//third_party/wtl",
1785         "//ui/resources",
1786       ]
1788       libs = [
1789         "comsupp.lib",
1790         "oleacc.lib",
1791         "rpcrt4.lib",
1792         "urlmon.lib",
1793         "winmm.lib",
1794       ]
1795       if (!is_chrome_branded) {
1796         sources -= [ "../browser/google/google_update_win_unittest.cc" ]
1797       }
1798     }
1799     if (is_android || is_ios) {
1800       sources -= [
1801         "../browser/devtools/device/webrtc/devtools_bridge_instances_request_unittest.cc",
1802         "../browser/ui/sync/sync_promo_ui_unittest.cc",
1803       ]
1804     } else {
1805       sources -= [ "../browser/web_resource/promo_resource_service_mobile_ntp_unittest.cc" ]
1806       deps += [ "//chrome/tools/profile_reset:jtl_compiler_lib" ]
1807     }
1808     if (!is_android && !is_chromeos) {
1809       sources += rebase_path(
1810               chrome_tests_unit_gypi_values.chrome_unit_tests_non_android_or_chromeos_sources,
1811               ".",
1812               "//chrome")
1813     }
1814     if (enable_themes) {
1815       sources += rebase_path(
1816               chrome_tests_unit_gypi_values.chrome_unit_tests_themes_sources,
1817               ".",
1818               "//chrome")
1819     }
1820     if (!is_android && (use_nss_certs || use_openssl_certs)) {
1821       sources += [ "../common/net/x509_certificate_model_unittest.cc" ]
1822     }
1823     if (enable_supervised_users) {
1824       sources += rebase_path(
1825               chrome_tests_unit_gypi_values.chrome_unit_tests_supervised_user_sources,
1826               ".",
1827               "//chrome")
1828     }
1829     if (enable_supervised_users && !is_android && !is_ios) {
1830       sources += rebase_path(
1831               chrome_tests_unit_gypi_values.chrome_unit_tests_supervised_user_legacy_sources,
1832               ".",
1833               "//chrome")
1834     }
1835     if (safe_browsing_mode == 1 && enable_extensions) {
1836       sources += [ "../browser/extensions/blacklist_unittest.cc" ]
1837     }
1838     if (cld_version == 1) {
1839       sources += [ "//third_party/cld/encodings/compact_lang_det/compact_lang_det_unittest_small.cc" ]
1840       defines += [ "CLD_WINDOWS" ]
1841       deps += [ "//third_party/cld" ]
1842     }
1843     if (enable_app_list) {
1844       sources += rebase_path(
1845               chrome_tests_unit_gypi_values.chrome_unit_tests_app_list_sources,
1846               ".",
1847               "//chrome")
1848       deps += [ "//ui/app_list:test_support" ]
1849     }
1850     if (enable_app_list && is_chromeos) {
1851       sources += rebase_path(
1852               chrome_tests_unit_gypi_values.chrome_unit_tests_app_list_chromeos_sources,
1853               ".",
1854               "//chrome")
1855     }
1856     if (enable_plugins && !enable_plugin_installation) {
1857       sources -= [ "../browser/plugins/plugin_installer_unittest.cc" ]
1858     }
1859   }
1861   if (is_win || (is_linux && !is_chromeos)) {
1862     # TODO(GYP): Figure out which of these work and are needed on other
1863     # platforms.
1864     test("chrome_app_unittests") {
1865       sources = [
1866         "../app/chrome_watcher_client_unittest_win.cc",
1867         "../app/chrome_watcher_client_win.cc",
1868         "../app/chrome_watcher_command_line_unittest_win.cc",
1869         "../app/chrome_watcher_command_line_win.cc",
1870         "../app/delay_load_hook_unittest_win.cc",
1871         "../app/delay_load_hook_win.cc",
1872         "../app/delay_load_hook_win.h",
1873         "../app/signature_validator_win.cc",
1874         "../app/signature_validator_win.h",
1875         "../app/signature_validator_win_unittest.cc",
1876         "../common/crash_keys.cc",
1877         "../common/crash_keys.h",
1878       ]
1880       deps = [
1881         ":test_support",
1882         "//breakpad:client",
1883         "//chrome/browser",
1884         "//chrome/child",
1885         "//components/crash_keys",
1886         "//base/test:run_all_unittests",
1887         "//base/test:test_support",
1888       ]
1889       if (cld_version == 2) {
1890         # Use whatever CLD2 data access mode that the
1891         # application embedder is using.
1892         deps += [ "//third_party/cld_2:cld2_platform_impl" ]
1893       }
1894     }
1896     test("performance_browser_tests") {
1897       sources = rebase_path(
1898               chrome_tests_gypi_values.performance_browser_tests_sources,
1899               ".",
1900               "//chrome")
1902       defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
1904       deps = [
1905         ":test_support",
1906         "//base",
1907         "//base:i18n",
1908         "//base/test:test_support",
1909         "//chrome/browser",
1910         "//chrome/renderer",
1911         "//components/about_handler",
1912         "//components/autofill/content/browser/wallet:test_support",
1913         "//components/autofill/content/renderer:test_support",
1914         "//media/cast:test_support",
1915         "//testing/gmock",
1916         "//testing/gtest",
1917         "//testing/perf",
1918       ]
1920       if (is_win) {
1921         configs -= [ "//build/config/win:default_incremental_linking" ]
1922         configs +=
1923             [ "//build/config/win:default_large_module_incremental_linking" ]
1924       } else {
1925         sources -= [
1926           "../app/chrome_command_ids.h",
1928           #"../app/chrome_dll.rc",
1929           #"../app/chrome_dll_resource.h",
1930           "../app/chrome_version.rc.version",
1931         ]
1932       }
1933       if (!is_mac) {
1934         sources -= [ "perf/mach_ports_performancetest.cc" ]
1935       }
1937       if (cld_version == 2) {
1938         # Use whatever CLD2 data access mode that the
1939         # application embedder is using.
1940         deps += [ "//third_party/cld_2:cld2_platform_impl" ]
1941       }
1942     }
1943   }
1946 source_set("test_support_unit") {
1947   testonly = true
1948   sources = [
1949     "../browser/sync/glue/session_sync_test_helper.cc",
1950     "../browser/sync/glue/session_sync_test_helper.h",
1951     "base/run_all_unittests.cc",
1952   ]
1954   deps = [
1955     ":test_support",
1956     "//base",
1957     "//chrome:resources",
1958     "//chrome:strings",
1959     "//chrome/browser",
1960     "//chrome/common",
1961     "//mojo/environment:chromium",
1962     "//third_party/mojo/src/mojo/edk/system",
1963   ]
1965   if (!is_android && use_ash) {
1966     sources += rebase_path(
1967             chrome_tests_unit_gypi_values.chrome_test_support_unit_ash_sources,
1968             ".",
1969             "//chrome")
1970   }