Create an initial chrome://supervised-user-internals page
[chromium-blink-merge.git] / chrome / test / BUILD.gn
blob32fafd1a46d8528b688278a93d93470a50781d46
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     deps = [
581       "//chrome/browser/ui",
582       "//skia",
583     ]
584     defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
585   }
587   # TODO(GYP): Delete this after we've converted everything to GN.
588   # The _run targets exist only for compatibility w/ GYP.
589   group("browser_tests_run") {
590     testonly = true
591     deps = [
592       ":browser_tests",
593     ]
594   }
596   test("browser_tests") {
597     sources = [
598       "base/browser_tests_main.cc",
599     ]
600     sources +=
601         rebase_path(chrome_tests_gypi_values.chrome_browser_tests_sources,
602                     ".",
603                     "//chrome")
604     sources += rebase_path(
605             chrome_tests_gypi_values.chrome_browser_extensions_test_support_sources,
606             ".",
607             "//chrome")
609     configs += [ "//build/config:precompiled_headers" ]
611     data = [
612       "data/",
613       "//chrome/browser/policy/test/asn1der.py",
614       "//chrome/browser/policy/test/policy_testserver.py",
615       "//chrome/common/extensions/docs/examples/apps/calculator/",
616       "//chrome/third_party/mock4js/",
617       "//content/test/data/",
618       "//google_apis/test/",
619       "//media/test/data/",
620       "//net/data/",
621       "//net/tools/testserver/",
622       "//ppapi/tests/test_case.html",
623       "//ppapi/tests/test_case.html.mock-http-headers",
624       "//ppapi/tests/test_page.css",
625       "//ppapi/tests/test_page.css.mock-http-headers",
626       "//testing/test_env.py",
627       "//third_party/accessibility-audit/axs_testing.js",
628       "//third_party/mocha/mocha.js",
629       "//third_party/pyftpdlib/",
630       "//third_party/pywebsocket/",
631       "//third_party/safe_browsing/",
632       "//third_party/simplejson/",
633       "//third_party/tlslite/",
634       "//ui/webui/resources/js/",
635       "$root_out_dir/pyproto/",
636       "$root_out_dir/browser_tests.pak",
637       "$root_out_dir/chrome_100_percent.pak",
638       "$root_out_dir/locales/",
639       "$root_out_dir/remoting/unittests/",
640       "$root_out_dir/resources.pak",
641       "$root_out_dir/resources/extension/",
642       "$root_out_dir/test_case.html",
643       "$root_out_dir/test_case.html.mock-http-headers",
644       "$root_out_dir/test_data/",
645       "$root_out_dir/test_page.css",
646       "$root_out_dir/test_page.css.mock-http-headers",
647       "$root_out_dir/test_url_loader_data/",
648     ]
650     deps = [
651       ":browser_tests_js_webui",
652       ":sync_integration_test_support",
653       ":test_support",
654       "//base",
655       "//base:i18n",
656       "//base/allocator",
657       "//base/test:test_support",
658       "//chrome:browser_tests_pak",
659       "//chrome:packed_extra_resources",
660       "//chrome:packed_resources",
661       "//chrome:resources",
662       "//chrome:strings",
663       "//chrome/browser",
664       "//chrome/browser/resources:extension_resource_demo",
665       "//chrome/common/extensions/api",
666       "//chrome/renderer",
667       "//components/autofill/content/browser:risk_proto",
668       "//components/autofill/content/browser/wallet:test_support",
669       "//components/autofill/content/renderer:test_support",
670       "//components/captive_portal:test_support",
671       "//components/dom_distiller/content:content_browser",
672       "//components/dom_distiller/core:test_support",
673       "//components/guest_view/browser:test_support",
674       "//components/resources",
675       "//components/strings",
676       "//components/translate/core/common",
677       "//components/user_manager:test_support",
678       "//crypto:platform",
679       "//crypto:test_support",
680       "//device/bluetooth:mocks",
681       "//device/serial:test_support",
682       "//extensions/common/api",
683       "//google_apis:test_support",
684       "//media",
685       "//media/base:test_support",
686       "//media/cast:test_support",
687       "//net",
688       "//net:test_support",
689       "//sdch",
690       "//skia",
691       "//sync",
692       "//sync:test_support_sync_api",
693       "//testing/gmock",
694       "//testing/gtest",
695       "//testing/perf",
696       "//third_party/cacheinvalidation",
697       "//third_party/icu",
698       "//third_party/leveldatabase",
699       "//third_party/libaddressinput",
700       "//third_party/libjingle",
701       "//third_party/safe_browsing:test_support",
702       "//third_party/webrtc/modules/desktop_capture",
703       "//third_party/widevine/cdm:version_h",
704       "//ui/accessibility:test_support",
705       "//ui/base:test_support",
706       "//ui/compositor:test_support",
707       "//ui/resources",
708       "//ui/web_dialogs:test_support",
709       "//v8",
710     ]
712     # TODO(rockot) bug 505926: The chrome_extensions_browsertests target should
713     # be deleted and this line removed. See the chrome_extensions_browsertests
714     # target for more.
715     deps += [ "//extensions:chrome_extensions_browsertests" ]
717     # Runtime dependencies
718     data_deps = [
719       "//ppapi:ppapi_tests",
720       "//ppapi:power_saver_test_plugin",
721       "//remoting/webapp:browser_test_resources",
722       "//remoting/webapp:unit_tests",
723       "//third_party/mesa:osmesa",
724       "//third_party/widevine/cdm:widevine_test_license_server",
725     ]
727     defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
729     if (!enable_nacl_browsertests) {
730       defines += [ "DISABLE_NACL_BROWSERTESTS" ]
731     }
733     # TODO(GYP) if (is_win) {
734     #       ['incremental_chrome_dll==1', {
735     #         'UseLibraryDependencyInputs': "true",
736     # }
738     if (cld_version == 2) {
739       # Because the browser_tests use translate, they need CLD data.
740       deps += [ "//third_party/cld_2:cld2_platform_impl" ]
741     }
743     if (!enable_one_click_signin) {
744       sources -= [ "../browser/ui/sync/one_click_signin_bubble_links_delegate_browsertest.cc" ]
745     }
746     if (!enable_nacl_browsertests) {
747       sources -= [ "../browser/extensions/api/hotword_private/hotword_private_apitest.cc" ]
748     } else if (enable_nacl) {
749       sources += [
750         "../browser/extensions/extension_nacl_browsertest.cc",
751         "../browser/nacl_host/test/gdb_debug_stub_browsertest.cc",
752       ]
753       deps += [ "//components/nacl/renderer/plugin:nacl_trusted_plugin" ]
755       if (enable_nacl_untrusted) {
756         sources += [
757           "nacl/nacl_browsertest.cc",
758           "nacl/nacl_browsertest_uma.cc",
759           "nacl/nacl_browsertest_util.cc",
760           "nacl/nacl_browsertest_util.h",
761           "nacl/pnacl_header_test.cc",
762           "nacl/pnacl_header_test.h",
763         ]
765         # TODO(GYP): Make NaCl work in other configs and update the irt
766         # dependency as appropriate. We should probably push this
767         # dependency into ppapi/native_client so that clients don't need
768         # to know all of the different toolchain options.
769         assert(current_cpu == "x64")
770         data_deps += [
771           # "test/data/nacl:shared_test_files",  # TODO(GYP) bug 512902
772           "//ppapi/native_client:nacl_irt(//native_client/build/toolchain/nacl:irt_x64)",
773           # "../ppapi/ppapi_nacl.gyp:ppapi_nacl_tests",  # TODO(GYP) bug 512901
774           # "../ppapi/tests/extensions/extensions.gyp:ppapi_tests_extensions_background_keepalive",  # TODO(GYP) bug 512900
775           # "../ppapi/tests/extensions/extensions.gyp:ppapi_tests_extensions_media_galleries",  # TODO(GYP) bug 512900
776           # "../ppapi/tests/extensions/extensions.gyp:ppapi_tests_extensions_packaged_app",  # TODO(GYP) bug 512900
777         ]
778         if (is_chromeos) {
779           sources += [ "//third_party/liblouis/nacl_wrapper/liblouis_wrapper_browsertest.cc" ]
780           deps += [
781             "//chrome/browser/chromeos",
782             #'../third_party/liblouis/liblouis_nacl.gyp:liblouis_test_data',  TODO(GYP) bug 512906
783           ]
784         }
785       }
786       if (is_win || is_linux) {
787         sources += [ "../browser/nacl_host/test/nacl_gdb_browsertest.cc" ]
788         deps += [ "//chrome/browser/nacl_host/test:mock_nacl_gdb" ]
789       }
790       if (is_win) {
791         # TODO(halyavin) NaCl on Windows can't open debug stub socket in
792         # browser process as needed by this test. See http://crbug.com/157312.
793         sources -= [ "../browser/nacl_host/test/gdb_debug_stub_browsertest.cc" ]
794         deps += [
795           #'chrome.gyp:chrome_nacl_win64',  TODO(GYP) bug 512869
796         ]
797         configs -= [ "//build/config/win:default_incremental_linking" ]
798         configs +=
799             [ "//build/config/win:default_large_module_incremental_linking" ]
800       }
801       if (is_linux) {
802         deps += [
803           "//native_client/src/trusted/service_runtime/linux:munge_nacl_helper_bootstrap",
804           "//components/nacl:nacl_helper",
806           # "//components/nacl_nonsfi.gyp:nacl_helper_nonsfi",  # TODO(GYP) bug 512912.
807         ]
808       }
809     }
810     if (debug_devtools) {
811       defines += [ "DEBUG_DEVTOOLS=1" ]
812     }
813     if (use_ash) {
814       deps += [ "//ash:test_support" ]
815     }
816     if (use_aura || toolkit_views) {
817       deps += [ "//ui/events:test_support" ]
818     }
819     if (toolkit_views) {
820       sources += rebase_path(
821               chrome_tests_gypi_values.chrome_browser_tests_views_sources,
822               ".",
823               "//chrome")
824       deps += [ "//ui/views" ]
825       if (!is_mac) {
826         sources += rebase_path(
827                 chrome_tests_gypi_values.chrome_browser_tests_views_non_mac_sources,
828                 ".",
829                 "//chrome")
830       }
831     }
832     if (is_chromeos) {
833       sources += rebase_path(
834               chrome_tests_gypi_values.chrome_browser_tests_chromeos_sources,
835               ".",
836               "//chrome")
837       sources -= [
838         "../../apps/load_and_launch_browsertest.cc",
839         "../browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc",
840         "../browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc",
842         # chromeos does not support profile list avatar menu
843         "../browser/profiles/profile_list_desktop_browsertest.cc",
844         "../browser/service_process/service_process_control_browsertest.cc",
846         # chromeos does not use cross-platform panels
847         "../browser/ui/panels/panel_extension_browsertest.cc",
849         # chromeos does not use the desktop user manager
850         "../browser/ui/webui/signin/user_manager_ui_browsertest.cc",
851       ]
852       deps += [
853         "//dbus",
854         "//dbus:test_support",
855         "//ui/login:resources",
856       ]
857     } else {
858       sources -= [
859         "../browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc",
860         "../browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc",
861         "../browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc",
862         "../browser/extensions/api/terminal/terminal_private_apitest.cc",
863         "../browser/invalidation/profile_invalidation_provider_factory_browsertest.cc",
864         "../browser/net/nss_context_chromeos_browsertest.cc",
865         "../browser/ui/ash/keyboard_controller_browsertest.cc",
866         "data/webui/certificate_viewer_ui_test-inl.h",
867       ]
868       if (toolkit_views) {
869         sources -= [ "../browser/ui/views/select_file_dialog_extension_browsertest.cc" ]
870       }
871     }
872     if (enable_configuration_policy) {
873       sources += rebase_path(
874               chrome_tests_gypi_values.chrome_browser_tests_policy_sources,
875               ".",
876               "//chrome")
877     }
878     if (enable_web_speech) {
879       sources += rebase_path(
880               chrome_tests_gypi_values.chrome_browser_tests_speech_sources,
881               ".",
882               "//chrome")
883     }
884     if (safe_browsing_mode == 1) {
885       sources += rebase_path(
886               chrome_tests_gypi_values.chrome_browser_tests_full_safe_browsing_sources,
887               ".",
888               "//chrome")
889     }
890     if (enable_captive_portal_detection) {
891       sources += [ "../browser/captive_portal/captive_portal_browsertest.cc" ]
892     }
893     if (!enable_webrtc) {
894       sources -= [
895         "../browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc",
896         "../browser/extensions/api/webrtc_logging_private/webrtc_logging_private_apitest.cc",
897         "../browser/media/chrome_webrtc_browsertest.cc",
898         "../browser/media/chrome_webrtc_disable_encryption_flag_browsertest.cc",
899         "../browser/media/chrome_webrtc_getmediadevices_browsertest.cc",
900       ]
901     }
902     if (enable_media_router) {
903       sources += rebase_path(
904               chrome_tests_gypi_values.chrome_browser_tests_media_router_sources,
905               ".",
906               "//chrome")
907       deps += [ "//chrome/browser/media/router:test_support" ]
908     }
909     if (is_win) {
910       deps += [
911         "//chrome:other_version",
912         "//third_party/wtl",
913         "//ui/resources",
914       ]
915     } else {
916       sources -= [
917         "../app/chrome_command_ids.h",
918         "../app/chrome_dll_resource.h",
919         "../app/chrome_version.rc.version",
920         "../browser/media_galleries/fileapi/iapps_finder_impl_win_browsertest.cc",
921       ]
922     }
923     if (!is_chromeos && use_aura) {
924       sources -= [
925         # On Windows and Linux, we currently don't support enough of the
926         # ash environment to run these unit tests.
927         #
928         # TODO: enable these on windows and linux.
929         "../browser/ui/ash/accelerator_commands_browsertest.cc",
930         "../browser/ui/ash/accelerator_controller_browsertest.cc",
931         "../browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc",
932         "../browser/ui/ash/launcher/launcher_favicon_loader_browsertest.cc",
933         "../browser/ui/ash/shelf_browsertest.cc",
934         "../browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc",
935       ]
936     }
937     if (is_mac) {
938       # TODO(mark): We really want this for all non-static library
939       # targets, but when we tried to pull it up to the common.gypi
940       # level, it broke other things like the ui and startup tests. *shrug*
941       ldflags = [ "-Wl,-ObjC" ]
943       # Other platforms only need
944       # chrome_resources.gyp:{packed_extra_resources,packed_resources},
945       # and can build this target standalone much faster.
946       deps += [
947         #'app_mode_app_support',  TODO(GYP)
948         "//chrome",
950         #'../components/components.gyp:breakpad_stubs',  TODO(GYP)
951         "//third_party/ocmock",
952       ]
953       sources += [
954         "../browser/media_galleries/fileapi/iphoto_data_provider_browsertest.cc",
955         "../browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm",
956         "../browser/spellchecker/spellcheck_message_filter_platform_mac_browsertest.cc",
957       ]
958       sources -= [
959         # TODO(groby): This test depends on hunspell and we cannot run it on
960         # Mac, which does not use hunspell by default.
961         "../browser/spellchecker/spellcheck_service_browsertest.cc",
963         # TODO(rouslan): This test depends on the custom dictionary UI,
964         # which is disabled on Mac.
965         # TODO(GYP): This should be added somewhere first ...
966         # "../browser/ui/webui/options/edit_dictionary_browsertest.js",
968         # TODO(rouslan): This test depends on hunspell and we cannot run it
969         # on Mac, which does use hunspell by default.
970         # TODO(GYP): This should be added somewhere first ...
971         # "../browser/ui/webui/options/language_options_dictionary_download_browsertest.js",
973         # ProcessSingletonMac doesn"t do anything.
974         "../browser/process_singleton_browsertest.cc",
976         # This test depends on GetCommandLineForRelaunch, which is not
977         # available on Mac.
978         "../browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc",
980         # single-process mode hangs on Mac sometimes because of multiple UI
981         # message loops. See 306348
982         "../renderer/safe_browsing/phishing_classifier_browsertest.cc",
983         "../renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc",
984         "../renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc",
985       ]
986     }
987     if (is_mac || is_win) {
988       sources += [
989         "../browser/extensions/api/networking_private/networking_private_apitest.cc",
990         "../browser/extensions/api/networking_private/networking_private_service_client_apitest.cc",
991         "../browser/media_galleries/fileapi/itunes_data_provider_browsertest.cc",
992         "../browser/media_galleries/fileapi/picasa_data_provider_browsertest.cc",
993       ]
994       deps += [ "//components/wifi:test_support" ]
995     }
996     if (!is_posix || is_chromeos) {
997       sources -= [ "../common/time_format_browsertest.cc" ]
998     }
999     if (is_android) {
1000       sources -= [
1001         "../browser/policy/cloud/component_cloud_policy_browsertest.cc",
1002         "../browser/prefs/pref_hash_browsertest.cc",
1003         "../renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc",
1004         "../renderer/spellchecker/spellcheck_unittest.cc",
1005       ]
1006     }
1007     if (is_chromeos) {
1008       sources += [
1009         "../browser/extensions/api/networking_private/networking_private_apitest.cc",
1010         "../browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc",
1011       ]
1012     }
1013     if (!is_android && !is_ios && enable_nacl_browsertests) {
1014       sources +=
1015           [ "../browser/copresence/chrome_whispernet_client_browsertest.cc" ]
1016       deps += [ "//components/copresence" ]
1017     }
1018     if (enable_app_list) {
1019       sources += rebase_path(
1020               chrome_tests_gypi_values.chrome_browser_tests_app_list_sources,
1021               ".",
1022               "//chrome")
1023     }
1024     if (enable_supervised_users) {
1025       sources += rebase_path(
1026               chrome_tests_gypi_values.chrome_browser_tests_supervised_user_sources,
1027               ".",
1028               "//chrome")
1029     }
1030     if (enable_pepper_cdms) {
1031       # Runtime dependencies.
1032       data_deps += [
1033         "//media/cdm/ppapi:clearkeycdmadapter",
1034         "//third_party/widevine/cdm:widevinecdmadapter",
1035       ]
1036     }
1037     if (!enable_print_preview) {
1038       sources -= [
1039         "../browser/extensions/api/cloud_print_private/cloud_print_private_apitest.cc",
1040         "../browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc",
1041         "../browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc",
1042         "../browser/printing/print_preview_dialog_controller_browsertest.cc",
1043         "../browser/printing/print_preview_pdf_generated_browsertest.cc",
1044         "../browser/service_process/service_process_control_browsertest.cc",
1045         "../browser/ui/webui/print_preview/print_preview_ui_browsertest.cc",
1046         "data/webui/print_preview.cc",
1047         "data/webui/print_preview.h",
1048       ]
1049     }
1050     if (enable_mdns) {
1051       sources += [ "../browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc" ]
1052     }
1053     if (use_brlapi) {
1054       deps += [ "//build/config/linux:libbrlapi" ]
1055     } else {
1056       sources -= [ "../browser/extensions/api/braille_display_private/braille_display_private_apitest.cc" ]
1057     }
1058     if (is_chrome_branded) {
1059       sources -= [
1060         # These tests depend on single process mode, which is disabled in
1061         # official builds.
1062         "../renderer/safe_browsing/phishing_classifier_browsertest.cc",
1063         "../renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc",
1064         "../renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc",
1065       ]
1066     }
1067     if (!enable_autofill_dialog || is_android || is_ios) {
1068       deps -= [ "//third_party/libaddressinput" ]
1069     }
1070     if (enable_remoting) {
1071       sources += rebase_path(
1072               chrome_tests_gypi_values.chrome_browser_tests_remoting_sources,
1073               ".",
1074               "//chrome")
1075       #deps += [ "//remoting:remoting_webapp" ]  TODO(GYP)
1076     }
1077     if (use_x11) {
1078       deps += [ "//tools/xdisplaycheck" ]
1079     }
1080   }
1082   # TODO(GYP): Delete this after we've converted everything to GN.
1083   # The _run targets exist only for compatibility w/ GYP.
1084   group("sync_integration_tests_run") {
1085     testonly = true
1086     deps = [
1087       ":sync_integration_tests",
1088     ]
1089   }
1091   test("sync_integration_tests") {
1092     sources =
1093         rebase_path(chrome_tests_gypi_values.sync_integration_tests_sources,
1094                     ".",
1095                     "//chrome")
1097     data = [
1098       "//chrome/test/data/sync/",
1099       "//net/tools/testserver/",
1100       "//sync/tools/testserver/",
1101       "//third_party/pyftpdlib/",
1102       "//third_party/pywebsocket/",
1103       "//third_party/tlslite/",
1104       "$root_out_dir/pyproto/",
1105       "$root_out_dir/resources.pak",
1106     ]
1108     if (is_linux || is_win) {
1109       data += [
1110         "$root_out_dir/chrome_100_percent.pak",
1111         "$root_out_dir/locales/en-US.pak",
1112       ]
1113     }
1115     # TODO(phajdan.jr): Only temporary, to make transition easier.
1116     defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
1118     deps = [
1119       ":sync_integration_test_support",
1120       ":test_support",
1121       "//base/allocator",
1122       "//chrome:packed_extra_resources",
1123       "//chrome:packed_resources",
1124       "//chrome:resources",
1125       "//chrome:strings",
1126       "//chrome/common",
1127       "//chrome/renderer",
1128       "//crypto:platform",
1129       "//sync",
1130       "//testing/gmock",
1131       "//testing/gtest",
1132       "//third_party/icu",
1133       "//third_party/leveldatabase",
1134       "//third_party/WebKit/public:blink",
1135     ]
1137     data_deps = [ "//third_party/mesa:osmesa" ]
1139     if (cld_version == 2) {
1140       # Language detection is irrelevant to sync, so it can depend on any
1141       # implementation for CLD2. Dynamic is smaller, so go with dynamic.
1142       deps += [ "//third_party/cld_2:cld2_dynamic" ]
1143     }
1144     if (is_mac) {
1145       # Dictionary sync is disabled on Mac.
1146       sources -= [
1147         "../browser/sync/test/integration/multiple_client_dictionary_sync_test.cc",
1148         "../browser/sync/test/integration/single_client_dictionary_sync_test.cc",
1149         "../browser/sync/test/integration/two_client_dictionary_sync_test.cc",
1150       ]
1152       # The sync_integration_tests do not run on mac without this flag.
1153       # Search for comments about "xcode_settings" elsewhere in this file.
1154       ldflags = [ "-Wl,-ObjC" ]
1155     }
1156     if (is_win) {
1157       deps += [
1158         "//chrome:other_version",
1159         "//third_party/wtl",
1160         "//ui/resources",
1161       ]
1163       configs -= [ "//build/config/win:default_incremental_linking" ]
1164       configs +=
1165           [ "//build/config/win:default_large_module_incremental_linking" ]
1166     } else {
1167       sources -= [ "../app/chrome_version.rc.version" ]
1168     }
1169     if (!is_chromeos) {
1170       sources -= [
1171         "../browser/sync/test/integration/single_client_wifi_credentials_sync_test.cc",
1172         "../browser/sync/test/integration/two_client_wifi_credentials_sync_test.cc",
1173       ]
1174     }
1176     if (toolkit_views) {
1177       deps += [ "//ui/views" ]
1178     }
1179     if (enable_basic_printing || enable_print_preview) {
1180       deps += [ "//printing" ]
1181     }
1182     if (!enable_app_list) {
1183       sources -= [
1184         "../browser/sync/test/integration/single_client_app_list_sync_test.cc",
1185         "../browser/sync/test/integration/two_client_app_list_sync_test.cc",
1186       ]
1187     }
1188     if (!enable_supervised_users) {
1189       sources -= [ "../browser/sync/test/integration/single_client_supervised_user_settings_sync_test.cc" ]
1190     }
1191   }
1193   test("sync_performance_tests") {
1194     sources =
1195         rebase_path(chrome_tests_gypi_values.sync_performance_tests_sources,
1196                     ".",
1197                     "//chrome")
1199     defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
1201     deps = [
1202       ":sync_integration_test_support",
1203       "//base/allocator",
1204       "//crypto:platform",
1205       "//sync",
1206       "//testing/gmock",
1207       "//testing/gtest",
1208     ]
1210     if (cld_version == 2) {
1211       # Language detection is irrelevant to sync, so it can depend on any
1212       # implementation for CLD2. Dynamic is smaller, so go with dynamic.
1213       deps += [ "//third_party/cld_2:cld2_dynamic" ]
1214     }
1216     if (is_mac) {
1217       # Dictionary sync is disabled on Mac.
1218       sources -= [ "../browser/sync/test/integration/performance/dictionary_sync_perf_test.cc" ]
1220       # The sync_performance_tests do not run on mac without this flag.
1221       # Search for comments about "xcode_settings" elsewhere in this file.
1222       ldflags = [ "-Wl,-ObjC" ]
1223     }
1224     if (is_win) {
1225       deps += [
1226         "//chrome:other_version",
1227         "//chrome/installer/util:strings",
1228         "//third_party/wtl",
1229         "//ui/resources",
1230       ]
1231       configs -= [ "//build/config/win:default_incremental_linking" ]
1232       configs +=
1233           [ "//build/config/win:default_large_module_incremental_linking" ]
1234     } else {
1235       sources -= [ "../app/chrome_version.rc.version" ]
1236     }
1238     if (toolkit_views) {
1239       deps += [ "//ui/views" ]
1240     }
1241   }
1243   # Executable to measure time to load libraries.
1244   test("load_library_perf_tests") {
1245     sources = [
1246       "../browser/load_library_perf_test.cc",
1247     ]
1249     deps = [
1250       "//base/test:test_support_perf",
1251       "//testing/gtest",
1252       "//testing/perf",
1253       "//third_party/widevine/cdm:version_h",
1254     ]
1256     if (enable_pepper_cdms) {
1257       data_deps = [
1258         "//media/cdm/ppapi:clearkeycdmadapter",
1259         "//third_party/widevine/cdm:widevinecdmadapter",
1260       ]
1261     }
1262   }
1264   js2gtest("unit_tests_js") {
1265     test_type = "unit"
1266     sources = rebase_path(
1267             chrome_tests_unit_gypi_values.chrome_unit_tests_gtestjs_sources,
1268             ".",
1269             "//chrome")
1270     extra_js_files =
1271         rebase_path(chrome_tests_unit_gypi_values.chrome_unit_tests_js_sources,
1272                     ".",
1273                     "//chrome")
1274     if (is_chromeos) {
1275       sources += rebase_path(
1276               chrome_tests_unit_gypi_values.chrome_unit_tests_chromeos_gtestjs_sources,
1277               ".",
1278               "//chrome")
1279       extra_js_files += rebase_path(
1280               chrome_tests_unit_gypi_values.chrome_unit_tests_chromeos_js_sources,
1281               ".",
1282               "//chrome")
1283     }
1284   }
1286   # TODO(GYP): Delete this after we've converted everything to GN.
1287   # The _run targets exist only for compatibility w/ GYP.
1288   group("unit_tests_run") {
1289     testonly = true
1290     deps = [
1291       ":unit_tests",
1292     ]
1293   }
1295   test("unit_tests") {
1296     sources =
1297         rebase_path(chrome_tests_unit_gypi_values.chrome_unit_tests_sources,
1298                     ".",
1299                     "//chrome")
1301     configs += [ "//build/config:precompiled_headers" ]
1303     data = [
1304       "data/",
1305       "//base/test/data/",
1306       "//chrome/third_party/mock4js/",
1307       "//components/test/data/",
1308       "//extensions/test/data/",
1309       "//google_apis/test/data/",
1310       "//net/data/",
1311       "//net/tools/testserver/",
1312       "//third_party/accessibility-audit/axs_testing.js",
1313       "//third_party/hunspell_dictionaries/",
1314       "//third_party/pyftpdlib/",
1315       "//third_party/pywebsocket/",
1316       "//third_party/tlslite/",
1317       "//third_party/zlib/google/test/data/",
1318       "//tools/metrics/histograms/histograms.xml",
1319       "$root_out_dir/pyproto/google/",
1320       "$root_out_dir/test_data/chrome/browser/resources/google_now/",
1321       "$root_out_dir/test_data/chrome/browser/resources/print_preview/",
1322       "$root_out_dir/test_data/chrome/renderer/resources/extensions/",
1323       "$root_out_dir/test_data/ui/webui/",
1324       "$root_out_dir/resources.pak",
1325     ]
1326     if (is_android || is_linux || is_win) {
1327       data += [
1328         "$root_out_dir/chrome_100_percent.pak",
1329         "$root_out_dir/locales/en-US.pak",
1330       ]
1331     }
1333     defines = []
1335     deps = [
1336       # NOTE: New depndencies should generally be added in the OS!="ios"
1337       # dependencies block below, rather than here.
1338       # Unit tests should only depend on:
1339       # 1) everything that the chrome binaries depend on:
1340       "//chrome:browser_dependencies",
1341       "//chrome:child_dependencies",
1343       # 2) test-specific support libraries:
1344       ":test_support_unit",
1345       "//base/test:test_support",
1346       "//chrome/test:test_support",
1347       "//components/resources",
1348       "//components/content_settings/core/test:test_support",
1349       "//content/test:test_support",
1350       "//content/public/app:both",
1351       "//crypto:platform",
1352       "//crypto:test_support",
1353       "//net",
1354       "//net:test_support",
1355       "//sync:test_support_sync_api",
1356       "//sync:test_support_sync_core",
1357       "//sync:test_support_sync_internal_api",
1358       "//testing/gmock",
1359       "//testing/gtest",
1361       # 3) anything tests directly depend on
1362       "//base/allocator",
1363       "//chrome:resources",
1364       "//chrome:strings",
1365       "//courgette:courgette_lib",
1366       "//google_apis",
1367       "//skia",
1368       "//third_party/cacheinvalidation",
1369       "//third_party/icu",
1370       "//third_party/libxml",
1371       "//ui/base:test_support",
1372       "//ui/gfx:test_support",
1373       "//ui/resources",
1374     ]
1375     data_deps = []
1377     # TODO(GYP) Windows stuff
1378     # ['incremental_chrome_dll==1', {
1379     #   'UseLibraryDependencyInputs': "true",
1381     if (!is_ios) {
1382       deps += [
1383         ":unit_tests_js",
1384         "//components/audio_modem:test_support",
1385         "//components/autofill/content/browser/wallet:test_support",
1386         "//components/autofill/content/renderer:test_support",
1387         "//components/metrics/proto",
1388         "//components/data_reduction_proxy/core/browser:test_support",
1389         "//components/safe_json:test_support",
1390         "//components/webdata_services:test_support",
1391         "//components/strings",
1392         "//device/bluetooth:mocks",
1393         "//content/app/resources",
1394         "//gpu:test_support",
1395         "//media:test_support",
1397         #'../ppapi/ppapi_internal.gyp:ppapi_unittest_shared',  TODO(GYP)
1398         "//third_party/leveldatabase",
1399         "//third_party/libaddressinput",
1400         "//third_party/libjingle",
1401         "//third_party/libphonenumber",
1402         "//third_party/webrtc/modules/desktop_capture",
1403         "//tools/json_schema_compiler/test",
1404         "//ui/gl",
1405         "//v8",
1406       ]
1407     }
1409     if (is_android) {
1410       deps -= [ "//third_party/libaddressinput" ]
1412       # Some android targets still depend on --gc-sections to link.
1413       # TODO: remove --gc-sections for Debug builds (crbug.com/159847).
1414       ldflags = [ "-Wl,--gc-sections" ]
1415       deps += [ "//testing/android/native_test:native_test_native_code" ]
1416       isolate_file = "../unit_tests.isolate"
1417     } else {
1418       sources += rebase_path(
1419               chrome_tests_unit_gypi_values.chrome_unit_tests_non_android_sources,
1420               ".",
1421               "//chrome")
1422     }
1423     if (is_ios || is_chromeos) {
1424       sources -=
1425           [ "../browser/metrics/signin_status_metrics_provider_unittest.cc" ]
1426     }
1427     if (enable_background) {
1428       sources += rebase_path(
1429               chrome_tests_unit_gypi_values.chrome_unit_tests_background_sources,
1430               ".",
1431               "//chrome")
1432     }
1433     if (enable_spellcheck) {
1434       sources += rebase_path(
1435               chrome_tests_unit_gypi_values.chrome_unit_tests_spellchecker_sources,
1436               ".",
1437               "//chrome")
1438       if (is_mac && !is_ios) {
1439         deps += [ "//third_party/hunspell" ]
1440       }
1441     }
1443     if (enable_one_click_signin) {
1444       sources += [
1445         "../browser/ui/sync/one_click_signin_sync_observer_unittest.cc",
1446         "../browser/ui/sync/one_click_signin_sync_starter_unittest.cc",
1447       ]
1448     }
1450     if (enable_extensions) {
1451       sources += rebase_path(
1452               chrome_tests_unit_gypi_values.chrome_unit_tests_extensions_sources,
1453               ".",
1454               "//chrome")
1455       deps += [
1456         "//chrome/common/extensions/api",
1457         "//device/usb:mocks",
1458         "//extensions:extensions_resources",
1459         "//extensions/strings",
1460       ]
1461       if (enable_configuration_policy) {
1462         sources += rebase_path(
1463                 chrome_tests_unit_gypi_values.chrome_unit_tests_extensions_policy_sources,
1464                 ".",
1465                 "//chrome")
1466       }
1467       if (!is_chromeos) {
1468         sources += rebase_path(
1469                 chrome_tests_unit_gypi_values.chrome_unit_tests_extensions_non_chromeos_sources,
1470                 ".",
1471                 "//chrome")
1472       }
1473     }
1474     if (toolkit_views) {
1475       deps += [
1476         "//components/web_modal:test_support",
1477         "//ui/views",
1478         "//ui/views:test_support",
1479       ]
1480       sources += rebase_path(
1481               chrome_tests_unit_gypi_values.chrome_unit_tests_views_sources,
1482               ".",
1483               "//chrome")
1484       if (!is_mac) {
1485         sources += rebase_path(
1486                 chrome_tests_unit_gypi_values.chrome_unit_tests_views_non_mac_sources,
1487                 ".",
1488                 "//chrome")
1489       }
1490     }
1491     if (use_ash) {
1492       sources += rebase_path(
1493               chrome_tests_unit_gypi_values.chrome_unit_tests_ash_sources,
1494               ".",
1495               "//chrome")
1496       deps += [
1497         "//ash:test_support",
1498         "//ash/resources",
1499         "//ash/strings",
1500       ]
1502       # We eventually want to compile both in Win Aura builds, see
1503       # http://crbug.com/155545.
1504       if (!is_win) {
1505         sources -= [ "../browser/ui/window_sizer/window_sizer_unittest.cc" ]
1506       }
1507     }
1508     if (use_aura) {
1509       sources += [ "//ui/views/controls/webview/webview_unittest.cc" ]
1510       deps += [
1511         "//ui/wm",
1512         "//ui/aura:test_support",
1513         "//ui/views:test_support",
1514       ]
1515     }
1516     if (!is_chromeos && is_linux) {
1517       sources += rebase_path(
1518               chrome_tests_unit_gypi_values.chrome_unit_tests_desktop_linux_sources,
1519               ".",
1520               "//chrome")
1521     }
1522     if (!is_chromeos && !use_ozone && is_linux) {
1523       deps += [
1524         "//chrome/browser/ui/libgtk2ui",
1525         "//build/config/linux:gio",
1526       ]
1527     }
1529     if (enable_task_manager) {
1530       sources += rebase_path(
1531               chrome_tests_unit_gypi_values.chrome_unit_tests_task_manager_sources,
1532               ".",
1533               "//chrome")
1534     }
1535     if (enable_mdns) {
1536       sources += rebase_path(
1537               chrome_tests_unit_gypi_values.chrome_unit_tests_mdns_sources,
1538               ".",
1539               "//chrome")
1540     }
1541     if (enable_service_discovery) {
1542       sources += rebase_path(
1543               chrome_tests_unit_gypi_values.chrome_unit_tests_service_discovery_sources,
1544               ".",
1545               "//chrome")
1546     }
1547     if (enable_configuration_policy) {
1548       sources += rebase_path(
1549               chrome_tests_unit_gypi_values.chrome_unit_tests_configuration_policy_sources,
1550               ".",
1551               "//chrome")
1552       if (is_chromeos) {
1553         sources -=
1554             [ "../browser/policy/cloud/user_policy_signin_service_unittest.cc" ]
1555       } else if (is_android) {
1556         sources -= [ "../browser/policy/policy_path_parser_unittest.cc" ]
1557       }
1558       if (!is_android && !is_ios && !is_chromeos) {
1559         sources +=
1560             [ "../browser/net/disk_cache_dir_policy_handler_unittest.cc" ]
1561       }
1562       if (!is_android && !is_ios) {
1563         sources +=
1564             [ "../browser/download/download_dir_policy_handler_unittest.cc" ]
1565       }
1566     }
1567     if (enable_web_speech) {
1568       sources += rebase_path(
1569               chrome_tests_unit_gypi_values.chrome_unit_tests_speech_sources,
1570               ".",
1571               "//chrome")
1572     }
1573     if (enable_notifications) {
1574       sources += rebase_path(
1575               chrome_tests_unit_gypi_values.chrome_unit_tests_notifications_sources,
1576               ".",
1577               "//chrome")
1578       if (is_android) {
1579         sources -= [
1580           # Android does not use the Message Center notification system.
1581           "../browser/notifications/message_center_notifications_unittest.cc",
1582           "../browser/notifications/message_center_settings_controller_unittest.cc",
1583         ]
1584       }
1585     }
1586     if (safe_browsing_mode == 1) {
1587       # TODO(sgurun): enable tests for safe_browsing==2.
1588       sources += rebase_path(
1589               chrome_tests_unit_gypi_values.chrome_unit_tests_full_safe_browsing_sources,
1590               ".",
1591               "//chrome")
1592       deps += [ ":test_proto" ]
1593       if (is_android) {
1594         deps -= [ ":test_proto" ]
1595         sources -= [
1596           # Android doesn't support download feedbacks.
1597           "../browser/safe_browsing/download_feedback_service_unittest.cc",
1598           "../browser/safe_browsing/download_feedback_unittest.cc",
1599           "../browser/safe_browsing/download_protection_service_unittest.cc",
1600           "../browser/safe_browsing/two_phase_uploader_unittest.cc",
1601           "../common/safe_browsing/ipc_protobuf_message_test_messages.h",
1602           "../common/safe_browsing/ipc_protobuf_message_unittest.cc",
1603         ]
1604       }
1605     }
1606     if (enable_autofill_dialog && !is_android) {
1607       sources += rebase_path(
1608               chrome_tests_unit_gypi_values.chrome_unit_tests_autofill_dialog_sources,
1609               ".",
1610               "//chrome")
1611     }
1612     if (enable_plugins) {
1613       sources += rebase_path(
1614               chrome_tests_unit_gypi_values.chrome_unit_tests_plugins_sources,
1615               ".",
1616               "//chrome")
1617     }
1618     if (enable_print_preview) {
1619       sources += rebase_path(
1620               chrome_tests_unit_gypi_values.chrome_unit_tests_print_preview_sources,
1621               ".",
1622               "//chrome")
1623     }
1624     if (enable_captive_portal_detection) {
1625       sources += rebase_path(
1626               chrome_tests_unit_gypi_values.chrome_unit_tests_captive_portal_sources,
1627               ".",
1628               "//chrome")
1629     }
1630     if (enable_session_service) {
1631       sources += rebase_path(
1632               chrome_tests_unit_gypi_values.chrome_unit_tests_session_service_sources,
1633               ".",
1634               "//chrome")
1635     }
1636     if (enable_media_router) {
1637       sources += rebase_path(
1638               chrome_tests_unit_gypi_values.chrome_unit_tests_media_router_sources,
1639               ".",
1640               "//chrome")
1641       deps += [ "//chrome/browser/media/router:test_support" ]
1642       if (!is_android) {
1643         sources += rebase_path(
1644                 chrome_tests_unit_gypi_values.chrome_unit_tests_media_router_non_android_sources,
1645                 ".",
1646                 "//chrome")
1647       }
1648       if (!toolkit_views) {
1649         sources -= [ "../browser/ui/views/media_router/media_router_ui_browsertest.cc" ]
1650       }
1651     }
1652     if (enable_webrtc) {
1653       sources += rebase_path(
1654               chrome_tests_unit_gypi_values.chrome_unit_tests_webrtc_sources,
1655               ".",
1656               "//chrome")
1657     }
1658     if (is_chromeos) {
1659       deps += [ "//chrome/browser/chromeos:unit_tests" ]
1660       sources -= [
1661         "../browser/signin/signin_global_error_unittest.cc",
1662         "../browser/signin/signin_manager_unittest.cc",
1663         "../browser/ui/views/app_list/linux/app_list_linux_unittest.cc",
1664         "../browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc",
1665         "../browser/ui/views/sync/one_click_signin_bubble_view_unittest.cc",
1666       ]
1667     }
1668     if (use_x11) {
1669       deps += [ "//ui/events/devices" ]
1670       data_deps += [ "//tools/xdisplaycheck" ]
1671     } else {
1672       sources -= [ "../browser/password_manager/password_store_x_unittest.cc" ]
1673     }
1674     if (cld_version == 2) {
1675       # Unit tests should be independent of the CLD2 access mechanism, just use
1676       # static for simplicity.
1677       deps += [ "//third_party/cld_2:cld2_static" ]
1678     }
1679     if (is_desktop_linux && current_cpu == "x64") {
1680       # Only add this test for 64 bit builds because otherwise we need the 32
1681       # bit library on 64 bit systems when running this test.
1682       sources +=
1683           [ "../browser/password_manager/native_backend_gnome_x_unittest.cc" ]
1684       configs += [
1685         "//chrome/browser:gnome_keyring",
1686         "//chrome/browser:gnome_keyring_direct",
1687       ]
1688     }
1689     if (is_linux && !is_chromeos) {
1690       sources +=
1691           [ "../browser/password_manager/native_backend_libsecret_unittest.cc" ]
1692     }
1693     if (is_linux && use_aura) {
1694       deps += [
1695         "//dbus",
1696         "//dbus:test_support",
1697         "//ui/aura:test_support",
1698       ]
1699     }
1700     if (is_linux && is_chrome_branded && current_cpu == "x86") {
1701       ldflags = [ "-Wl,--strip-debug" ]
1702     }
1703     if (is_mac) {
1704       sources += rebase_path(
1705               chrome_tests_unit_gypi_values.chrome_unit_tests_mac_sources,
1706               ".",
1707               "//chrome")
1708       sources -= [
1709         "../browser/ui/tests/ui_gfx_image_unittest.cc",
1710         "../renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc",
1711         "../tools/convert_dict/convert_dict_unittest.cc",
1712       ]
1714       # The test fetches resources which means Mac need the app bundle to exist
1715       # on disk so it can pull from it.
1716       deps += [
1717         "//third_party/google_toolbox_for_mac",
1718         "//third_party/ocmock",
1719       ]
1721       # TODO(mark): We really want this for all non-static library targets,
1722       # but when we tried to pull it up to the common.gypi level, it broke
1723       # other things like the ui and startup tests. *shrug*
1724       ldflags = [ "-Wl,-ObjC" ]
1725     }
1726     if (!is_mac && !is_ios) {
1727       deps += [
1728         "//chrome/tools/convert_dict:lib",
1729         "//chrome:packed_extra_resources",
1730         "//chrome:packed_resources",
1731         "//third_party/hunspell",
1732       ]
1733     }
1734     if (is_win || is_mac) {
1735       sources += rebase_path(
1736               chrome_tests_unit_gypi_values.chrome_unit_tests_win_mac_sources,
1737               ".",
1738               "//chrome")
1739     }
1740     if (is_win || is_mac || is_chromeos) {
1741       sources += [ "../common/extensions/api/networking_private/networking_private_crypto_unittest.cc" ]
1742     }
1743     if (enable_rlz_support) {
1744       sources += [ "../browser/rlz/chrome_rlz_tracker_delegate_unittest.cc" ]
1745       deps += [
1746         "//chrome/browser:rlz",
1747         "//components/rlz",
1748         "//rlz:test_support",
1749       ]
1750     }
1751     if (is_win) {
1752       # The PDB gets too large for incremental linking.
1753       configs -= [ "//build/config/win:default_incremental_linking" ]
1754       configs += [ "//build/config/win:no_incremental_linking" ]
1756       sources += rebase_path(
1757               chrome_tests_unit_gypi_values.chrome_unit_tests_win_sources,
1758               ".",
1759               "//chrome")
1760       deps += [
1761         #'browser/safe_browsing/incident_reporting/verifier_test/verifier_unittest.gyp:verifier_test_dll_1',  TODO(GYP) bug 512919
1762         #'browser/safe_browsing/incident_reporting/verifier_test/verifier_unittest.gyp:verifier_test_dll_2',  TODO(GYP) bug 512919
1763         "//chrome:other_version",
1764         "//chrome_elf:blacklist_test_dll_1",
1765         "//chrome/installer/util:strings",
1766         "//third_party/iaccessible2",
1767         "//third_party/isimpledom",
1768         "//third_party/wtl",
1769         "//ui/resources",
1770       ]
1772       libs = [
1773         "comsupp.lib",
1774         "oleacc.lib",
1775         "rpcrt4.lib",
1776         "urlmon.lib",
1777         "winmm.lib",
1778       ]
1779       if (!is_chrome_branded) {
1780         sources -= [ "../browser/google/google_update_win_unittest.cc" ]
1781       }
1782     }
1783     if (is_android || is_ios) {
1784       sources -= [
1785         "../browser/devtools/device/webrtc/devtools_bridge_instances_request_unittest.cc",
1786         "../browser/ui/sync/sync_promo_ui_unittest.cc",
1787       ]
1788     } else {
1789       sources -= [
1790         "../browser/metrics/variations/variations_request_scheduler_mobile_unittest.cc",
1791         "../browser/web_resource/promo_resource_service_mobile_ntp_unittest.cc",
1792       ]
1793       deps += [ "//chrome/tools/profile_reset:jtl_compiler_lib" ]
1794     }
1795     if (!is_android && !is_chromeos) {
1796       sources += rebase_path(
1797               chrome_tests_unit_gypi_values.chrome_unit_tests_non_android_or_chromeos_sources,
1798               ".",
1799               "//chrome")
1800     }
1801     if (enable_themes) {
1802       sources += rebase_path(
1803               chrome_tests_unit_gypi_values.chrome_unit_tests_themes_sources,
1804               ".",
1805               "//chrome")
1806     }
1807     if (!is_android && (use_nss_certs || use_openssl_certs)) {
1808       sources += [ "../common/net/x509_certificate_model_unittest.cc" ]
1809     }
1810     if (enable_supervised_users) {
1811       sources += rebase_path(
1812               chrome_tests_unit_gypi_values.chrome_unit_tests_supervised_user_sources,
1813               ".",
1814               "//chrome")
1815     }
1816     if (enable_supervised_users && !is_android && !is_ios) {
1817       sources += rebase_path(
1818               chrome_tests_unit_gypi_values.chrome_unit_tests_supervised_user_legacy_sources,
1819               ".",
1820               "//chrome")
1821     }
1822     if (safe_browsing_mode == 1 && enable_extensions) {
1823       sources += [ "../browser/extensions/blacklist_unittest.cc" ]
1824     }
1825     if (cld_version == 1) {
1826       sources += [ "//third_party/cld/encodings/compact_lang_det/compact_lang_det_unittest_small.cc" ]
1827       defines += [ "CLD_WINDOWS" ]
1828       deps += [ "//third_party/cld" ]
1829     }
1830     if (enable_app_list) {
1831       sources += rebase_path(
1832               chrome_tests_unit_gypi_values.chrome_unit_tests_app_list_sources,
1833               ".",
1834               "//chrome")
1835       deps += [ "//ui/app_list:test_support" ]
1836     }
1837     if (enable_app_list && is_chromeos) {
1838       sources += rebase_path(
1839               chrome_tests_unit_gypi_values.chrome_unit_tests_app_list_chromeos_sources,
1840               ".",
1841               "//chrome")
1842     }
1843     if (enable_plugins && !enable_plugin_installation) {
1844       sources -= [ "../browser/plugins/plugin_installer_unittest.cc" ]
1845     }
1846   }
1848   if (is_win || (is_linux && !is_chromeos)) {
1849     # TODO(GYP): Figure out which of these work and are needed on other
1850     # platforms.
1851     test("chrome_app_unittests") {
1852       sources = [
1853         "../app/chrome_watcher_client_unittest_win.cc",
1854         "../app/chrome_watcher_client_win.cc",
1855         "../app/chrome_watcher_command_line_unittest_win.cc",
1856         "../app/chrome_watcher_command_line_win.cc",
1857         "../app/delay_load_hook_unittest_win.cc",
1858         "../app/delay_load_hook_win.cc",
1859         "../app/delay_load_hook_win.h",
1860         "../app/signature_validator_win.cc",
1861         "../app/signature_validator_win.h",
1862         "../app/signature_validator_win_unittest.cc",
1863         "../common/crash_keys.cc",
1864         "../common/crash_keys.h",
1865       ]
1867       deps = [
1868         ":test_support",
1869         "//breakpad:client",
1870         "//chrome/browser",
1871         "//chrome/child",
1872         "//base/test:run_all_unittests",
1873         "//base/test:test_support",
1874       ]
1875       if (cld_version == 2) {
1876         # Use whatever CLD2 data access mode that the
1877         # application embedder is using.
1878         deps += [ "//third_party/cld_2:cld2_platform_impl" ]
1879       }
1880     }
1882     test("performance_browser_tests") {
1883       sources = rebase_path(
1884               chrome_tests_gypi_values.performance_browser_tests_sources,
1885               ".",
1886               "//chrome")
1888       defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
1890       deps = [
1891         ":test_support",
1892         "//base",
1893         "//base:i18n",
1894         "//base/test:test_support",
1895         "//chrome/browser",
1896         "//chrome/renderer",
1897         "//components/autofill/content/browser/wallet:test_support",
1898         "//components/autofill/content/renderer:test_support",
1899         "//media/cast:test_support",
1900         "//testing/gmock",
1901         "//testing/gtest",
1902         "//testing/perf",
1903       ]
1905       if (is_win) {
1906         configs -= [ "//build/config/win:default_incremental_linking" ]
1907         configs +=
1908             [ "//build/config/win:default_large_module_incremental_linking" ]
1909       } else {
1910         sources -= [
1911           "../app/chrome_command_ids.h",
1913           #"../app/chrome_dll.rc",
1914           #"../app/chrome_dll_resource.h",
1915           "../app/chrome_version.rc.version",
1916         ]
1917       }
1918       if (!is_mac) {
1919         sources -= [ "perf/mach_ports_performancetest.cc" ]
1920       }
1922       if (cld_version == 2) {
1923         # Use whatever CLD2 data access mode that the
1924         # application embedder is using.
1925         deps += [ "//third_party/cld_2:cld2_platform_impl" ]
1926       }
1927     }
1928   }
1931 source_set("test_support_unit") {
1932   testonly = true
1933   sources = [
1934     "../browser/sync/glue/session_sync_test_helper.cc",
1935     "../browser/sync/glue/session_sync_test_helper.h",
1936     "base/run_all_unittests.cc",
1937   ]
1939   deps = [
1940     ":test_support",
1941     "//base",
1942     "//chrome:resources",
1943     "//chrome:strings",
1944     "//chrome/browser",
1945     "//chrome/common",
1946     "//mojo/environment:chromium",
1947     "//third_party/mojo/src/mojo/edk/system",
1948   ]
1950   if (!is_android && use_ash) {
1951     sources += rebase_path(
1952             chrome_tests_unit_gypi_values.chrome_test_support_unit_ash_sources,
1953             ".",
1954             "//chrome")
1955   }