Roll src/third_party/WebKit e0ce2a6:675d715 (svn 202297:202300)
[chromium-blink-merge.git] / components / BUILD.gn
blob124014b9d7ab1ca0f0f91c04135aa005e69164d5
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/bubble",
27     "//components/captive_portal",
28     "//components/cdm/browser",
29     "//components/cdm/common",
30     "//components/cdm/renderer",
31     "//components/certificate_reporting",
32     "//components/cloud_devices/common",
33     "//components/chrome_apps",
34     "//components/component_updater",
35     "//components/compression",
36     "//components/content_settings/core/browser",
37     "//components/content_settings/core/common",
38     "//components/crash/app",
39     "//components/crash/browser",
40     "//components/crx_file",
41     "//components/data_reduction_proxy/core/browser",
42     "//components/data_reduction_proxy/core/common",
43     "//components/device_event_log",
44     "//components/devtools_discovery",
45     "//components/devtools_http_handler",
46     "//components/dom_distiller/core",
47     "//components/domain_reliability",
48     "//components/enhanced_bookmarks",
49     "//components/favicon/core",
50     "//components/favicon_base",
51     "//components/feedback",
52     "//components/gcm_driver",
53     "//components/gcm_driver/crypto",
54     "//components/gcm_driver/instance_id",
55     "//components/google/core/browser",
56     "//components/history/content/browser",
57     "//components/history/core/browser",
58     "//components/history/core/common",
59     "//components/history/core/test",
60     "//components/infobars/core",
61     "//components/invalidation/impl",
62     "//components/json_schema",
63     "//components/keyed_service/content",
64     "//components/language_usage_metrics",
65     "//components/leveldb_proto",
66     "//components/login",
67     "//components/memory_pressure",
68     "//components/metrics",
69     "//components/mime_util",
70     "//components/navigation_interception",
71     "//components/navigation_metrics",
72     "//components/network_hints/browser",
73     "//components/network_hints/common",
74     "//components/network_hints/renderer",
75     "//components/network_time",
76     "//components/offline_pages",
77     "//components/omnibox/browser",
78     "//components/onc",
79     "//components/open_from_clipboard",
80     "//components/os_crypt",
81     "//components/packed_ct_ev_whitelist",
82     "//components/pairing",
83     "//components/password_manager/content/browser",
84     "//components/password_manager/core/browser",
85     "//components/password_manager/core/common",
86     "//components/pdf/browser",
87     "//components/pdf/common",
88     "//components/pdf/renderer",
89     "//components/plugins/common",
90     "//components/plugins/renderer",
91     "//components/policy",
92     "//components/power",
93     "//components/precache/core",
94     "//components/precache/content",
95     "//components/proxy_config",
96     "//components/pref_registry",
97     "//components/query_parser",
98     "//components/rappor",
99     "//components/renderer_context_menu",
100     "//components/resources:components_resources",
101     "//components/search",
102     "//components/search_engines",
103     "//components/search_provider_logos",
104     "//components/security_interstitials/core",
105     "//components/sessions",
106     "//components/signin/core/browser",
107     "//components/startup_metric_utils",
108     "//components/strings",
109     "//components/sync_driver",
110     "//components/tracing",
111     "//components/tracing:startup_tracing",
112     "//components/translate/content/browser",
113     "//components/translate/content/common",
114     "//components/translate/content/renderer",
115     "//components/translate/core/browser",
116     "//components/translate/core/common",
117     "//components/ui/zoom",
118     "//components/undo",
119     "//components/update_client",
120     "//components/upload_list",
121     "//components/url_formatter",
122     "//components/url_matcher",
123     "//components/user_manager",
124     "//components/user_prefs",
125     "//components/user_prefs/tracked:user_prefs_tracked",
126     "//components/variations",
127     "//components/variations/service",
128     "//components/version_info",
129     "//components/visitedlink/browser",
130     "//components/visitedlink/common",
131     "//components/visitedlink/renderer",
132     "//components/wallpaper",
133     "//components/web_cache/browser",
134     "//components/web_cache/common",
135     "//components/web_cache/renderer",
136     "//components/web_modal",
137     "//components/web_resource",
138     "//components/webdata/common",
139     "//components/wifi",
140     "//components/wifi_sync",
141   ]
143   if (!is_android && !is_ios) {
144     deps += [
145       "//components/audio_modem",
146       "//components/proximity_auth",
147       "//components/proximity_auth/cryptauth",
148       "//components/webusb",
149     ]
150   }
152   if (!enable_configuration_policy) {
153     deps -= [ "//components/policy" ]
154   }
156   if (!is_win && !is_mac) {
157     deps -= [ "//components/wifi" ]
158   }
159   if (!is_chromeos) {
160     deps -= [
161       "//components/pairing",
162       "//components/wifi_sync",
163     ]
164   }
166   if (!is_chromeos || !enable_extensions) {
167     deps -= [ "//components/chrome_apps" ]
168   }
170   if (is_ios) {
171     deps -= [
172       "//components/history/content/browser",
173       "//components/keyed_service/content",
174       "//components/network_hints/renderer",
175     ]
176   }
178   if (!enable_plugins) {
179     deps -= [
180       "//components/pdf/browser",
181       "//components/pdf/common",
182       "//components/pdf/renderer",
183     ]
184   }
186   if (is_android) {
187     deps -= [
188       "//components/autofill/content/browser",  # Blocked on content/blink.
189       "//components/autofill/content/common",  # Blocked on content.
190       "//components/autofill/content/renderer",  # Blocked on content/blink.
191       "//components/crash/app",  # Should work, needs checking.
192       "//components/crash/browser",  # Should work, needs checking.
193       "//components/captive_portal",  # Should work, needs checking.
194       "//components/cloud_devices/common",  # Should work, needs checking.
195       "//components/cdm/browser",  # Blocked on content.
196       "//components/cdm/common",  # Blocked on content.
197       "//components/cdm/renderer",  # Blocked on content.
198       "//components/data_reduction_proxy/core/browser",  # Should work, needs checking.
199       "//components/data_reduction_proxy/core/common",  # Should work, needs checking.
200       "//components/dom_distiller/core",  # Blocked on content.
201       "//components/domain_reliability",  # Blocked on content.
202       "//components/favicon/core",  # Blocked on keyed service.
203       "//components/favicon_base",  # Should work, needs checking.
204       "//components/feedback",  # Blocked on content.
205       "//components/google/core/browser",  # Should work, needs checking.
206       "//components/history/core/browser",  # Should work, needs checking.
207       "//components/history/core/common",  # Should work, needs checking.
208       "//components/history/core/test",  # Should work, needs checking.
209       "//components/infobars/core",  # Should work, needs checking.
210       "//components/invalidation/impl",  # Should work, needs checking.
211       "//components/json_schema",  # Should work, needs checking.
212       "//components/keyed_service/content",  # Blocked on content.
213       "//components/navigation_interception",  # Blocked on content.
214       "//components/omnibox/browser",  # Should work, needs checking.
215       "//components/password_manager/content/browser",  # Blocked on content.
216       "//components/password_manager/core/browser",  # Should work, needs checking.
217       "//components/password_manager/core/common",  # Should work, needs checking.
218       "//components/plugins/renderer",  # Blocked on blink.
219       "//components/power",  # Blocked on content.
220       "//components/policy",  # Blocked on content (indirectly via autofill).
221       "//components/precache/content",  # Blocked on content.
222       "//components/precache/core",  # Should work, needs checking.
223       "//components/rappor",  # Should work, needs checking.
224       "//components/renderer_context_menu",  # Blocked on content.
225       "//components/search_engines",  # Should work, needs checking.
226       "//components/search_provider_logos",  # Should work, needs checking.
227       "//components/sessions",  # Blocked on content.
228       "//components/signin/core/browser",  # Should work, needs checking.
229       "//components/translate/content/browser",  # Blocked on content.
230       "//components/translate/content/common",  # Blocked on content.
231       "//components/translate/content/renderer",  # Blocked on content.
232       "//components/user_prefs",  # Blocked on content.
233       "//components/visitedlink/browser",  # Blocked on content.
234       "//components/visitedlink/common",  # Blocked on content.
235       "//components/visitedlink/renderer",  # Blocked on blink
236       "//components/web_cache/browser",  # Blocked on content and blink.
237       "//components/web_cache/renderer",  # Blocked on content and blink.
238       "//components/web_modal",  # Blocked on content.
239     ]
240   }
242   if (!is_ios && !is_android) {
243     deps += [
244       "//components/copresence",
245       "//components/storage_monitor",
246     ]
247   }
249   if (!is_ios) {
250     deps += [
251       "//components/app_modal",
252       "//components/browsing_data",
253       "//components/certificate_transparency",
254       "//components/guest_view/browser",
255       "//components/guest_view/common",
256       "//components/guest_view/renderer",
257       "//components/safe_json",
258       "//components/scheduler",
259       "//components/test_runner",
260       "//components/webcrypto",
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/content/renderer:unit_tests",
304     "//components/autofill/core/browser:unit_tests",
305     "//components/autofill/core/common:unit_tests",
306     "//components/bookmarks/browser:unit_tests",
307     "//components/bookmarks/managed:unit_tests",
308     "//components/bubble:unit_tests",
309     "//components/captive_portal:unit_tests",
310     "//components/certificate_transparency:unit_tests",
311     "//components/cloud_devices/common:unit_tests",
312     "//components/component_updater:unit_tests",
313     "//components/content_settings/core/browser:unit_tests",
314     "//components/content_settings/core/common:unit_tests",
315     "//components/crx_file:unit_tests",
316     "//components/data_reduction_proxy/content/browser:unit_tests",
317     "//components/data_reduction_proxy/core/browser:unit_tests",
318     "//components/data_reduction_proxy/core/common:unit_tests",
319     "//components/device_event_log:unit_tests",
320     "//components/devtools_http_handler:unit_tests",
321     "//components/dom_distiller/content:unit_tests",
322     "//components/dom_distiller/core:unit_tests",
323     "//components/domain_reliability:unit_tests",
324     "//components/enhanced_bookmarks:unit_tests",
325     "//components/favicon/content:unit_tests",
326     "//components/favicon/core:unit_tests",
327     "//components/favicon_base:unit_tests",
328     "//components/gcm_driver/crypto:unit_tests",
329     "//components/gcm_driver/instance_id:unit_tests",
330     "//components/gcm_driver:unit_tests",
331     "//components/google/core/browser:unit_tests",
332     "//components/history/content/browser:unit_tests",
333     "//components/history/core/browser:unit_tests",
334     "//components/history/core/common:unit_tests",
335     "//components/invalidation/impl:unit_tests",
336     "//components/json_schema:unit_tests",
337     "//components/keyed_service/content:unit_tests",
338     "//components/keyed_service/core:unit_tests",
339     "//components/language_usage_metrics:unit_tests",
340     "//components/leveldb_proto:unit_tests",
341     "//components/login:unit_tests",
342     "//components/memory_pressure:unit_tests",
343     "//components/metrics:unit_tests",
344     "//components/mime_util:unit_tests",
345     "//components/network_time:unit_tests",
346     "//components/offline_pages:unit_tests",
347     "//components/omnibox/browser:unit_tests",
348     "//components/open_from_clipboard:unit_tests",
349     "//components/os_crypt:unit_tests",
350     "//components/packed_ct_ev_whitelist:unit_tests",
351     "//components/password_manager/content/browser:unit_tests",
352     "//components/password_manager/core/browser:unit_tests",
353     "//components/password_manager/core/common:unit_tests",
354     "//components/password_manager/sync/browser:unit_tests",
355     "//components/precache/content:unit_tests",
356     "//components/precache/core:unit_tests",
357     "//components/proxy_config:unit_tests",
358     "//components/query_parser:unit_tests",
359     "//components/rappor:unit_tests",
360     "//components/search:unit_tests",
361     "//components/search_engines:unit_tests",
362     "//components/search_provider_logos:unit_tests",
363     "//components/signin/core/browser:unit_tests",
364     "//components/suggestions:unit_tests",
365     "//components/sync_driver:unit_tests",
366     "//components/translate/core/browser:unit_tests",
367     "//components/translate/core/common:unit_tests",
368     "//components/translate/core/language_detection:unit_tests",
369     "//components/undo:unit_tests",
370     "//components/url_formatter:unit_tests",
371     "//components/url_matcher:unit_tests",
372     "//components/update_client:unit_tests",
373     "//components/upload_list:unit_tests",
374     "//components/user_prefs/tracked:unit_tests",
375     "//components/variations:unit_tests",
376     "//components/variations/service:unit_tests",
377     "//components/wallpaper:unit_tests",
378     "//components/web_resource:unit_tests",
379     "//components/webcrypto:unit_tests",
380     "//components/webdata/common:unit_tests",
382     # These are the deps required by the code in this target.
383     "//base",
384     "//base/test:test_support",
385     "//components/policy:policy_component",
386     "//content/test:test_support",
387     "//net",
388     "//ui/base",
389     "//ui/resources:ui_test_pak",
390   ]
392   data_deps = [
393     ":components_tests_pak",
394     "//third_party/mesa:osmesa",
395     "//ui/resources:ui_test_pak",
396   ]
398   if (enable_rlz_support) {
399     deps += [ "//components/rlz:unit_tests" ]
400   }
402   if (is_android) {
403     isolate_file = "components_unittests.isolate"
405     deps += [ "//content/public/android:content_java" ]
406     deps -= [
407       "//components/gcm_driver:unit_tests",
408       "//components/gcm_driver/instance_id:unit_tests",
409       "//components/password_manager/content/browser:unit_tests",
410       "//components/password_manager/core/browser:unit_tests",
411       "//components/password_manager/core/common:unit_tests",
412       "//components/password_manager/sync/browser:unit_tests",
413     ]
414   }
416   if (!is_android && !is_ios) {
417     deps += [
418       "//components/audio_modem:unit_tests",
419       "//components/copresence:unit_tests",
420       "//components/feedback:unit_tests",
421       "//components/proximity_auth:unit_tests",
422       "//components/sessions:unit_tests",
423       "//components/storage_monitor:unit_tests",
424       "//components/tracing:unit_tests",
425       "//components/webusb:unit_tests",
426     ]
427   }
429   if (is_chromeos) {
430     deps += [ "//components/ownership:unit_tests" ]
431   }
433   # TODO(GYP) need this target.
434   #'breakpad/app/crash_keys_win_unittest.cc',
436   if (enable_configuration_policy) {
437     deps += [
438       "//components/policy/core/browser:unit_tests",
439       "//components/policy/core/common:unit_tests",
440     ]
441   }
443   if (toolkit_views) {
444     # TODO bug 522654 Enable this when the undefined symbol is fixed in
445     # web_modal such that this links.
446     #deps += [ "//components/constrained_window:unit_tests" ]
447   }
448   if (is_win) {
449     deps += [ "//components/browser_watcher:unit_tests" ]
450   }
451   if (is_ios) {
452     deps += [ "//components/signin/core/browser:unit_tests" ]
453     deps -= [ "//components/devtools_http_handler:unit_tests" ]
454   } else {
455     # Non-iOS tests.
456     deps += [
457       "//components/error_page/renderer:unit_tests",
458       "//components/guest_view/browser:unit_tests",
459       "//components/navigation_interception:unit_tests",
460       "//components/network_hints/renderer:unit_tests",
461       "//components/power:unit_tests",
462       "//components/safe_json:unit_tests",
463       "//components/scheduler:unit_tests",
464       "//components/test_runner:test_runner",
465       "//components/ui/zoom:unit_tests",
466       "//components/visitedlink/test:unit_tests",
467       "//components/web_cache/browser:unit_tests",
468     ]
469   }
471   if (enable_basic_printing || enable_print_preview) {
472     deps += [
473       "//components/printing/browser",
474       "//components/printing/common",
475       "//components/printing/renderer",
476     ]
477   }
480 repack("components_tests_pak") {
481   sources = [
482     "$root_gen_dir/components/components_resources.pak",
483     "$root_gen_dir/components/strings/components_strings_en-US.pak",
484   ]
486   output = "$root_out_dir/components_tests_resources.pak"
488   deps = [
489     "//components/resources",
490     "//components/strings",
491   ]
494 # TODO(GYP): Delete this after we've converted everything to GN.
495 # The _run targets exist only for compatibility w/ GYP.
496 group("components_browsertests_run") {
497   testonly = true
498   deps = [
499     ":components_browsertests",
500   ]
503 test("components_browsertests") {
504   sources = [
505     "autofill/content/browser/risk/fingerprint_browsertest.cc",
506     "autofill/content/renderer/password_form_conversion_utils_browsertest.cc",
507     "dom_distiller/content/browser/distillable_page_utils_browsertest.cc",
508     "dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc",
509     "dom_distiller/content/browser/test/dom_distiller_js_browsertest.cc",
510     "password_manager/content/renderer/credential_manager_client_browsertest.cc",
511   ]
513   data = [
514     "$root_out_dir/components_tests_resources.pak",
515     "$root_out_dir/content_shell.pak",
516   ]
518   if (is_android || is_linux || is_mac || is_win) {
519     data += [
520       "test/data/",
521       "dom_distiller/core/javascript/",
522       "//third_party/dom_distiller_js/dist/test/data/",
523     ]
524   }
526   if (is_mac) {
527     data += [ "$root_out_dir/Content Shell.app/" ]
528   }
530   defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
532   deps = [
533     "autofill/content/browser",
534     "autofill/content/renderer",
535     "content_settings/core/common",
536     "dom_distiller/content:content_browser",
537     "dom_distiller/core",
538     "dom_distiller/core:test_support",
539     "password_manager/content/browser",
540     "password_manager/content/common",
541     "password_manager/content/renderer",
542     "strings",
543     "//base",
544     "//base/test:test_support",
545     "//content/test:browsertest_support",
546     "//content/test:test_support",
547     "//device/bluetooth",
548     "//testing/gmock",
549     "//testing/gtest",
550     "//ui/base",
551   ]
553   data_deps = [
554     ":components_tests_pak",
555     "//third_party/mesa:osmesa",
556   ]
558   if (is_android) {
559     sources += [ "test/android/browsertests_apk/components_browser_tests_jni_onload.cc" ]
560     sources -= [ "autofill/content/browser/risk/fingerprint_browsertest.cc" ]
561     deps += [ "//testing/android/native_test:native_test_support" ]
562     use_launcher = false
563     isolate_file = "components_browsertests.isolate"
564   }
566   if (is_linux) {
567     # content_extractor_browsertest is a standalone content extraction tool built as
568     # a MANUAL component_browsertest.
569     sources += [ "dom_distiller/standalone/content_extractor_browsertest.cc" ]
570     deps += [
571       "pref_registry:test_support",
572       "//base:prefs_test_support",
573     ]
574   }
576   if (enable_basic_printing || enable_print_preview) {
577     sources += [ "printing/test/print_web_view_helper_browsertest.cc" ]
578     deps += [ "//components/printing/test:test_support" ]
579   }
582 test("components_perftests") {
583   sources = [
584     "scheduler/child/task_queue_manager_perftest.cc",
585     "visitedlink/test/visitedlink_perftest.cc",
586   ]
588   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
589   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
591   deps = [
592     "//base",
593     "//base/test:test_support_perf",
594     "//testing/gtest",
595     "//testing/perf",
596     "//content/test:test_support",
597     "//components/visitedlink/browser",
598   ]