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