Add google_apis_unittests, midi_unittests to GN swarming.
[chromium-blink-merge.git] / components / BUILD.gn
blob9478c172682137536271c92d7f8f878ddbf5f040
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/features.gni")
6 import("//build/config/ui.gni")
7 import("//testing/test.gni")
8 import("//tools/grit/repack.gni")
10 # Collection of all components. You wouldn't link to this, but this is rather
11 # to reference the files so they can be compiled by the build system.
12 group("all_components") {
13   testonly = true  # You shouldn't actually link to this.
14   visibility = [ "//:*" ]  # Only for the root targets to bring in.
16   deps = [
17     "//components/about_handler",
18     "//components/auto_login_parser",
19     "//components/autofill/content/browser",
20     "//components/autofill/content/common",
21     "//components/autofill/content/renderer",
22     "//components/bookmarks/browser",
23     "//components/bookmarks/common",
24     "//components/bookmarks/managed",
25     "//components/bookmarks/test",
26     "//components/captive_portal",
27     "//components/cdm/browser",
28     "//components/cdm/common",
29     "//components/cdm/renderer",
30     "//components/cloud_devices/common",
31     "//components/chrome_apps",
32     "//components/component_updater",
33     "//components/compression",
34     "//components/content_settings/core/browser",
35     "//components/content_settings/core/common",
36     "//components/crash/app",
37     "//components/crash/browser",
38     "//components/crx_file",
39     "//components/data_reduction_proxy/core/browser",
40     "//components/data_reduction_proxy/core/common",
41     "//components/device_event_log",
42     "//components/devtools_discovery",
43     "//components/devtools_http_handler",
44     "//components/dom_distiller/core",
45     "//components/domain_reliability",
46     "//components/enhanced_bookmarks",
47     "//components/favicon/core",
48     "//components/favicon_base",
49     "//components/feedback",
50     "//components/gcm_driver",
51     "//components/gcm_driver/crypto",
52     "//components/gcm_driver/instance_id",
53     "//components/google/core/browser",
54     "//components/history/content/browser",
55     "//components/history/core/browser",
56     "//components/history/core/common",
57     "//components/history/core/test",
58     "//components/infobars/core",
59     "//components/invalidation/impl",
60     "//components/json_schema",
61     "//components/keyed_service/content",
62     "//components/language_usage_metrics",
63     "//components/leveldb_proto",
64     "//components/login",
65     "//components/memory_pressure",
66     "//components/metrics",
67     "//components/mime_util",
68     "//components/navigation_interception",
69     "//components/navigation_metrics",
70     "//components/network_hints/browser",
71     "//components/network_hints/common",
72     "//components/network_hints/renderer",
73     "//components/network_time",
74     "//components/offline_pages",
75     "//components/omnibox/browser",
76     "//components/onc",
77     "//components/open_from_clipboard",
78     "//components/os_crypt",
79     "//components/packed_ct_ev_whitelist",
80     "//components/pairing",
81     "//components/password_manager/content/browser",
82     "//components/password_manager/core/browser",
83     "//components/password_manager/core/common",
84     "//components/pdf/browser",
85     "//components/pdf/common",
86     "//components/pdf/renderer",
87     "//components/plugins/common",
88     "//components/plugins/renderer",
89     "//components/policy",
90     "//components/power",
91     "//components/precache/core",
92     "//components/precache/content",
93     "//components/proxy_config",
94     "//components/pref_registry",
95     "//components/query_parser",
96     "//components/rappor",
97     "//components/renderer_context_menu",
98     "//components/resources:components_resources",
99     "//components/search",
100     "//components/search_engines",
101     "//components/search_provider_logos",
102     "//components/security_interstitials/core",
103     "//components/sessions",
104     "//components/signin/core/browser",
105     "//components/startup_metric_utils",
106     "//components/strings",
107     "//components/sync_driver",
108     "//components/tracing",
109     "//components/tracing:startup_tracing",
110     "//components/translate/content/browser",
111     "//components/translate/content/common",
112     "//components/translate/content/renderer",
113     "//components/translate/core/browser",
114     "//components/translate/core/common",
115     "//components/ui/zoom",
116     "//components/undo",
117     "//components/update_client",
118     "//components/upload_list",
119     "//components/url_formatter",
120     "//components/url_matcher",
121     "//components/user_manager",
122     "//components/user_prefs",
123     "//components/user_prefs/tracked:user_prefs_tracked",
124     "//components/variations",
125     "//components/version_info",
126     "//components/visitedlink/browser",
127     "//components/visitedlink/common",
128     "//components/visitedlink/renderer",
129     "//components/wallpaper",
130     "//components/web_cache/browser",
131     "//components/web_cache/common",
132     "//components/web_cache/renderer",
133     "//components/web_modal",
134     "//components/web_resource",
135     "//components/webcrypto",
136     "//components/webdata/common",
137     "//components/wifi",
138     "//components/wifi_sync",
139   ]
141   if (!is_android) {
142     # TODO(agrieve): Add to main deps list once compile errors are resolved.
143     deps += [ "//components/devtools_service" ]
144   }
146   if (!is_android && !is_ios) {
147     deps += [
148       "//components/audio_modem",
149       "//components/proximity_auth",
150       "//components/proximity_auth/cryptauth",
151     ]
152   }
154   if (!enable_configuration_policy) {
155     deps -= [ "//components/policy" ]
156   }
158   if (!is_win && !is_mac) {
159     deps -= [ "//components/wifi" ]
160   }
161   if (!is_chromeos) {
162     deps -= [
163       "//components/pairing",
164       "//components/wifi_sync",
165     ]
166   }
168   if (!is_chromeos || !enable_extensions) {
169     deps -= [ "//components/chrome_apps" ]
170   }
172   if (is_ios) {
173     deps -= [
174       "//components/history/content/browser",
175       "//components/keyed_service/content",
176       "//components/network_hints/renderer",
177     ]
178   }
180   if (!enable_plugins) {
181     deps -= [
182       "//components/pdf/browser",
183       "//components/pdf/common",
184       "//components/pdf/renderer",
185     ]
186   }
188   if (is_android) {
189     deps -= [
190       "//components/autofill/content/browser",  # Blocked on content/blink.
191       "//components/autofill/content/common",  # Blocked on content.
192       "//components/autofill/content/renderer",  # Blocked on content/blink.
193       "//components/crash/app",  # Should work, needs checking.
194       "//components/crash/browser",  # Should work, needs checking.
195       "//components/captive_portal",  # Should work, needs checking.
196       "//components/cloud_devices/common",  # Should work, needs checking.
197       "//components/cdm/browser",  # Blocked on content.
198       "//components/cdm/common",  # Blocked on content.
199       "//components/cdm/renderer",  # Blocked on content.
200       "//components/data_reduction_proxy/core/browser",  # Should work, needs checking.
201       "//components/data_reduction_proxy/core/common",  # Should work, needs checking.
202       "//components/dom_distiller/core",  # Blocked on content.
203       "//components/domain_reliability",  # Blocked on content.
204       "//components/favicon/core",  # Blocked on keyed service.
205       "//components/favicon_base",  # Should work, needs checking.
206       "//components/feedback",  # Blocked on content.
207       "//components/google/core/browser",  # Should work, needs checking.
208       "//components/history/core/browser",  # Should work, needs checking.
209       "//components/history/core/common",  # Should work, needs checking.
210       "//components/history/core/test",  # Should work, needs checking.
211       "//components/infobars/core",  # Should work, needs checking.
212       "//components/invalidation/impl",  # Should work, needs checking.
213       "//components/json_schema",  # Should work, needs checking.
214       "//components/keyed_service/content",  # Blocked on content.
215       "//components/navigation_interception",  # Blocked on content.
216       "//components/omnibox/browser",  # Should work, needs checking.
217       "//components/password_manager/content/browser",  # Blocked on content.
218       "//components/password_manager/core/browser",  # Should work, needs checking.
219       "//components/password_manager/core/common",  # Should work, needs checking.
220       "//components/plugins/renderer",  # Blocked on blink.
221       "//components/power",  # Blocked on content.
222       "//components/policy",  # Blocked on content (indirectly via autofill).
223       "//components/precache/content",  # Blocked on content.
224       "//components/precache/core",  # Should work, needs checking.
225       "//components/rappor",  # Should work, needs checking.
226       "//components/renderer_context_menu",  # Blocked on content.
227       "//components/search_engines",  # Should work, needs checking.
228       "//components/search_provider_logos",  # Should work, needs checking.
229       "//components/sessions",  # Blocked on content.
230       "//components/signin/core/browser",  # Should work, needs checking.
231       "//components/translate/content/browser",  # Blocked on content.
232       "//components/translate/content/common",  # Blocked on content.
233       "//components/translate/content/renderer",  # Blocked on content.
234       "//components/user_prefs",  # Blocked on content.
235       "//components/visitedlink/browser",  # Blocked on content.
236       "//components/visitedlink/common",  # Blocked on content.
237       "//components/visitedlink/renderer",  # Blocked on blink
238       "//components/web_cache/browser",  # Blocked on content and blink.
239       "//components/web_cache/renderer",  # Blocked on content and blink.
240       "//components/web_modal",  # Blocked on content.
241     ]
242   }
244   if (!is_ios && !is_android) {
245     deps += [
246       "//components/copresence",
247       "//components/storage_monitor",
248     ]
249   }
251   if (!is_ios) {
252     deps += [
253       "//components/app_modal",
254       "//components/browsing_data",
255       "//components/guest_view/browser",
256       "//components/guest_view/common",
257       "//components/guest_view/renderer",
258       "//components/safe_json",
259       "//components/scheduler",
260       "//components/test_runner",
261     ]
262   }
264   if (toolkit_views) {
265     deps += [ "//components/constrained_window" ]
266   }
269 # TODO(GYP): Delete this after we've converted everything to GN.
270 # The _run targets exist only for compatibility w/ GYP.
271 group("components_unittests_run") {
272   testonly = true
273   deps = [
274     ":components_unittests",
275   ]
278 # To add a unit test to this target, make a "unit_test" source_set in your
279 # component (it's important to use a source_set instead of a static library or
280 # no tests will run) and add a reference here. You can add more than one unit
281 # test target if convenient.
282 test("components_unittests") {
283   sources = [
284     "test/run_all_unittests.cc",
285   ]
287   if (is_android || is_linux || is_mac || is_win) {
288     data = [
289       "test/data/",
291       # TODO(dpranke): Remove the next two lines after GN has rolled to 339778.
292       "$root_out_dir/components_tests_resources.pak",
293       "$root_out_dir/ui_test.pak",
294     ]
295   }
297   # Add only ":unit_tests" dependencies here. If your tests have dependencies
298   # (this would at least include the component itself), they should be on the
299   # test source set and not here.
300   deps = [
301     "//components/auto_login_parser:unit_tests",
302     "//components/autofill/content/browser:unit_tests",
303     "//components/autofill/core/browser:unit_tests",
304     "//components/autofill/core/common:unit_tests",
305     "//components/bookmarks/browser:unit_tests",
306     "//components/bookmarks/managed:unit_tests",
307     "//components/captive_portal:unit_tests",
308     "//components/cloud_devices/common:unit_tests",
309     "//components/component_updater:unit_tests",
310     "//components/content_settings/core/browser:unit_tests",
311     "//components/content_settings/core/common:unit_tests",
312     "//components/crx_file:unit_tests",
313     "//components/data_reduction_proxy/content/browser:unit_tests",
314     "//components/data_reduction_proxy/core/browser:unit_tests",
315     "//components/data_reduction_proxy/core/common:unit_tests",
316     "//components/device_event_log:unit_tests",
317     "//components/devtools_http_handler:unit_tests",
318     "//components/dom_distiller/content:unit_tests",
319     "//components/dom_distiller/core:unit_tests",
320     "//components/domain_reliability:unit_tests",
321     "//components/enhanced_bookmarks:unit_tests",
322     "//components/favicon/content:unit_tests",
323     "//components/favicon/core:unit_tests",
324     "//components/favicon_base:unit_tests",
325     "//components/gcm_driver/crypto:unit_tests",
326     "//components/gcm_driver/instance_id:unit_tests",
327     "//components/gcm_driver:unit_tests",
328     "//components/google/core/browser:unit_tests",
329     "//components/history/content/browser:unit_tests",
330     "//components/history/core/browser:unit_tests",
331     "//components/history/core/common:unit_tests",
332     "//components/invalidation/impl:unit_tests",
333     "//components/json_schema:unit_tests",
334     "//components/keyed_service/content:unit_tests",
335     "//components/keyed_service/core:unit_tests",
336     "//components/leveldb_proto:unit_tests",
337     "//components/login:unit_tests",
338     "//components/memory_pressure:unit_tests",
339     "//components/metrics:unit_tests",
340     "//components/mime_util:unit_tests",
341     "//components/offline_pages:unit_tests",
342     "//components/omnibox/browser:unit_tests",
343     "//components/open_from_clipboard:unit_tests",
344     "//components/packed_ct_ev_whitelist:unit_tests",
345     "//components/password_manager/content/browser:unit_tests",
346     "//components/password_manager/core/browser:unit_tests",
347     "//components/password_manager/core/common:unit_tests",
348     "//components/password_manager/sync/browser:unit_tests",
349     "//components/precache/content:unit_tests",
350     "//components/precache/core:unit_tests",
351     "//components/proxy_config:unit_tests",
352     "//components/query_parser:unit_tests",
353     "//components/rappor:unit_tests",
354     "//components/search:unit_tests",
355     "//components/search_engines:unit_tests",
356     "//components/search_provider_logos:unit_tests",
357     "//components/signin/core/browser:unit_tests",
358     "//components/suggestions:unit_tests",
359     "//components/sync_driver:unit_tests",
360     "//components/translate/core/browser:unit_tests",
361     "//components/translate/core/common:unit_tests",
362     "//components/translate/core/language_detection:unit_tests",
363     "//components/undo:unit_tests",
364     "//components/url_formatter:unit_tests",
365     "//components/url_matcher:unit_tests",
366     "//components/update_client:unit_tests",
367     "//components/upload_list:unit_tests",
368     "//components/user_prefs/tracked:unit_tests",
369     "//components/variations:unit_tests",
370     "//components/web_resource:unit_tests",
371     "//components/webcrypto:unit_tests",
372     "//components/webdata/common:unit_tests",
374     # These are the deps required by the code in this target.
375     "//base",
376     "//base/test:test_support",
377     "//components/policy:policy_component",
378     "//content/test:test_support",
379     "//net",
380     "//ui/base",
381     "//ui/resources:ui_test_pak",
382   ]
384   data_deps = [
385     ":components_tests_pak",
386     "//third_party/mesa:osmesa",
387     "//ui/resources:ui_test_pak",
388   ]
390   if (enable_rlz_support) {
391     deps += [ "//components/rlz:unit_tests" ]
392   }
394   if (is_android) {
395     isolate_file = "components_unittests.isolate"
397     deps += [ "//content/public/android:content_java" ]
398     deps -= [
399       "//components/gcm_driver:unit_tests",
400       "//components/gcm_driver/instance_id:unit_tests",
401       "//components/password_manager/content/browser:unit_tests",
402       "//components/password_manager/core/browser:unit_tests",
403       "//components/password_manager/core/common:unit_tests",
404       "//components/password_manager/sync/browser:unit_tests",
405     ]
406   }
408   if (!is_android && !is_ios) {
409     deps += [
410       "//components/audio_modem:unit_tests",
411       "//components/copresence:unit_tests",
412       "//components/feedback:unit_tests",
413       "//components/proximity_auth:unit_tests",
414       "//components/sessions:unit_tests",
415       "//components/storage_monitor:unit_tests",
416     ]
417   }
419   if (is_chromeos) {
420     deps += [ "//components/ownership:unit_tests" ]
421   }
423   # TODO(GYP) need this target.
424   #'breakpad/app/crash_keys_win_unittest.cc',
426   # Precache tests need these defines.
427   #configs += [ "//components/precache/core:precache_config" ]
429   if (enable_configuration_policy) {
430     deps += [
431       "//components/policy/core/browser:unit_tests",
432       "//components/policy/core/common:unit_tests",
433     ]
434   }
436   if (toolkit_views) {
437     # TODO bug 522654 Enable this when the undefined symbol is fixed in
438     # web_modal such that this links.
439     #deps += [ "//components/constrained_window:unit_tests" ]
440   }
441   if (is_win) {
442     deps += [ "//components/browser_watcher:unit_tests" ]
443   }
444   if (is_ios) {
445     deps += [ "//components/signin/core/browser:unit_tests" ]
446     deps -= [ "//components/devtools_http_handler:unit_tests" ]
447   } else {
448     # Non-iOS tests.
449     deps += [
450       "//components/error_page/renderer:unit_tests",
451       "//components/guest_view/browser:unit_tests",
452       "//components/navigation_interception:unit_tests",
453       "//components/network_hints/renderer:unit_tests",
454       "//components/safe_json:unit_tests",
455       "//components/scheduler:unit_tests",
456       "//components/visitedlink/test:unit_tests",
457       "//components/web_cache/browser:unit_tests",
458     ]
459   }
461   if (enable_basic_printing || enable_print_preview) {
462     deps += [
463       "//components/printing/browser",
464       "//components/printing/common",
465       "//components/printing/renderer",
466     ]
467   }
470 repack("components_tests_pak") {
471   sources = [
472     "$root_gen_dir/components/components_resources.pak",
473     "$root_gen_dir/components/strings/components_strings_en-US.pak",
474   ]
476   output = "$root_out_dir/components_tests_resources.pak"
478   deps = [
479     "//components/resources",
480     "//components/strings",
481   ]
484 # TODO(GYP): Delete this after we've converted everything to GN.
485 # The _run targets exist only for compatibility w/ GYP.
486 group("components_browsertests_run") {
487   testonly = true
488   deps = [
489     ":components_browsertests",
490   ]
493 test("components_browsertests") {
494   sources = [
495     "autofill/content/browser/risk/fingerprint_browsertest.cc",
496     "autofill/content/renderer/password_form_conversion_utils_browsertest.cc",
497     "dom_distiller/content/browser/distillable_page_utils_browsertest.cc",
498     "dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc",
499     "dom_distiller/content/browser/test/dom_distiller_js_browsertest.cc",
500     "password_manager/content/renderer/credential_manager_client_browsertest.cc",
501   ]
503   data = [
504     "$root_out_dir/components_tests_resources.pak",
505     "$root_out_dir/content_shell.pak",
506   ]
508   if (is_android || is_linux || is_mac || is_win) {
509     data += [
510       "test/data/",
511       "dom_distiller/core/javascript/",
512       "//third_party/dom_distiller_js/dist/test/data/",
513     ]
514   }
516   if (is_mac) {
517     data += [ "$root_out_dir/Content Shell.app/" ]
518   }
520   defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
522   deps = [
523     "autofill/content/browser",
524     "autofill/content/renderer",
525     "content_settings/core/common",
526     "dom_distiller/content:content_browser",
527     "dom_distiller/core",
528     "dom_distiller/core:test_support",
529     "password_manager/content/browser",
530     "password_manager/content/common",
531     "password_manager/content/renderer",
532     "strings",
533     "//base",
534     "//base/test:test_support",
535     "//content/test:browsertest_support",
536     "//content/test:test_support",
537     "//device/bluetooth",
538     "//testing/gmock",
539     "//testing/gtest",
540     "//ui/base",
541   ]
543   data_deps = [
544     ":components_tests_pak",
545     "//third_party/mesa:osmesa",
546   ]
548   if (is_android) {
549     sources += [ "test/android/browsertests_apk/components_browser_tests_jni_onload.cc" ]
550     sources -= [ "autofill/content/browser/risk/fingerprint_browsertest.cc" ]
551     deps += [ "//testing/android/native_test:native_test_support" ]
552     use_launcher = false
553     isolate_file = "components_browsertests.isolate"
554   }
556   if (is_linux) {
557     # content_extractor_browsertest is a standalone content extraction tool built as
558     # a MANUAL component_browsertest.
559     sources += [ "dom_distiller/standalone/content_extractor_browsertest.cc" ]
560     deps += [
561       "pref_registry:test_support",
562       "//base:prefs_test_support",
563     ]
564   }
566   if (enable_basic_printing || enable_print_preview) {
567     sources += [ "printing/test/print_web_view_helper_browsertest.cc" ]
568     deps += [ "//components/printing/test:test_support" ]
569   }
572 test("components_perftests") {
573   sources = [
574     "scheduler/child/task_queue_manager_perftest.cc",
575     "visitedlink/test/visitedlink_perftest.cc",
576   ]
578   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
579   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
581   deps = [
582     "//base",
583     "//base/test:test_support_perf",
584     "//testing/gtest",
585     "//testing/perf",
586     "//content/test:test_support",
587     "//components/visitedlink/browser",
588   ]