Fix content verifier problem with content scripts (reland)
[chromium-blink-merge.git] / components / BUILD.gn
blob0d0951b41952b957fdbfe45ab41d4a8093af93ff
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/auto_login_parser",
18     "//components/autofill/content/browser",
19     "//components/autofill/content/common",
20     "//components/autofill/content/renderer",
21     "//components/bookmarks/browser",
22     "//components/bookmarks/common",
23     "//components/bookmarks/managed",
24     "//components/bookmarks/test",
25     "//components/captive_portal",
26     "//components/cdm/browser",
27     "//components/cdm/common",
28     "//components/cdm/renderer",
29     "//components/cloud_devices/common",
30     "//components/chrome_apps",
31     "//components/component_updater",
32     "//components/content_settings/core/browser",
33     "//components/content_settings/core/common",
34     "//components/crash/app",
35     "//components/crash/browser",
36     "//components/crx_file",
37     "//components/data_reduction_proxy/core/browser",
38     "//components/data_reduction_proxy/core/common",
39     "//components/device_event_log",
40     "//components/devtools_discovery",
41     "//components/devtools_http_handler",
42     "//components/dom_distiller/core",
43     "//components/domain_reliability",
44     "//components/enhanced_bookmarks",
45     "//components/favicon/core",
46     "//components/favicon_base",
47     "//components/feedback",
48     "//components/gcm_driver",
49     "//components/gcm_driver/crypto",
50     "//components/gcm_driver/instance_id",
51     "//components/google/core/browser",
52     "//components/history/content/browser",
53     "//components/history/core/browser",
54     "//components/history/core/common",
55     "//components/history/core/test",
56     "//components/infobars/core",
57     "//components/invalidation/impl",
58     "//components/json_schema",
59     "//components/keyed_service/content",
60     "//components/language_usage_metrics",
61     "//components/leveldb_proto",
62     "//components/login",
63     "//components/metrics",
64     "//components/mime_util",
65     "//components/navigation_interception",
66     "//components/navigation_metrics",
67     "//components/network_time",
68     "//components/offline_pages",
69     "//components/omnibox/browser",
70     "//components/onc",
71     "//components/os_crypt",
72     "//components/packed_ct_ev_whitelist",
73     "//components/pairing",
74     "//components/password_manager/content/browser",
75     "//components/password_manager/core/browser",
76     "//components/password_manager/core/common",
77     "//components/pdf/browser",
78     "//components/pdf/common",
79     "//components/pdf/renderer",
80     "//components/plugins/common",
81     "//components/plugins/renderer",
82     "//components/policy",
83     "//components/power",
84     "//components/precache/core",
85     "//components/precache/content",
86     "//components/proxy_config",
87     "//components/pref_registry",
88     "//components/query_parser",
89     "//components/rappor",
90     "//components/renderer_context_menu",
91     "//components/resources:components_resources",
92     "//components/search",
93     "//components/search_engines",
94     "//components/search_provider_logos",
95     "//components/secure_display",
96     "//components/security_interstitials/core",
97     "//components/sessions",
98     "//components/signin/core/browser",
99     "//components/startup_metric_utils",
100     "//components/strings",
101     "//components/sync_driver",
102     "//components/tracing",
103     "//components/tracing:startup_tracing",
104     "//components/translate/content/browser",
105     "//components/translate/content/common",
106     "//components/translate/content/renderer",
107     "//components/translate/core/browser",
108     "//components/translate/core/common",
109     "//components/ui/zoom:ui_zoom",
110     "//components/undo",
111     "//components/update_client",
112     "//components/url_fixer",
113     "//components/url_matcher",
114     "//components/user_manager",
115     "//components/user_prefs",
116     "//components/variations",
117     "//components/version_info",
118     "//components/visitedlink/browser",
119     "//components/visitedlink/common",
120     "//components/visitedlink/renderer",
121     "//components/wallpaper",
122     "//components/web_cache/browser",
123     "//components/web_cache/common",
124     "//components/web_cache/renderer",
125     "//components/web_modal",
126     "//components/web_resource",
127     "//components/webcrypto",
128     "//components/webdata/common",
129     "//components/wifi",
130     "//components/wifi_sync",
131   ]
133   if (!is_android) {
134     # TODO(agrieve): Add to main deps list once compile errors are resolved.
135     deps += [ "//components/devtools_service" ]
136   }
138   if (!is_android && !is_ios) {
139     deps += [
140       "//components/proximity_auth",
141       "//components/proximity_auth/cryptauth",
142     ]
143   }
145   if (!enable_configuration_policy) {
146     deps -= [ "//components/policy" ]
147   }
149   if (!is_win && !is_mac) {
150     deps -= [ "//components/wifi" ]
151   }
152   if (!is_chromeos) {
153     deps -= [
154       "//components/pairing",
155       "//components/wifi_sync",
156     ]
157   }
159   if (!is_chromeos || !enable_extensions) {
160     deps -= [ "//components/chrome_apps" ]
161   }
163   if (is_ios) {
164     deps -= [
165       "//components/history/content/browser",
166       "//components/keyed_service/content",
167     ]
168   }
170   if (!enable_plugins) {
171     deps -= [
172       "//components/pdf/browser",
173       "//components/pdf/common",
174       "//components/pdf/renderer",
175     ]
176   }
178   if (is_android) {
179     deps -= [
180       "//components/autofill/content/browser",  # Blocked on content/blink.
181       "//components/autofill/content/common",  # Blocked on content.
182       "//components/autofill/content/renderer",  # Blocked on content/blink.
183       "//components/crash/app",  # Should work, needs checking.
184       "//components/crash/browser",  # Should work, needs checking.
185       "//components/captive_portal",  # Should work, needs checking.
186       "//components/cloud_devices/common",  # Should work, needs checking.
187       "//components/cdm/browser",  # Blocked on content.
188       "//components/cdm/common",  # Blocked on content.
189       "//components/cdm/renderer",  # Blocked on content.
190       "//components/data_reduction_proxy/core/browser",  # Should work, needs checking.
191       "//components/data_reduction_proxy/core/common",  # Should work, needs checking.
192       "//components/dom_distiller/core",  # Blocked on content.
193       "//components/domain_reliability",  # Blocked on content.
194       "//components/favicon/core",  # Blocked on keyed service.
195       "//components/favicon_base",  # Should work, needs checking.
196       "//components/feedback",  # Blocked on content.
197       "//components/google/core/browser",  # Should work, needs checking.
198       "//components/history/core/browser",  # Should work, needs checking.
199       "//components/history/core/common",  # Should work, needs checking.
200       "//components/history/core/test",  # Should work, needs checking.
201       "//components/infobars/core",  # Should work, needs checking.
202       "//components/invalidation/impl",  # Should work, needs checking.
203       "//components/json_schema",  # Should work, needs checking.
204       "//components/keyed_service/content",  # Blocked on content.
205       "//components/navigation_interception",  # Blocked on content.
206       "//components/omnibox/browser",  # Should work, needs checking.
207       "//components/password_manager/content/browser",  # Blocked on content.
208       "//components/password_manager/core/browser",  # Should work, needs checking.
209       "//components/password_manager/core/common",  # Should work, needs checking.
210       "//components/plugins/renderer",  # Blocked on blink.
211       "//components/power",  # Blocked on content.
212       "//components/policy",  # Blocked on content (indirectly via autofill).
213       "//components/precache/content",  # Blocked on content.
214       "//components/precache/core",  # Should work, needs checking.
215       "//components/rappor",  # Should work, needs checking.
216       "//components/renderer_context_menu",  # Blocked on content.
217       "//components/search_engines",  # Should work, needs checking.
218       "//components/search_provider_logos",  # Should work, needs checking.
219       "//components/sessions",  # Blocked on content.
220       "//components/signin/core/browser",  # Should work, needs checking.
221       "//components/translate/content/browser",  # Blocked on content.
222       "//components/translate/content/common",  # Blocked on content.
223       "//components/translate/content/renderer",  # Blocked on content.
224       "//components/user_prefs",  # Blocked on content.
225       "//components/visitedlink/browser",  # Blocked on content.
226       "//components/visitedlink/common",  # Blocked on content.
227       "//components/visitedlink/renderer",  # Blocked on blink
228       "//components/web_cache/browser",  # Blocked on content and blink.
229       "//components/web_cache/renderer",  # Blocked on content and blink.
230       "//components/web_modal",  # Blocked on content.
231     ]
232   }
234   if (!is_ios && !is_android) {
235     deps += [
236       "//components/copresence",
237       "//components/storage_monitor",
238     ]
239   }
241   if (!is_ios) {
242     deps += [
243       "//components/app_modal",
244       "//components/browsing_data",
245       "//components/guest_view/browser",
246       "//components/guest_view/common",
247       "//components/guest_view/renderer",
248       "//components/safe_json",
249       "//components/scheduler",
250       "//components/test_runner",
251     ]
252   }
254   if (toolkit_views) {
255     deps += [ "//components/constrained_window" ]
256   }
259 # TODO(GYP): Delete this after we've converted everything to GN.
260 # The _run targets exist only for compatibility w/ GYP.
261 group("components_unittests_run") {
262   testonly = true
263   deps = [
264     ":components_unittests",
265   ]
268 # To add a unit test to this target, make a "unit_test" source_set in your
269 # component (it's important to use a source_set instead of a static library or
270 # no tests will run) and add a reference here. You can add more than one unit
271 # test target if convenient.
272 test("components_unittests") {
273   sources = [
274     "test/run_all_unittests.cc",
275   ]
277   if (is_android || is_linux || is_mac || is_win) {
278     data = [
279       "test/data/",
281       # TODO(dpranke): Remove the next two lines after GN has rolled to 339778.
282       "$root_out_dir/components_tests_resources.pak",
283       "$root_out_dir/ui_test.pak",
284     ]
285   }
287   # Add only ":unit_tests" dependencies here. If your tests have dependencies
288   # (this would at least include the component itself), they should be on the
289   # test source set and not here.
290   deps = [
291     "//components/auto_login_parser:unit_tests",
292     "//components/autofill/content/browser:unit_tests",
293     "//components/autofill/core/browser:unit_tests",
294     "//components/autofill/core/common:unit_tests",
295     "//components/bookmarks/browser:unit_tests",
296     "//components/bookmarks/managed:unit_tests",
297     "//components/captive_portal:unit_tests",
298     "//components/cloud_devices/common:unit_tests",
299     "//components/component_updater:unit_tests",
300     "//components/content_settings/core/browser:unit_tests",
301     "//components/content_settings/core/common:unit_tests",
302     "//components/crx_file:unit_tests",
303     "//components/data_reduction_proxy/content/browser:unit_tests",
304     "//components/data_reduction_proxy/core/browser:unit_tests",
305     "//components/data_reduction_proxy/core/common:unit_tests",
306     "//components/device_event_log:unit_tests",
307     "//components/devtools_http_handler:unit_tests",
308     "//components/dom_distiller/core:unit_tests",
309     "//components/domain_reliability:unit_tests",
310     "//components/favicon_base:unit_tests",
311     "//components/gcm_driver:unit_tests",
312     "//components/gcm_driver/crypto:unit_tests",
313     "//components/gcm_driver/instance_id:unit_tests",
314     "//components/google/core/browser:unit_tests",
315     "//components/invalidation/impl:unittests",
316     "//components/login:unit_tests",
317     "//components/metrics:unit_tests",
318     "//components/mime_util:unit_tests",
319     "//components/offline_pages:unit_tests",
320     "//components/omnibox/browser:unit_tests",
321     "//components/packed_ct_ev_whitelist:unit_tests",
322     "//components/undo:unit_tests",
323     "//components/secure_display:unit_tests",
324     "//components/update_client:unit_tests",
325     "//components/variations:unit_tests",
326     "//components/webcrypto:unit_tests",
327     "//components/web_resource:unit_tests",
328     "//components/webdata/common:unit_tests",
330     # These are the deps required by the code in this target.
331     "//base",
332     "//base/test:test_support",
333     "//content/test:test_support",
334     "//net",
335     "//ui/base",
336     "//ui/resources:ui_test_pak",
337   ]
339   data_deps = [
340     ":components_tests_pak",
341     "//third_party/mesa:osmesa",
342     "//ui/resources:ui_test_pak",
343   ]
345   if (enable_rlz_support) {
346     deps += [ "//components/rlz:unit_tests" ]
347   }
349   if (is_android) {
350     isolate_file = "components_unittests.isolate"
352     deps += [ "//content/public/android:content_java" ]
353     deps -= [
354       "//components/gcm_driver:unit_tests",
355       "//components/gcm_driver/instance_id:unit_tests",
356     ]
357   }
359   if (!is_android && !is_ios) {
360     deps += [ "//components/proximity_auth:unit_tests" ]
361   }
363   if (is_chromeos) {
364     deps += [ "//components/ownership:unit_tests" ]
365   }
367   # TODO(GYP) need this target.
368   #'breakpad/app/crash_keys_win_unittest.cc',
370   # Precache tests need these defines.
371   #configs += [ "//components/precache/core:precache_config" ]
373   if (toolkit_views) {
374     # TODO(GYP) enable this as above.
375     #deps += [ "//components/constrained_window:unit_tests" ]
376   }
377   if (is_win) {
378     deps += [ "//components/browser_watcher:unit_tests" ]
379   }
380   if (is_ios) {
381     deps -= [ "//components/devtools_http_handler:unit_tests" ]
382   }
384   if (!is_ios) {
385     deps += [
386       "//components/safe_json:unit_tests",
387       "//components/scheduler:unit_tests",
388     ]
389   }
392 repack("components_tests_pak") {
393   sources = [
394     "$root_gen_dir/components/components_resources.pak",
395     "$root_gen_dir/components/strings/components_strings_en-US.pak",
396   ]
398   output = "$root_out_dir/components_tests_resources.pak"
400   deps = [
401     "//components/resources",
402     "//components/strings",
403   ]
406 # TODO(GYP): Delete this after we've converted everything to GN.
407 # The _run targets exist only for compatibility w/ GYP.
408 group("components_browsertests_run") {
409   testonly = true
410   deps = [
411     ":components_browsertests",
412   ]
415 test("components_browsertests") {
416   sources = [
417     "autofill/content/browser/risk/fingerprint_browsertest.cc",
418     "autofill/content/renderer/password_form_conversion_utils_browsertest.cc",
419     "dom_distiller/content/browser/distillable_page_utils_browsertest.cc",
420     "dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc",
421     "password_manager/content/renderer/credential_manager_client_browsertest.cc",
422   ]
424   data = [
425     "$root_out_dir/components_tests_resources.pak",
426     "$root_out_dir/content_shell.pak",
427   ]
429   if (is_android || is_linux || is_mac || is_win) {
430     data += [
431       "test/data/",
432       "dom_distiller/core/javascript/",
433       "//third_party/dom_distiller_js/dist/test/data/",
434     ]
435   }
437   if (is_mac) {
438     data += [ "$root_out_dir/Content Shell.app/" ]
439   }
441   defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
443   deps = [
444     "autofill/content/browser",
445     "autofill/content/renderer",
446     "content_settings/core/common",
447     "dom_distiller/content:content_browser",
448     "dom_distiller/core",
449     "dom_distiller/core:test_support",
450     "password_manager/content/browser",
451     "password_manager/content/common",
452     "password_manager/content/renderer",
453     "strings",
454     "//base",
455     "//base/test:test_support",
456     "//content/test:browsertest_support",
457     "//content/test:test_support",
458     "//device/bluetooth",
459     "//testing/gmock",
460     "//testing/gtest",
461     "//ui/base",
462   ]
464   data_deps = [
465     ":components_tests_pak",
466     "//third_party/mesa:osmesa",
467   ]
469   if (is_android) {
470     sources += [ "test/android/browsertests_apk/components_browser_tests_jni_onload.cc" ]
471     sources -= [ "autofill/content/browser/risk/fingerprint_browsertest.cc" ]
472     deps += [ "//testing/android/native_test:native_test_support" ]
473     use_launcher = false
474     isolate_file = "components_browsertests.isolate"
475   }
477   if (is_linux) {
478     # content_extractor_browsertest is a standalone content extraction tool built as
479     # a MANUAL component_browsertest.
480     sources += [ "dom_distiller/standalone/content_extractor_browsertest.cc" ]
481     deps += [
482       "pref_registry:test_support",
483       "//base:prefs_test_support",
484     ]
485   }
488 test("components_perftests") {
489   sources = [
490     "scheduler/child/task_queue_manager_perftest.cc",
491     "visitedlink/test/visitedlink_perftest.cc",
492   ]
494   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
495   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
497   deps = [
498     "//base",
499     "//base/test:test_support_perf",
500     "//testing/gtest",
501     "//testing/perf",
502     "//content/test:test_support",
503     "//components/visitedlink/browser",
504   ]