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