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