Do not announce robot account token before account ID is available
[chromium-blink-merge.git] / chrome / test / BUILD.gn
blob588a4b441928c80d3a3e627f1b44065971a5ed7d
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/crypto.gni")
6 import("//build/config/features.gni")
7 import("//build/config/ui.gni")
8 import("//build/module_args/v8.gni")
9 import("//testing/test.gni")
11 # This target exists to reference other test executables to bring these files
12 # into the build.
13 group("test") {
14   testonly = true
15   deps = [
16     "//chrome/test/perf",
17   ]
20 # GYP version: chrome/chrome_tests_unit.gypi:test_support_common
21 source_set("test_support") {
22   defines = []
23   testonly = true
25   sources = [
26     "base/chrome_process_util.cc",
27     "base/chrome_process_util.h",
28     "base/chrome_process_util_mac.cc",
29     "base/chrome_render_view_host_test_harness.cc",
30     "base/chrome_render_view_host_test_harness.h",
31     "base/chrome_test_launcher.cc",
32     "base/chrome_test_launcher.h",
33     "base/chrome_test_suite.cc",
34     "base/chrome_test_suite.h",
35     "base/chrome_unit_test_suite.cc",
36     "base/chrome_unit_test_suite.h",
37     "base/find_in_page_observer.cc",
38     "base/find_in_page_observer.h",
39     "base/history_index_restore_observer.cc",
40     "base/history_index_restore_observer.h",
41     "base/in_process_browser_test.cc",
42     "base/in_process_browser_test.h",
43     "base/profile_mock.cc",
44     "base/profile_mock.h",
45     "base/scoped_browser_locale.cc",
46     "base/scoped_browser_locale.h",
47     "base/scoped_testing_local_state.cc",
48     "base/scoped_testing_local_state.h",
49     "base/test_browser_window.cc",
50     "base/test_browser_window.h",
51     "base/test_launcher_utils.cc",
52     "base/test_launcher_utils.h",
53     "base/test_switches.cc",
54     "base/test_switches.h",
55     "base/testing_browser_process.cc",
56     "base/testing_browser_process.h",
57     "base/testing_browser_process_platform_part.h",
58     "base/testing_browser_process_platform_part.cc",
59     "base/testing_io_thread_state.cc",
60     "base/testing_io_thread_state.h",
61     "base/testing_pref_service_syncable.cc",
62     "base/testing_pref_service_syncable.h",
63     "base/testing_profile.cc",
64     "base/testing_profile.h",
65     "base/testing_profile_manager.cc",
66     "base/testing_profile_manager.h",
67     "base/tracing.cc",
68     "base/tracing.h",
69     "base/ui_test_utils.cc",
70     "base/ui_test_utils.h",
71     "logging/win/file_logger.cc",
72     "logging/win/file_logger.h",
73     "logging/win/log_file_printer.cc",
74     "logging/win/log_file_printer.h",
75     "logging/win/log_file_reader.cc",
76     "logging/win/log_file_reader.h",
77     "logging/win/mof_data_parser.cc",
78     "logging/win/mof_data_parser.h",
79     "logging/win/test_log_collector.cc",
80     "logging/win/test_log_collector.h",
81   ]
83   # New deps should go in the non-iOS section below.
84   public_deps = [
85     "//content/test:test_support",
86   ]
87   deps = [
88     "//base:prefs_test_support",
89     "//base/test:test_support",
90     "//chrome:resources",
91     "//chrome:strings",
92     "//chrome/app:test_support",
94     #"//chrome/app/theme:theme_resources",
95     "//chrome/browser:test_support",
96     "//chrome/common:test_support",
97     "//chrome/renderer:test_support",
98     "//components/bookmarks/test",
99     "//components/gcm_driver:test_support",
100     "//components/history/core/test:test",
101     "//components/metrics:test_support",
102     "//components/omnibox:test_support",
103     "//components/ownership",
104     "//components/password_manager/core/browser:test_support",
105     "//components/pref_registry:test_support",
106     "//components/rappor:test_support",
107     "//components/search_engines:test_support",
108     "//components/signin/core/browser:test_support",
109     "//components/sync_driver:test_support",
110     "//components/update_client:test_support",
111     "//content/public/app:both",
112     "//ui/gfx:test_support",
113     "//net",
114     "//net:test_support",
115     "//skia",
116     "//sql",
117     "//sql:test_support",
118     "//sync",
119     "//testing/gmock",
120     "//testing/gtest",
121     "//third_party/zlib",
122     "//ui/message_center:test_support",
123   ]
125   if (!is_ios) {
126     deps += [
127       "//chrome/plugin",
128       "//chrome/renderer",
129       "//chrome/utility",
130       "//content/public/child",
131       "//content/public/common",
132       "//content/public/plugin",
133       "//content/public/renderer",
134       "//content/public/utility",
135       "//components/autofill/core/browser:test_support",
136       "//components/captive_portal:test_support",
137       "//components/infobars/core",
138       "//components/sessions:test_support",
139       "//components/web_resource:test_support",
140       "//google_apis:test_support",
141       "//ipc:test_support",
142       "//media:test_support",
143       "//ppapi:ppapi_shared",
144       "//sql:test_support",
145       "//third_party/leveldatabase",
146       "//ui/base",
147       "//ui/events:events_base",
148       "//ui/gl",
149     ]
150   }
152   if (enable_extensions) {
153     deps += [
154       "//chrome/common/extensions/api",
155       "//extensions:test_support",
156     ]
157   }
159   if (is_linux) {
160     deps += [ "//crypto:platform" ]
161   }
162   if (is_win) {
163     deps += [ "//third_party/wtl" ]
164     if (use_aura) {
165       deps += [
166         "//win8:test_registrar_constants",
167         "//win8:test_support_win8",
168       ]
169     }
170   }
172   if (enable_plugins) {
173     sources += [
174       "ppapi/ppapi_test.cc",
175       "ppapi/ppapi_test.h",
176     ]
177   }
179   if (use_ash) {
180     deps += [ "//ash:test_support" ]
181   }
182   if (toolkit_views) {
183     deps += [ "//ui/views:test_support" ]
184   }
186   if (enable_background) {
187     defines += [ "ENABLE_BACKGROUND=1" ]
188   }
190   if (enable_extensions) {
191     deps += [
192       "//chrome/common/extensions/api",
193       "//extensions:test_support",
194     ]
195   }
198 source_set("test_support_unit") {
199   testonly = true
200   sources = [
201     "../browser/sync/glue/session_sync_test_helper.cc",
202     "../browser/sync/glue/session_sync_test_helper.h",
203     "base/run_all_unittests.cc",
204   ]
206   deps = [
207     ":test_support",
208     "//base",
209     "//chrome:resources",
210     "//chrome:strings",
211     "//chrome/browser",
212     "//chrome/common",
213     "//mojo/environment:chromium",
214     "//third_party/mojo/src/mojo/edk/system",
215   ]
218 if (!is_android && (!is_win || link_chrome_on_windows)) {
219   gypi_values = exec_script("//build/gypi_to_gn.py",
220                             [ rebase_path("../chrome_tests.gypi") ],
221                             "scope",
222                             [ "../chrome_tests.gypi" ])
224   test("interactive_ui_tests") {
225     sources = rebase_path(gypi_values.chrome_interactive_ui_test_sources,
226                           ".",
227                           "//chrome")
229     defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
230     ldflags = []
232     deps = [
233       "//base/allocator",
234       "//chrome/browser",
235       "//chrome/browser/devtools",
236       "//chrome/renderer",
237       "//chrome/test:test_support",
238       "//chrome:resources",
239       "//chrome:strings",
240       "//chrome:packed_extra_resources",
241       "//chrome:packed_resources",
242       "//content/app/resources",
243       "//crypto:platform",
244       "//google_apis:test_support",
245       "//net",
246       "//net:net_resources",
247       "//net:test_support",
248       "//pdf",
250       #"//ppapi:ppapi_tests",  # TODO(GYP) this doesn't exist yet.
251       "//skia",
252       "//sync",
253       "//testing/gmock",
254       "//testing/gtest",
255       "//third_party/hunspell",
256       "//third_party/icu",
257       "//third_party/libpng",
258       "//third_party/npapi",
259       "//third_party/zlib",
260       "//ui/base:test_support",
261       "//ui/web_dialogs:test_support",
262     ]
264     # Runtime dependencies
265     datadeps = [
266       "//third_party/mesa:osmesa",
267     ]
269     if (toolkit_views) {
270       sources +=
271           rebase_path(gypi_values.chrome_interactive_ui_test_views_sources,
272                       ".",
273                       "//chrome")
274       deps += [
275         "//ui/views",
276         "//ui/views:test_support",
277         "//ui/views/controls/webview:test_support",
278       ]
279       if (!is_mac) {
280         sources += rebase_path(
281                 gypi_values.chrome_interactive_ui_test_views_non_mac_sources,
282                 ".",
283                 "//chrome")
284       }
285       if (is_linux) {
286         # TODO(gbillock): aura linux does not support the automation for
287         # SendMouseMoveNotifyWhenDone
288         sources -= [ "../browser/ui/views/toolbar/toolbar_button_test.cc" ]
289       }
290       if (is_chromeos || !use_x11) {
291         sources -= [
292           "../../ui/views/widget/desktop_aura/desktop_window_tree_host_x11_interactive_uitest.cc",
293           "../../ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc",
294         ]
295       }
296     }
298     if (is_linux && !is_chromeos) {
299       # Desktop linux.
300       sources -= [
301         # TODO(port): This times out. Attempts have been made to fix the
302         # individual failures, but each time I disable a test from these
303         # suites, it seems like one or another starts timing out too.
304         "../browser/ui/views/keyboard_access_browsertest.cc",
305       ]
306     } else {
307       # Everything but desktop Linux.
308       sources += rebase_path(
309               gypi_values.chrome_interactive_ui_test_non_desktop_linux_sources,
310               ".",
311               "//chrome")
312     }
314     if (is_chromeos) {
315       sources +=
316           rebase_path(gypi_values.chrome_interactive_ui_test_chromeos_sources,
317                       ".",
318                       "//chrome")
319       sources += [ "../browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc" ]
320       sources -= [
321         # Use only the _chromeos version on ChromeOS.
322         "base/view_event_test_platform_part_ash.cc",
323       ]
325       deps += [
326         "//ash/resources",
327         "//chromeos",
328       ]
330       if (enable_nacl) {
331         # TODO(GYP) this is also under a disable_nacl_untrusted==0 condition.
332         deps += [
333           # '../native_client/src/trusted/service_runtime/linux/nacl_bootstrap.gyp:nacl_helper_bootstrap',  TODO(GYP)
334           # '../components/nacl.gyp:nacl_helper',  TODO(GYP)
335           # '../components/nacl_nonsfi.gyp:nacl_helper_nonsfi',  TODO(GYP)
336         ]
337       }
339       if (is_chrome_branded) {
340         sources -= [
341           # These tests are failing on official cros bots. crbug.com/431450.
342           "../browser/ui/views/bookmarks/bookmark_bar_view_test.cc",
343         ]
344       }
345     } else {
346       # ChromeOS doesn't use panels, everybody else does.
347       sources +=
348           rebase_path(gypi_values.chrome_interactive_ui_test_panels_sources,
349                       ".",
350                       "//chrome")
352       # TODO(tapted): Include on mac when views panels are ported.
353       if (toolkit_views && !is_mac) {
354         sources += rebase_path(
355                 gypi_values.chrome_interactive_ui_test_panels_views_sources,
356                 ".",
357                 "//chrome")
358       }
359     }
361     if (!is_linux) {
362       # Non-Linux platforms (Linux includes ChromeOS here).
363       sources += rebase_path(
364               gypi_values.chrome_interactive_ui_test_non_linux_and_chromeos_sources,
365               ".",
366               "//chrome")
367     }
369     if (is_win) {
370       sources += rebase_path(gypi_values.chrome_interactive_ui_test_win_sources,
371                              ".",
372                              "//chrome")
373       sources += [ "$root_gen_dir/chrome/other_version.rc" ]
374       deps += [
375         "//chrome:chrome_version_resources",
376         "//third_party/isimpledom",
377         "//third_party/wtl",
378         "//ui/resources",
379       ]
380     }
382     if (is_mac) {
383       datadeps = [
384         "//chrome",
385       ]
387       # TODO(mark): We really want this for all non-static library targets, but
388       # when we tried to pull it up to the common.gypi level, it broke other
389       # things like the ui and startup tests. *shrug*
390       ldflags += [ "-Wl,-ObjC" ]
391     }
393     if (cld_version == 0 || cld_version == 2) {
394       # Interactive tests should use whatever CLD2 data access mode that the
395       # application embedder is using.
396       deps += [ "//third_party/cld_2:cld2_platform_impl" ]
397     }
399     if (use_x11) {
400       configs += [ "//build/config/linux:xtst" ]
401       datadeps += [ "//tools/xdisplaycheck" ]
402     }
404     if (enable_app_list) {
405       sources +=
406           rebase_path(gypi_values.chrome_interactive_ui_test_app_list_sources,
407                       ".",
408                       "//chrome")
409     }
411     if (use_ash) {
412       sources += rebase_path(gypi_values.chrome_interactive_ui_test_ash_sources,
413                              ".",
414                              "//chrome")
415       deps += [ "//ash:test_support" ]
416     }
418     if (enable_notifications) {
419       sources += rebase_path(
420               gypi_values.chrome_interactive_ui_test_notifications_sources,
421               ".",
422               "//chrome")
424       # Non-ChromeOS notifications tests (ChromeOS does not use cross-platform
425       # panels).
426       if (!is_chromeos) {
427         sources += [
428           "../browser/notifications/notification_browsertest.cc",
429           "../browser/notifications/platform_notification_service_browsertest.cc",
430         ]
431       }
433       if (is_android) {
434         sources -= [
435           # Android does not use the message center-based Notification system.
436           "../browser/notifications/message_center_notifications_browsertest.cc",
438           # TODO(peter): Enable the Notification browser tests.
439           "../browser/notifications/notification_browsertest.cc",
440           "../browser/notifications/platform_notification_service_browsertest.cc",
441         ]
442       }
443     }  # enable_notifications
445     if (use_aura || is_chromeos) {
446       sources -=
447           [ "../../ui/views/corewm/desktop_capture_controller_unittest.cc" ]
448     }
449   }
451   source_set("sync_integration_test_support") {
452     testonly = true
453     sources = rebase_path(gypi_values.test_support_sync_integration_sources,
454                           ".",
455                           "//chrome")
456     public_deps = [
457       "//chrome/browser",
458     ]
459     deps = [
460       ":test_support",
461       "//base",
462       "//chrome",
463       "//components/invalidation",
464       "//components/invalidation:test_support",
465       "//net",
466       "//skia",
467       "//sync",
468       "//sync:test_support_sync_testserver",
469       "//sync:test_support_sync_fake_server",
470       "//ui/app_list:test_support",
471     ]
473     if (is_mac) {
474       sources -= [
475         "../browser/sync/test/integration/dictionary_helper.cc",
476         "../browser/sync/test/integration/dictionary_helper.h",
477         "../browser/sync/test/integration/dictionary_load_observer.cc",
478         "../browser/sync/test/integration/dictionary_load_observer.h",
479       ]
480     }
481     if (!enable_app_list) {
482       sources -= [
483         "../browser/sync/test/integration/sync_app_list_helper.cc",
484         "../browser/sync/test/integration/sync_app_list_helper.h",
485       ]
486     }
487     if (!is_chromeos) {
488       sources -= [
489         "../browser/sync/test/integration/wifi_credentials_helper.cc",
490         "../browser/sync/test/integration/wifi_credentials_helper.h",
491       ]
492     }
493   }
495   # TODO(GYP) when v8's GN build supports "//v8:d8" then enable the code
496   # controlled by this flag (and the flg itself can be deleted).
497   has_d8_definition = false
499   if (has_d8_definition) {
500     template("js2webui") {
501       action_name = target_name + "_action"
502       source_set_name = target_name
504       action_foreach(action_name) {
505         testonly = true
506         visibility = [ ":$source_set_name" ]
507         script = "//tools/gypv8sh.py"
509         sources = invoker.sources
511         d8_path =
512             get_label_info("//v8:d8($host_toolchain)", "root_out_dir") + "/d8"
513         if (is_win) {
514           d8_path += ".exe"
515         }
517         input_js = [
518           "//chrome/third_party/mock4js/mock4js.js",
519           "//chrome/test/data/webui/test_api.js",
520           "//chrome/test/base/js2gtest.js",
521         ]
522         inputs = [ d8_path ] + input_js
524         outputs = [
525           "$target_gen_dir/{{source_name_part}}-gen.cc",
526           "$root_out_dir/test_data/chrome/{{source_root_relative_dir}}/{{source_file_part}}",
527         ]
529         args = [
530           # Need "./" for script to find binary (cur dir is not on path).
531           "./" + rebase_path(d8_path, root_build_dir),
532         ]
533         args += rebase_path(input_js, root_build_dir) + [ "webui" ]
534         if (v8_use_external_startup_data) {
535           args += [ "--external=y" ]
536         } else {
537           args += [ "--external=n" ]
538         }
539         args += [
540           "{{source}}",
541           "{{source_root_relative_dir}}/{{source_file_part}}",
542         ]
543         args += rebase_path(outputs, root_build_dir)
545         deps = [
546           "//v8:d8($host_toolchain)",
547         ]
548       }
550       source_set(source_set_name) {
551         testonly = true
552         if (defined(invoker.visibility)) {
553           visibility = invoker.visibility
554         }
555         sources = get_target_outputs(":$action_name")
556         defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
557         deps = [
558           ":$action_name",
560           # The generator implicitly makes includes from these targets.
561           "//testing/gmock",
562           "//testing/gtest",
563           "//url",
564         ]
565         if (defined(invoker.deps)) {
566           deps += invoker.deps
567         }
568       }
569     }
571     js2webui("browser_tests_js_webui") {
572       sources = rebase_path(gypi_values.chrome_browser_tests_webui_js_sources,
573                             ".",
574                             "//chrome")
575       if (is_chrome_branded) {
576         # crbug.com/230471
577         sources -= [ "data/webui/accessibility_audit_browsertest.js" ]
578       }
579       if (!is_chromeos) {
580         sources -= [ "data/webui/certificate_viewer_dialog_test.js" ]
581       }
582       if (!enable_app_list) {
583         sources -= [ "../browser/ui/webui/app_list/start_page_browsertest.js" ]
584       }
585       if (!enable_supervised_users) {
586         sources -=
587             [ "../browser/ui/webui/downloads_ui_supervised_browsertest.js" ]
588       }
589       deps = [
590         "//skia",
591       ]
592     }
593   }
595   test("browser_tests") {
596     sources = [
597       "base/browser_tests_main.cc",
598     ]
599     sources +=
600         rebase_path(gypi_values.chrome_browser_tests_sources, ".", "//chrome")
601     sources +=
602         rebase_path(gypi_values.chrome_browser_extensions_test_support_sources,
603                     ".",
604                     "//chrome")
606     deps = [
607       ":sync_integration_test_support",
608       ":test_support",
609       "//base",
610       "//base:i18n",
611       "//base/allocator",
612       "//base/test:test_support",
613       "//chrome:browser_tests_pak",
614       "//chrome:packed_extra_resources",
615       "//chrome:packed_resources",
616       "//chrome:resources",
617       "//chrome:strings",
618       "//chrome/browser",
619       "//chrome/common/extensions/api",
620       "//chrome/renderer",
621       "//chrome/test/perf",
622       "//components/autofill/content/browser:risk_proto",
623       "//components/autofill/content/browser:test_support",
624       "//components/captive_portal:test_support",
625       "//components/dom_distiller/content",
626       "//components/dom_distiller/core:test_support",
627       "//components/resources",
628       "//components/strings",
629       "//components/translate/core/common",
630       "//crypto:platform",
631       "//crypto:test_support",
632       "//device/bluetooth:mocks",
633       "//device/serial:test_support",
634       "//extensions/common/api",
635       "//google_apis:test_support",
636       "//media",
637       "//media/base:test_support",
638       "//media/cast:test_support",
639       "//net",
640       "//net:test_support",
641       "//sdch",
642       "//skia",
643       "//sync",
644       "//sync:test_support_sync_api",
645       "//testing/gmock",
646       "//testing/gtest",
647       "//testing/perf",
648       "//third_party/cacheinvalidation",
649       "//third_party/icu",
650       "//third_party/leveldatabase",
651       "//third_party/libaddressinput",
652       "//third_party/libjingle",
653       "//third_party/safe_browsing:test_support",
654       "//third_party/widevine/cdm:version_h",
655       "//ui/accessibility:test_support",
656       "//ui/compositor:test_support",
657       "//ui/resources",
658       "//ui/web_dialogs:test_support",
659       "//v8",
660     ]
661     if (has_d8_definition) {
662       deps += [ ":browser_tests_js_webui" ]
663     }
665     # Runtime dependencies
666     data_deps = [
667       #"//ppapi:ppapi_tests",  # TODO(GYP) this doesn't exist yet.
668       #'../remoting/remoting.gyp:remoting_browser_test_resources',  TODO(GYP)
669       #'../remoting/remoting.gyp:remoting_webapp_unittest',  TODO(GYP)
670       "//third_party/mesa:osmesa",
671       "//third_party/widevine/cdm:widevine_test_license_server",
672     ]
674     defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
676     # TODO(GYP) if (is_win) {
677     #       ['incremental_chrome_dll==1', {
678     #         'UseLibraryDependencyInputs': "true",
679     # }
681     if (cld_version == 0 || cld_version == 2) {
682       # Because the browser_tests use translate, they need CLD data.
683       deps += [ "//third_party/cld_2:cld2_platform_impl" ]
684     }
686     if (!enable_one_click_signin) {
687       sources -= [ "../browser/ui/sync/one_click_signin_bubble_links_delegate_browsertest.cc" ]
688     }
689     if (enable_nacl) {
690       sources += [
691         "../browser/extensions/extension_nacl_browsertest.cc",
692         "../browser/nacl_host/test/gdb_debug_stub_browsertest.cc",
693       ]
694       deps += [ "//components/nacl/renderer/plugin:nacl_trusted_plugin" ]
696       if (enable_nacl_untrusted) {
697         sources += [
698           "nacl/nacl_browsertest.cc",
699           "nacl/nacl_browsertest_uma.cc",
700           "nacl/nacl_browsertest_util.cc",
701           "nacl/nacl_browsertest_util.h",
702           "nacl/pnacl_header_test.cc",
703           "nacl/pnacl_header_test.h",
704         ]
705         deps += [
706           #'test/data/nacl/nacl_test_data.gyp:*',  # TODO(GYP)
707           #'../ppapi/native_client/native_client.gyp:nacl_irt',  # TODO(GYP)
708           #'../ppapi/ppapi_nacl.gyp:ppapi_nacl_tests',  # TODO(GYP)
709           #'../ppapi/tests/extensions/extensions.gyp:ppapi_tests_extensions_background_keepalive',  # TODO(GYP)
710           #'../ppapi/tests/extensions/extensions.gyp:ppapi_tests_extensions_media_galleries',  # TODO(GYP)
711           #'../ppapi/tests/extensions/extensions.gyp:ppapi_tests_extensions_packaged_app',  # TODO(GYP)          #'../ppapi/ppapi_tests_mojo.gyp:ppapi_tests_mojo',  # TODO(GYP)
712           #'../ppapi/ppapi_tests_mojo.gyp:ppapi_tests_mojo',  # TODO(GYP)
713         ]
714         if (is_chromeos) {
715           sources += [ "//third_party/liblouis/nacl_wrapper/liblouis_wrapper_browsertest.cc" ]
716         }
717         deps += [
718           #'browser_chromeos',  TODO(GYP)
719           #'../third_party/liblouis/liblouis_nacl.gyp:liblouis_test_data',  TODO(GYP)
720         ]
721       }
722       if (is_win || is_linux) {
723         sources += [ "../browser/nacl_host/test/nacl_gdb_browsertest.cc" ]
724         deps += [
725           #'browser/nacl_host/test/mock_nacl_gdb.gyp:mock_nacl_gdb',  TODO(GYP)
726         ]
727       }
728       if (is_win) {
729         # TODO(halyavin) NaCl on Windows can't open debug stub socket in
730         # browser process as needed by this test. See http://crbug.com/157312.
731         sources -= [ "../browser/nacl_host/test/gdb_debug_stub_browsertest.cc" ]
732         deps += [
733           #'chrome.gyp:chrome_nacl_win64',  TODO(GYP)
734         ]
735       }
736       is(is_linux) {
737         deps += [
738           #'../native_client/src/trusted/service_runtime/linux/nacl_bootstrap.gyp:nacl_helper_bootstrap', TODO(GYP)
739           #'../components/nacl.gyp:nacl_helper', TODO(GYP)
740           #'../components/nacl_nonsfi.gyp:nacl_helper_nonsfi', TODO(GYP)
741         ]
742       }
743       if (!is_chromeos) {
744         sources -= [ "test/data/chromeos/oobe_webui_browsertest.js" ]
745       }
746     }
747     if (debug_devtools) {
748       defines += [ "DEBUG_DEVTOOLS=1" ]
749     }
750     if (use_ash) {
751       deps += [ "//ash:test_support" ]
752     }
753     if (use_aura || toolkit_views) {
754       deps += [ "//ui/events:test_support" ]
755     }
756     if (toolkit_views) {
757       sources += rebase_path(gypi_values.chrome_browser_tests_views_sources,
758                              ".",
759                              "//chrome")
760       deps += [ "//ui/views" ]
761       if (!is_mac) {
762         sources +=
763             rebase_path(gypi_values.chrome_browser_tests_views_non_mac_sources,
764                         ".",
765                         "//chrome")
766       }
767     }
768     if (is_chromeos) {
769       sources += rebase_path(gypi_values.chrome_browser_tests_chromeos_sources,
770                              ".",
771                              "//chrome")
772       sources -= [
773         "../../apps/load_and_launch_browsertest.cc",
774         "../browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc",
775         "../browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc",
777         # chromeos does not support profile list avatar menu
778         "../browser/profiles/profile_list_desktop_browsertest.cc",
779         "../browser/service_process/service_process_control_browsertest.cc",
780         "../browser/signin/signin_browsertest.cc",
782         # chromeos does not use cross-platform panels
783         "../browser/ui/panels/panel_extension_browsertest.cc",
785         # chromeos does not use the desktop user manager
786         "../browser/ui/webui/signin/user_manager_ui_browsertest.cc",
787       ]
788       deps += [
789         "//dbus",
790         "//dbus:test_support",
792         #"//ui/login:resources",  TODO(GYP)
793       ]
794     } else {
795       sources -= [
796         "../browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc",
797         "../browser/extensions/api/terminal/terminal_private_apitest.cc",
798         "../browser/invalidation/profile_invalidation_provider_factory_browsertest.cc",
799         "../browser/net/nss_context_chromeos_browsertest.cc",
800         "../browser/ui/ash/keyboard_controller_browsertest.cc",
801         "data/webui/certificate_viewer_ui_test-inl.h",
802       ]
803       if (toolkit_views) {
804         sources -= [ "../browser/ui/views/select_file_dialog_extension_browsertest.cc" ]
805       }
806     }
807     if (enable_configuration_policy) {
808       sources += rebase_path(gypi_values.chrome_browser_tests_policy_sources,
809                              ".",
810                              "//chrome")
811     }
812     if (enable_web_speech) {
813       sources += rebase_path(gypi_values.chrome_browser_tests_speech_sources,
814                              ".",
815                              "//chrome")
816     }
817     if (safe_browsing_mode == 1) {
818       sources += rebase_path(
819               gypi_values.chrome_browser_tests_full_safe_browsing_sources,
820               ".",
821               "//chrome")
822       defines += [ "FULL_SAFE_BROWSING" ]
823     }
824     if (enable_captive_portal_detection) {
825       sources += [ "../browser/captive_portal/captive_portal_browsertest.cc" ]
826     }
827     if (!enable_webrtc) {
828       sources -= [
829         "../browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc",
830         "../browser/extensions/api/webrtc_logging_private/webrtc_logging_private_apitest.cc",
831         "../browser/media/chrome_webrtc_browsertest.cc",
832         "../browser/media/chrome_webrtc_disable_encryption_flag_browsertest.cc",
833         "../browser/media/chrome_webrtc_getmediadevices_browsertest.cc",
834       ]
835     }
836     if (is_win) {
837       sources += [ "$root_gen_dir/chrome/other_version.rc" ]
838       deps += [
839         "//chrome:chrome_version_resources",
840         "//third_party/wtl",
841         "//ui/resources",
842       ]
843     } else {
844       sources -= [
845         "../app/chrome_command_ids.h",
846         "../app/chrome_dll_resource.h",
847         "../app/chrome_version.rc.version",
848         "../browser/media_galleries/fileapi/iapps_finder_impl_win_browsertest.cc",
849       ]
850     }
851     if (!is_chromeos && use_aura) {
852       sources -= [
853         # On Windows and Linux, we currently don't support enough of the
854         # ash environment to run these unit tests.
855         #
856         # TODO: enable these on windows and linux.
857         "../browser/ui/ash/accelerator_commands_browsertest.cc",
858         "../browser/ui/ash/accelerator_controller_browsertest.cc",
859         "../browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc",
860         "../browser/ui/ash/launcher/launcher_favicon_loader_browsertest.cc",
861         "../browser/ui/ash/shelf_browsertest.cc",
862         "../browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc",
863       ]
864     }
865     if (is_mac) {
866       # TODO(mark): We really want this for all non-static library
867       # targets, but when we tried to pull it up to the common.gypi
868       # level, it broke other things like the ui and startup tests. *shrug*
869       ldflags = [ "-Wl,-ObjC" ]
871       # Other platforms only need
872       # chrome_resources.gyp:{packed_extra_resources,packed_resources},
873       # and can build this target standalone much faster.
874       deps += [
875         #'app_mode_app_support',  TODO(GYP)
876         "//chrome",
877         #'../components/components.gyp:breakpad_stubs',  TODO(GYP)
878         #'../third_party/ocmock/ocmock.gyp:ocmock',  TODO(GYP)
879       ]
880       sources += [
881         "../browser/media_galleries/fileapi/iphoto_data_provider_browsertest.cc",
882         "../browser/renderer_host/chrome_render_widget_host_view_mac_delegate_browsertest.cc",
883         "../browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm",
884         "../browser/spellchecker/spellcheck_message_filter_mac_browsertest.cc",
885       ]
886       sources -= [
887         # TODO(groby): This test depends on hunspell and we cannot run it on
888         # Mac, which does not use hunspell by default.
889         "../browser/spellchecker/spellcheck_service_browsertest.cc",
891         # TODO(rouslan): This test depends on the custom dictionary UI,
892         # which is disabled on Mac.
893         "../browser/ui/webui/options/edit_dictionary_browsertest.js",
895         # TODO(rouslan): This test depends on hunspell and we cannot run it
896         # on Mac, which does use hunspell by default.
897         "../browser/ui/webui/options/language_options_dictionary_download_browsertest.js",
899         # ProcessSingletonMac doesn"t do anything.
900         "../browser/process_singleton_browsertest.cc",
902         # This test depends on GetCommandLineForRelaunch, which is not
903         # available on Mac.
904         "../browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc",
906         # single-process mode hangs on Mac sometimes because of multiple UI
907         # message loops. See 306348
908         "../renderer/safe_browsing/phishing_classifier_browsertest.cc",
909         "../renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc",
910         "../renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc",
911       ]
912     }
913     if (is_mac || is_win) {
914       sources += [
915         "../browser/extensions/api/networking_private/networking_private_apitest.cc",
916         "../browser/extensions/api/networking_private/networking_private_service_client_apitest.cc",
917         "../browser/media_galleries/fileapi/itunes_data_provider_browsertest.cc",
918         "../browser/media_galleries/fileapi/picasa_data_provider_browsertest.cc",
919       ]
920       deps += [ "//components/wifi:test_support" ]
921     }
922     if (!is_posix || is_chromeos) {
923       sources -= [ "../common/time_format_browsertest.cc" ]
924     }
925     if (is_android) {
926       sources -= [
927         "../browser/policy/cloud/component_cloud_policy_browsertest.cc",
928         "../browser/prefs/pref_hash_browsertest.cc",
929       ]
930     }
931     if (is_chromeos) {
932       sources += [
933         "../browser/extensions/api/networking_private/networking_private_apitest.cc",
934         "../browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc",
935       ]
936     }
937     if (!is_android && !is_ios) {
938       sources +=
939           [ "../browser/copresence/chrome_whispernet_client_browsertest.cc" ]
940       deps += [ "//components/copresence" ]
941     }
942     if (!is_android && !is_ios && !is_linux) {
943       # NPAPI test plugin only works on some platforms.
944       data_deps += [
945         #'../content/content_shell_and_tests.gyp:copy_npapi_test_plugin',  TODO(GYP)
946       ]
947     }
948     if (enable_app_list) {
949       sources += rebase_path(gypi_values.chrome_browser_tests_app_list_sources,
950                              ".",
951                              "//chrome")
952     }
953     if (enable_supervised_users) {
954       sources +=
955           rebase_path(gypi_values.chrome_browser_tests_supervised_user_sources,
956                       ".",
957                       "//chrome")
958     }
959     if (enable_pepper_cdms) {
960       # Runtime dependencies.
961       data_deps += [
962         "//media/cdm/ppapi:clearkeycdmadapter",
963         #'../third_party/widevine/cdm/widevine_cdm.gyp:widevinecdmadapter',  TODO(GYP)
964       ]
965     }
966     if (!enable_print_preview) {
967       sources -= [
968         "../browser/extensions/api/cloud_print_private/cloud_print_private_apitest.cc",
969         "../browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc",
970         "../browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc",
971         "../browser/printing/print_preview_dialog_controller_browsertest.cc",
972         "../browser/printing/print_preview_pdf_generated_browsertest.cc",
973         "../browser/service_process/service_process_control_browsertest.cc",
974         "../browser/ui/webui/print_preview/print_preview_ui_browsertest.cc",
975         "data/webui/print_preview.cc",
976         "data/webui/print_preview.h",
977         "data/webui/print_preview.js",
978       ]
979     }
980     if (!enable_basic_printing && !enable_print_preview) {
981       sources -= [ "../renderer/printing/print_web_view_helper_browsertest.cc" ]
982     }
983     if (enable_mdns) {
984       sources += [ "../browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc" ]
985     }
986     if (use_brlapi) {
987       deps += [ "//build/config/linux:libbrlapi" ]
988     } else {
989       sources -= [ "../browser/extensions/api/braille_display_private/braille_display_private_apitest.cc" ]
990     }
991     if (is_chrome_branded) {
992       sources -= [
993         # These tests depend on single process mode, which is disabled in
994         # official builds.
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 (!enable_autofill_dialog || is_android || is_ios) {
1001       deps -= [ "//third_party/libaddressinput" ]
1002     }
1003     if (use_ozone) {
1004       sources -= [
1005         # crbug.com/362698
1006         "../browser/chromeos/input_method/input_method_engine_browsertests.cc",
1007         "../browser/extensions/api/input_ime/input_ime_apitest_chromeos.cc",
1008       ]
1009     }
1010     if (enable_remoting) {
1011       sources += rebase_path(gypi_values.chrome_browser_tests_remoting_sources,
1012                              ".",
1013                              "//chrome")
1014       #deps += [ "//remoting:remoting_webapp" ]  TODO(GYP)
1015     }
1016     if (use_x11) {
1017       deps += [ "//tools/xdisplaycheck" ]
1018     }
1019   }
1021   test("sync_integration_tests") {
1022     sources =
1023         rebase_path(gypi_values.sync_integration_tests_sources, ".", "//chrome")
1025     # TODO(phajdan.jr): Only temporary, to make transition easier.
1026     defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
1028     deps = [
1029       ":sync_integration_test_support",
1030       ":test_support",
1031       "//base/allocator",
1032       "//chrome:packed_extra_resources",
1033       "//chrome:packed_resources",
1034       "//chrome:resources",
1035       "//chrome:strings",
1036       "//chrome/common",
1037       "//chrome/renderer",
1038       "//crypto:platform",
1039       "//sync",
1040       "//testing/gmock",
1041       "//testing/gtest",
1042       "//third_party/icu",
1043       "//third_party/leveldatabase",
1044       "//third_party/npapi",
1045       "//third_party/WebKit/public:blink",
1046     ]
1048     if (cld_version == 0 || cld_version == 2) {
1049       # Language detection is irrelevant to sync, so it can depend on any
1050       # implementation for CLD2. Dynamic is smaller, so go with dynamic.
1051       deps += [ "//third_party/cld_2:cld2_dynamic" ]
1052     }
1053     if (is_mac) {
1054       # Dictionary sync is disabled on Mac.
1055       sources -= [
1056         "../browser/sync/test/integration/multiple_client_dictionary_sync_test.cc",
1057         "../browser/sync/test/integration/single_client_dictionary_sync_test.cc",
1058         "../browser/sync/test/integration/two_client_dictionary_sync_test.cc",
1059       ]
1061       # The sync_integration_tests do not run on mac without this flag.
1062       # Search for comments about "xcode_settings" elsewhere in this file.
1063       ldflags = [ "-Wl,-ObjC" ]
1064     }
1065     if (is_win) {
1066       sources += [ "$root_gen_dir/chrome/other_version.rc" ]
1067       deps += [
1068         "//chrome:chrome_version_resources",
1069         "//third_party/wtl",
1070         "//ui/resources",
1071       ]
1072     } else {
1073       sources -= [ "../app/chrome_version.rc.version" ]
1074     }
1075     if (!is_chromeos) {
1076       sources -= [
1077         "../browser/sync/test/integration/single_client_wifi_credentials_sync_test.cc",
1078         "../browser/sync/test/integration/two_client_wifi_credentials_sync_test.cc",
1079       ]
1080     }
1082     if (toolkit_views) {
1083       deps += [ "//ui/views" ]
1084     }
1085     if (enable_basic_printing || enable_print_preview) {
1086       deps += [ "//printing" ]
1087     }
1088     if (!enable_app_list) {
1089       sources -= [
1090         "../browser/sync/test/integration/single_client_app_list_sync_test.cc",
1091         "../browser/sync/test/integration/two_client_app_list_sync_test.cc",
1092       ]
1093     }
1094     if (!enable_supervised_users) {
1095       sources -= [ "../browser/sync/test/integration/single_client_supervised_user_settings_sync_test.cc" ]
1096     }
1097   }
1099   test("sync_performance_tests") {
1100     sources =
1101         rebase_path(gypi_values.sync_performance_tests_sources, ".", "//chrome")
1103     defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
1105     deps = [
1106       ":sync_integration_test_support",
1107       "//base/allocator",
1108       "//crypto:platform",
1109       "//sync",
1110       "//testing/gmock",
1111       "//testing/gtest",
1112     ]
1114     if (cld_version == 0 || cld_version == 2) {
1115       # Language detection is irrelevant to sync, so it can depend on any
1116       # implementation for CLD2. Dynamic is smaller, so go with dynamic.
1117       deps += [ "//third_party/cld_2:cld2_dynamic" ]
1118     }
1120     if (is_mac) {
1121       # Dictionary sync is disabled on Mac.
1122       sources -= [ "../browser/sync/test/integration/performance/dictionary_sync_perf_test.cc" ]
1124       # The sync_performance_tests do not run on mac without this flag.
1125       # Search for comments about "xcode_settings" elsewhere in this file.
1126       ldflags = [ "-Wl,-ObjC" ]
1127     }
1128     if (is_win) {
1129       sources += [ "$root_gen_dir/chrome/other_version.rc" ]
1130       deps += [
1131         "//chrome:chrome_version_resources",
1132         "//third_party/wtl",
1133         "//ui/resources",
1134       ]
1135     } else {
1136       sources -= [ "../app/chrome_version.rc.version" ]
1137     }
1139     if (toolkit_views) {
1140       deps += [ "//ui/views" ]
1141     }
1142   }
1144   # Executable to measure time to load libraries.
1145   test("load_library_perf_tests") {
1146     sources = [
1147       "../browser/load_library_perf_test.cc",
1148     ]
1150     deps = [
1151       "//base/test:test_support_perf",
1152       "//testing/gtest",
1153       "//testing/perf",
1154       "//third_party/widevine/cdm:version_h",
1155     ]
1157     # TODO(GYP) CDM adapter stuff.
1158     #if (enable_pepper_cdms) {
1159     #  deps += [
1160     #    "//media/cdm/ppapi:clearkeycdmadapter",
1161     #    "//ppapi:ppapi_cpp",
1162     #    "//third_party/widevine/cdm:adapter",
1163     #  ]
1164     #}
1165   }
1167   unit_gypi_values = exec_script("//build/gypi_to_gn.py",
1168                                  [ rebase_path("../chrome_tests_unit.gypi") ],
1169                                  "scope",
1170                                  [ "../chrome_tests_unit.gypi" ])
1172   test("unit_tests") {
1173     sources =
1174         rebase_path(unit_gypi_values.chrome_unit_tests_sources, ".", "//chrome")
1176     defines = []
1178     deps = [
1179       # NOTE: New depndencies should generally be added in the OS!="ios"
1180       # dependencies block below, rather than here.
1181       # Unit tests should only depend on:
1182       # 1) everything that the chrome binaries depend on:
1183       "//chrome:browser_dependencies",
1184       "//chrome:child_dependencies",
1186       # 2) test-specific support libraries:
1187       ":test_support_unit",
1188       "//base/test:test_support",
1189       "//chrome/test:test_support",
1190       "//components/resources",
1191       "//components/content_settings/core/test:test_support",
1192       "//content/test:test_support",
1193       "//content/public/app:both",
1194       "//crypto:platform",
1195       "//crypto:test_support",
1196       "//net",
1197       "//net:test_support",
1198       "//sync:test_support_sync_api",
1199       "//sync:test_support_sync_core",
1200       "//sync:test_support_sync_internal_api",
1201       "//testing/gmock",
1202       "//testing/gtest",
1204       # 3) anything tests directly depend on
1205       "//base/allocator",
1206       "//chrome:resources",
1207       "//chrome:strings",
1208       "//courgette:courgette_lib",
1209       "//google_apis",
1210       "//skia",
1211       "//third_party/cacheinvalidation",
1212       "//third_party/icu",
1213       "//third_party/libxml",
1214       "//ui/accelerometer",
1215       "//ui/base:test_support",
1216       "//ui/gfx:test_support",
1217       "//ui/resources",
1218     ]
1219     data_deps = []
1221     # TODO(GYP) Windows stuff
1222     # ['incremental_chrome_dll==1', {
1223     #   'UseLibraryDependencyInputs': "true",
1225     if (!is_ios) {
1226       deps += [
1227         "//components/autofill/content/browser:test_support",
1228         "//components/metrics/proto",
1229         "//components/data_reduction_proxy/core/browser:test_support",
1230         "//components/webdata_services:test_support",
1231         "//components/strings",
1232         "//content/app/resources",
1233         "//gpu:test_support",
1234         "//media:test_support",
1236         #'../ppapi/ppapi_internal.gyp:ppapi_unittest_shared',  TODO(GYP)
1237         "//third_party/leveldatabase",
1238         "//third_party/libaddressinput",
1239         "//third_party/libjingle",
1240         "//third_party/libphonenumber",
1241         "//tools/json_schema_compiler/test",
1242         "//ui/gl",
1243         "//v8",
1244       ]
1245     }
1247     if (is_android) {
1248       deps -= [ "//third_party/libaddressinput" ]
1250       # Some android targets still depend on --gc-sections to link.
1251       # TODO: remove --gc-sections for Debug builds (crbug.com/159847).
1252       ldflags = [ "-Wl,--gc-sections" ]
1253       deps += [ "//testing/android:native_test_native_code" ]
1254     } else {
1255       sources +=
1256           rebase_path(unit_gypi_values.chrome_unit_tests_non_android_sources,
1257                       ".",
1258                       "//chrome")
1259     }
1261     if (is_ios || is_chromeos) {
1262       sources -=
1263           [ "../browser/metrics/signin_status_metrics_provider_unittest.cc" ]
1264     }
1265     if (enable_background) {
1266       sources +=
1267           rebase_path(unit_gypi_values.chrome_unit_tests_background_sources,
1268                       ".",
1269                       "//chrome")
1270     }
1271     if (enable_spellcheck) {
1272       sources +=
1273           rebase_path(unit_gypi_values.chrome_unit_tests_spellchecker_sources,
1274                       ".",
1275                       "//chrome")
1276       if (is_mac && !is_ios) {
1277         deps += [ "//third_party/hunspell" ]
1278       }
1279     }
1281     if (enable_one_click_signin) {
1282       sources += rebase_path(
1283               unit_gypi_values.chrome_unit_tests_one_click_signin_sources,
1284               ".",
1285               "//chrome")
1286       if (is_chromeos) {
1287         sources -= [
1288           "../browser/ui/sync/one_click_signin_helper_unittest.cc",
1289           "../browser/ui/sync/one_click_signin_sync_starter_unittest.cc",
1290         ]
1291       }
1292       if (!toolkit_views) {
1293         sources -= [ "../browser/ui/views/sync/one_click_signin_bubble_view_unittest.cc" ]
1294       }
1295     }
1296     if (enable_nacl) {
1297       sources += rebase_path(unit_gypi_values.chrome_unit_tests_nacl_sources,
1298                              ".",
1299                              "//chrome")
1300     }
1301     if (enable_extensions) {
1302       sources +=
1303           rebase_path(unit_gypi_values.chrome_unit_tests_extensions_sources,
1304                       ".",
1305                       "//chrome")
1306       deps += [
1307         "//chrome/common/extensions/api",
1308         "//extensions:extensions_resources",
1309         "//extensions/strings",
1310       ]
1311       if (enable_configuration_policy) {
1312         sources += rebase_path(
1313                 unit_gypi_values.chrome_unit_tests_extensions_policy_sources,
1314                 ".",
1315                 "//chrome")
1316       }
1317       if (!is_chromeos) {
1318         sources += rebase_path(
1319                 unit_gypi_values.chrome_unit_tests_extensions_non_chromeos_sources,
1320                 ".",
1321                 "//chrome")
1322       }
1323     }
1324     if (toolkit_views) {
1325       deps += [
1326         "//components/web_modal:test_support",
1327         "//ui/views",
1328         "//ui/views:test_support",
1329       ]
1330       if (!is_mac) {
1331         # TODO(tapted): Enable toolkit-views unit_tests on Mac when their
1332         # respective implementations are linked in. http://crbug.com/412234.
1333         sources += rebase_path(unit_gypi_values.chrome_unit_tests_views_sources,
1334                                ".",
1335                                "//chrome")
1336       }
1337     }
1338     if (use_ash) {
1339       sources += rebase_path(unit_gypi_values.chrome_unit_tests_ash_sources,
1340                              ".",
1341                              "//chrome")
1342       deps += [
1343         "//ash:test_support",
1344         "//ash/resources",
1345         "//ash/strings",
1346       ]
1348       # We eventually want to compile both in Win Aura builds, see
1349       # http://crbug.com/155545.
1350       if (!is_win) {
1351         sources -= [ "../browser/ui/window_sizer/window_sizer_unittest.cc" ]
1352       }
1353     }
1354     if (use_aura) {
1355       sources += [ "//ui/views/controls/webview/webview_unittest.cc" ]
1356       deps += [
1357         "//ui/wm",
1358         "//ui/aura:test_support",
1359         "//ui/views:test_support",
1360       ]
1361     }
1362     if (!is_chromeos && is_linux) {
1363       sources +=
1364           rebase_path(unit_gypi_values.chrome_unit_tests_desktop_linux_sources,
1365                       ".",
1366                       "//chrome")
1367     }
1368     if (!is_chromeos && !use_ozone && is_linux) {
1369       deps += [
1370         "//chrome/browser/ui/libgtk2ui",
1371         "//build/config/linux:gio",
1372       ]
1373       if (!is_component_build) {
1374         # TODO(erg): This file does not compile in shared library mode because
1375         # it is reaching into the internals of libgtk2ui, which shouldn't be
1376         # linked with the rest of chrome. This should either be fixed by
1377         # creating a separate unit test target, or by deleting the test.
1378         sources += [ "../browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2_unittest.cc" ]
1379       }
1380     }
1382     if (enable_task_manager) {
1383       sources +=
1384           rebase_path(unit_gypi_values.chrome_unit_tests_task_manager_sources,
1385                       ".",
1386                       "//chrome")
1387     }
1388     if (enable_mdns) {
1389       sources += rebase_path(unit_gypi_values.chrome_unit_tests_mdns_sources,
1390                              ".",
1391                              "//chrome")
1392     }
1393     if (enable_service_discovery) {
1394       sources += rebase_path(
1395               unit_gypi_values.chrome_unit_tests_service_discovery_sources,
1396               ".",
1397               "//chrome")
1398     }
1399     if (enable_configuration_policy) {
1400       sources += rebase_path(
1401               unit_gypi_values.chrome_unit_tests_configuration_policy_sources,
1402               ".",
1403               "//chrome")
1404       if (is_chromeos) {
1405         sources -=
1406             [ "../browser/policy/cloud/user_policy_signin_service_unittest.cc" ]
1407       } else if (is_android) {
1408         sources -= [ "../browser/policy/policy_path_parser_unittest.cc" ]
1409       }
1410       if (!is_android && !is_ios && !is_chromeos) {
1411         sources +=
1412             [ "../browser/net/disk_cache_dir_policy_handler_unittest.cc" ]
1413       }
1414       if (!is_android && !is_ios) {
1415         sources +=
1416             [ "../browser/download/download_dir_policy_handler_unittest.cc" ]
1417       }
1418     }
1419     if (enable_web_speech) {
1420       sources += rebase_path(unit_gypi_values.chrome_unit_tests_speech_sources,
1421                              ".",
1422                              "//chrome")
1423     }
1424     if (enable_notifications) {
1425       sources +=
1426           rebase_path(unit_gypi_values.chrome_unit_tests_notifications_sources,
1427                       ".",
1428                       "//chrome")
1429       if (is_android) {
1430         sources -= [
1431           # Android does not use the Message Center notification system.
1432           "../browser/notifications/message_center_notifications_unittest.cc",
1433           "../browser/notifications/message_center_settings_controller_unittest.cc",
1434         ]
1435       }
1436     }
1437     if (safe_browsing_mode == 1) {
1438       # TODO(sgurun): enable tests for safe_browsing==2.
1439       sources += rebase_path(
1440               unit_gypi_values.chrome_unit_tests_full_safe_browsing_sources,
1441               ".",
1442               "//chrome")
1443       defines += [ "FULL_SAFE_BROWSING" ]
1444       if (is_chromeos) {
1445         sources -= [ "../browser/safe_browsing/download_protection_service_unittest.cc" ]
1446       } else if (is_android) {
1447         sources -= [
1448           # Android doesn't support download feedbacks.
1449           "../browser/safe_browsing/download_feedback_unittest.cc",
1450           "../browser/safe_browsing/download_feedback_service_unittest.cc",
1451           "../browser/safe_browsing/download_protection_service_unittest.cc",
1452           "../browser/safe_browsing/two_phase_uploader_unittest.cc",
1453         ]
1454       }
1455     }
1456     if (enable_autofill_dialog && !is_android) {
1457       sources += rebase_path(
1458               unit_gypi_values.chrome_unit_tests_autofill_dialog_sources,
1459               ".",
1460               "//chrome")
1461     }
1462     if (enable_plugins) {
1463       sources += rebase_path(unit_gypi_values.chrome_unit_tests_plugins_sources,
1464                              ".",
1465                              "//chrome")
1466     }
1467     if (enable_print_preview) {
1468       sources +=
1469           rebase_path(unit_gypi_values.chrome_unit_tests_print_preview_sources,
1470                       ".",
1471                       "//chrome")
1472     }
1473     if (enable_captive_portal_detection) {
1474       sources +=
1475           rebase_path(unit_gypi_values.chrome_unit_tests_captive_portal_sources,
1476                       ".",
1477                       "//chrome")
1478     }
1479     if (enable_session_service) {
1480       sources += rebase_path(
1481               unit_gypi_values.chrome_unit_tests_session_service_sources,
1482               ".",
1483               "//chrome")
1484     }
1485     if (enable_webrtc) {
1486       sources += rebase_path(unit_gypi_values.chrome_unit_tests_webrtc_sources,
1487                              ".",
1488                              "//chrome")
1489     }
1490     if (is_chromeos) {
1491       sources +=
1492           rebase_path(unit_gypi_values.chrome_unit_tests_chromeos_sources,
1493                       ".",
1494                       "//chrome")
1495       deps += [
1496         "//ash/resources",
1497         "//ui/chromeos/resources",
1498       ]
1499       sources -= [
1500         "../browser/signin/signin_global_error_unittest.cc",
1501         "../browser/signin/signin_manager_unittest.cc",
1502         "../browser/signin/signin_names_io_thread_unittest.cc",
1503         "../browser/ui/views/app_list/linux/app_list_linux_unittest.cc",
1504         "../browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc",
1505       ]
1506     }
1507     if (use_x11) {
1508       deps += [ "//ui/events/devices" ]
1509       data_deps += [ "//tools/xdisplaycheck" ]
1510     } else {
1511       sources -= [ "../browser/password_manager/password_store_x_unittest.cc" ]
1512     }
1513     if (cld_version == 0 || cld_version == 2) {
1514       # Unit tests should be independent of the CLD2 access mechanism, just use
1515       # static for simplicity.
1516       deps += [ "//third_party/cld_2:cld2_static" ]
1517     }
1518     if (is_desktop_linux && cpu_arch == "x64") {
1519       # Only add this test for 64 bit builds because otherwise we need the 32
1520       # bit library on 64 bit systems when running this test.
1521       sources +=
1522           [ "../browser/password_manager/native_backend_gnome_x_unittest.cc" ]
1523       configs += [
1524         "//chrome/browser:gnome_keyring",
1525         "//chrome/browser:gnome_keyring_direct",
1526       ]
1527     }
1528     if (is_linux && !is_chromeos) {
1529       sources +=
1530           [ "../browser/password_manager/native_backend_libsecret_unittest.cc" ]
1531     }
1532     if (is_linux && use_aura) {
1533       deps += [
1534         "//dbus",
1535         "//dbus:test_support",
1536         "//ui/aura:test_support",
1537       ]
1538     }
1539     if (is_linux && is_chrome_branded && cpu_arch == "x86") {
1540       ldflags = [ "-Wl,--strip-debug" ]
1541     }
1542     if (is_mac) {
1543       sources += rebase_path(unit_gypi_values.chrome_unit_tests_mac_sources,
1544                              ".",
1545                              "//chrome")
1546       sources -= [
1547         "../browser/ui/tests/ui_gfx_image_unittest.cc",
1548         "../tools/convert_dict/convert_dict_unittest.cc",
1549         "../renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc",
1550       ]
1552       # The test fetches resources which means Mac need the app bundle to exist
1553       # on disk so it can pull from it.
1554       deps += [
1555         "//third_party/google_toolbox_for_mac",
1556         "//third_party/ocmock",
1557       ]
1559       # TODO(mark): We really want this for all non-static library targets,
1560       # but when we tried to pull it up to the common.gypi level, it broke
1561       # other things like the ui and startup tests. *shrug*
1562       ldflags = [ "-Wl,-ObjC" ]
1563     }
1564     if (!is_mac && !is_ios) {
1565       deps += [
1566         "//third_party/hunspell",
1567         "//chrome:packed_extra_resources",
1568         "//chrome:packed_resources",
1569         "//chrome/tools/convert_dict:lib",
1570       ]
1571     }
1572     if (is_win || is_mac) {
1573       sources += rebase_path(unit_gypi_values.chrome_unit_tests_win_mac_sources,
1574                              ".",
1575                              "//chrome")
1576     }
1577     if (is_win || is_mac || is_chromeos) {
1578       sources += [ "../common/extensions/api/networking_private/networking_private_crypto_unittest.cc" ]
1579     }
1580     if (enable_rlz) {
1581       deps += [ "//rlz:test_support" ]
1582     } else {
1583       sources -= [ "../browser/rlz/rlz_unittest.cc" ]
1584     }
1585     if (is_win) {
1586       if (!is_component_build) {
1587         # Unit_tests pdb files can get too big when incremental linking is
1588         # on, disabling for this target.
1589         #'LinkIncremental': '<(msvs_debug_link_nonincremental)',  TODO(GYP)
1590       }
1592       sources += rebase_path(unit_gypi_values.chrome_unit_tests_win_sources,
1593                              ".",
1594                              "//chrome")
1595       sources += [
1596         # TODO:  It would be nice to have these pulled in
1597         # automatically from direct_dependent_settings in
1598         # their various targets (net.gyp:net_resources, etc.),
1599         # but that causes errors in other targets when
1600         # resulting .res files get referenced multiple times.
1601         #'<(SHARED_INTERMEDIATE_DIR)/chrome_version/other_version.rc',  TODO(GYP)
1602         #'<(SHARED_INTERMEDIATE_DIR)/installer_util_strings/installer_util_strings.rc',  TODO(GYP)
1603         #'<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_unscaled_resources.rc',  TODO(GYP)
1604       ]
1606       deps += [
1607         #'browser/safe_browsing/verifier_test/verifier_unittest.gyp:verifier_test_dll_1',  TODO(GYP)
1608         #'browser/safe_browsing/verifier_test/verifier_unittest.gyp:verifier_test_dll_2',  TODO(GYP)
1609         #'chrome_version_resources',  TODO(GYP)
1610         "//chrome_elf:blacklist_test_dll_1",
1611         "//third_party/iaccessible2",
1612         "//third_party/isimpledom",
1613         "//third_party/wtl",
1614       ]
1616       libs = [
1617         "comsupp.lib",
1618         "oleacc.lib",
1619         "rpcrt4.lib",
1620         "urlmon.lib",
1621         "winmm.lib",
1622       ]
1623     }
1624     if (is_android || is_ios) {
1625       sources -= [
1626         "../browser/devtools/device/webrtc/devtools_bridge_instances_request_unittest.cc",
1627         "../browser/ui/sync/sync_promo_ui_unittest.cc",
1628       ]
1629     } else {
1630       sources -= [
1631         "../browser/metrics/variations/variations_request_scheduler_mobile_unittest.cc",
1632         "../browser/web_resource/promo_resource_service_mobile_ntp_unittest.cc",
1633       ]
1634       deps += [ "//chrome/tools/profile_reset:jtl_compiler_lib" ]
1635     }
1636     if (!is_android && !is_chromeos) {
1637       sources += rebase_path(
1638               unit_gypi_values.chrome_unit_tests_non_android_or_chromeos_sources,
1639               ".",
1640               "//chrome")
1641     }
1642     if (enable_themes) {
1643       sources += rebase_path(unit_gypi_values.chrome_unit_tests_themes_sources,
1644                              ".",
1645                              "//chrome")
1646     }
1647     if (!is_android && (use_nss_certs || use_openssl_certs)) {
1648       sources += [ "../common/net/x509_certificate_model_unittest.cc" ]
1649     }
1650     if (enable_supervised_users) {
1651       sources += rebase_path(
1652               unit_gypi_values.chrome_unit_tests_supervised_user_sources,
1653               ".",
1654               "//chrome")
1655     }
1656     if (safe_browsing_mode == 1 && enable_extensions) {
1657       sources += [ "../browser/extensions/blacklist_unittest.cc" ]
1658     }
1659     if (cld_version == 1) {
1660       sources += [ "//third_party/cld/encodings/compact_lang_det/compact_lang_det_unittest_small.cc" ]
1661       defines += [ "CLD_WINDOWS" ]
1662       deps += [ "//third_party/cld" ]
1663     }
1664     if (enable_app_list) {
1665       sources +=
1666           rebase_path(unit_gypi_values.chrome_unit_tests_app_list_sources,
1667                       ".",
1668                       "//chrome")
1669       deps += [ "//ui/app_list:test_support" ]
1670     }
1671     if (use_ozone) {
1672       # crbug.com/354036
1673       sources -= [ "browser/chromeos/events/event_rewriter_unittest.cc" ]
1674     }
1675     if (!enable_plugin_installation) {
1676       sources -= [ "../browser/plugins/plugin_installer_unittest.cc" ]
1677     }
1678   }