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