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