Upload upstream chromium 85.0.4183.93
[platform/framework/web/chromium-efl.git] / chromeos / BUILD.gn
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.
4
5 import("//build/buildflag_header.gni")
6 import("//build/config/chromeos/rules.gni")
7 import("//build/config/ui.gni")
8 import("//testing/libfuzzer/fuzzer_test.gni")
9 import("//testing/test.gni")
10 import("//third_party/protobuf/proto_library.gni")
11
12 assert(is_chromeos, "Non-Chrome-OS builds must not depend on //chromeos")
13
14 # Used by targets that compile into the implementation.
15 config("chromeos_implementation") {
16   defines = [ "CHROMEOS_IMPLEMENTATION" ]
17 }
18
19 declare_args() {
20   # Defines a buildflag for ease of iteration on the print team's
21   # PpdProvider class.
22   # TODO(crbug.com/1025995): remove this and all related scaffolding
23   # once we're ready to cut over.
24   is_printing_ppd_provider_v3 = false
25 }
26
27 buildflag_header("chromeos_buildflags") {
28   header = "chromeos_buildflags.h"
29   flags = [ "IS_CHROMEOS_DEVICE=$is_chromeos_device" ]
30 }
31
32 component("chromeos") {
33   configs += [
34     ":chromeos_implementation",
35     "//build/config/linux/nss:system_nss_no_ssl_config",
36   ]
37   if (is_chromeos_device) {
38     configs += [ "//build/config/compiler:use_orderfile_for_hugepage" ]
39   }
40   public_deps = [ "//chromeos/constants" ]
41   deps = [
42     ":chromeos_export",
43     "//base",
44     "//base:i18n",
45     "//chromeos/dbus",
46     "//chromeos/dbus/constants",
47     "//components/policy/proto",
48     "//google_apis",
49     "//services/network/public/cpp:cpp",
50     "//third_party/protobuf:protobuf_lite",
51   ]
52   sources = [
53     "hugepage_text/hugepage_text.cc",
54     "hugepage_text/hugepage_text.h",
55     "policy/weekly_time/time_utils.cc",
56     "policy/weekly_time/time_utils.h",
57     "policy/weekly_time/weekly_time.cc",
58     "policy/weekly_time/weekly_time.h",
59     "policy/weekly_time/weekly_time_interval.cc",
60     "policy/weekly_time/weekly_time_interval.h",
61     "printing/cups_printer_status.cc",
62     "printing/cups_printer_status.h",
63     "printing/epson_driver_matching.cc",
64     "printing/epson_driver_matching.h",
65     "printing/ppd_cache.cc",
66     "printing/ppd_cache.h",
67     "printing/ppd_line_reader.cc",
68     "printing/ppd_line_reader.h",
69     "printing/ppd_provider.h",
70     "printing/printer_configuration.cc",
71     "printing/printer_configuration.h",
72     "printing/printer_translator.cc",
73     "printing/printer_translator.h",
74     "printing/uri.cc",
75     "printing/uri.h",
76     "printing/uri_components.cc",
77     "printing/uri_components.h",
78     "printing/uri_impl.cc",
79     "printing/uri_impl.h",
80     "printing/usb_printer_id.cc",
81     "printing/usb_printer_id.h",
82     "process_proxy/process_output_watcher.cc",
83     "process_proxy/process_output_watcher.h",
84     "process_proxy/process_proxy.cc",
85     "process_proxy/process_proxy.h",
86     "process_proxy/process_proxy_registry.cc",
87     "process_proxy/process_proxy_registry.h",
88   ]
89   if (current_cpu == "arm" || current_cpu == "x86") {
90     defines = [ "BINDER_IPC_32BIT" ]
91   }
92
93   if (is_printing_ppd_provider_v3) {
94     sources += [
95       "printing/ppd_metadata_parser.cc",
96       "printing/ppd_metadata_parser.h",
97       "printing/ppd_provider_v3.cc",
98       "printing/printer_config_cache.cc",
99       "printing/printer_config_cache.h",
100     ]
101   } else {
102     sources += [ "printing/ppd_provider.cc" ]
103   }
104 }
105
106 source_set("chromeos_export") {
107   deps = [ "//base" ]
108   sources = [ "chromeos_export.h" ]
109 }
110
111 # This must be a static library instead of a source set because some of the
112 # files pull in things with dependencies that aren't linked in all cases.
113 #
114 # TODO this should probably be changed such that it links in all cases and
115 # can be converted to a source set.
116 static_library("test_support") {
117   testonly = true
118   public_deps = [ ":test_support_source_set" ]
119 }
120
121 source_set("test_support_source_set") {
122   testonly = true
123   public_deps = [
124     ":chromeos",
125     ":test_utils",
126   ]
127   deps = [
128     "//chromeos/attestation:test_support",
129     "//chromeos/cryptohome:test_support",
130     "//chromeos/dbus:test_support",
131     "//chromeos/disks:test_support",
132     "//chromeos/login/auth:test_support",
133     "//chromeos/login/login_state:test_support",
134     "//chromeos/network:test_support",
135     "//chromeos/tpm:test_support",
136     "//google_apis",
137     "//net:test_support",
138     "//services/network:test_support",
139     "//testing/gmock",
140     "//testing/gtest",
141   ]
142 }
143
144 source_set("test_utils") {
145   deps = [ "//base" ]
146   sources = [
147     "test/chromeos_test_utils.cc",
148     "test/chromeos_test_utils.h",
149   ]
150 }
151
152 test("chromeos_unittests") {
153   configs += [
154     "//build/config/linux/dbus",
155     "//build/config/linux/nss:system_nss_no_ssl_config",
156   ]
157   deps = [
158     ":chromeos_buildflags",
159     ":test_support",
160     "//base/test:test_support",
161     "//chromeos/attestation:unit_tests",
162     "//chromeos/audio:unit_tests",
163     "//chromeos/cryptohome:unit_tests",
164     "//chromeos/dbus:test_support",
165     "//chromeos/dbus:unit_tests",
166     "//chromeos/dbus/services:unit_tests",
167     "//chromeos/disks:unit_tests",
168     "//chromeos/geolocation:unit_tests",
169     "//chromeos/login/auth:unit_tests",
170     "//chromeos/login/login_state:unit_tests",
171     "//chromeos/login/session:unit_tests",
172     "//chromeos/memory:unit_tests",
173     "//chromeos/network:test_support",
174     "//chromeos/network:unit_tests",
175     "//chromeos/services:unit_tests",
176     "//chromeos/settings:unit_tests",
177     "//chromeos/system:unit_tests",
178     "//chromeos/timezone:unit_tests",
179     "//chromeos/tpm:unit_tests",
180     "//components/onc",
181     "//components/policy:generated",
182     "//components/policy/proto",
183     "//components/prefs:test_support",
184     "//components/proxy_config",
185     "//crypto",
186     "//crypto:platform",
187     "//dbus:test_support",
188     "//google_apis",
189     "//mojo/core/embedder",
190     "//net",
191     "//net:test_support",
192     "//services/network:test_support",
193     "//services/network/public/cpp",
194     "//testing/gmock",
195     "//testing/gtest",
196     "//third_party/icu",
197     "//url",
198   ]
199   sources = [
200     "policy/weekly_time/time_utils_unittest.cc",
201     "policy/weekly_time/weekly_time_interval_unittest.cc",
202     "policy/weekly_time/weekly_time_unittest.cc",
203     "printing/cups_printer_status_unittest.cc",
204     "printing/epson_driver_matching_unittest.cc",
205     "printing/ppd_cache_unittest.cc",
206     "printing/ppd_line_reader_unittest.cc",
207     "printing/printer_configuration_unittest.cc",
208     "printing/printer_translator_unittest.cc",
209     "printing/uri_unittest.cc",
210     "printing/uri_unittest.h",
211     "printing/uri_unittest_consistency.cc",
212     "printing/usb_printer_id_unittest.cc",
213     "process_proxy/process_output_watcher_unittest.cc",
214     "process_proxy/process_proxy_unittest.cc",
215     "test/run_all_unittests.cc",
216   ]
217
218   if (is_printing_ppd_provider_v3) {
219     sources += [
220       "printing/fake_printer_config_cache.cc",
221       "printing/fake_printer_config_cache.h",
222       "printing/ppd_metadata_parser_unittest.cc",
223       "printing/printer_config_cache_unittest.cc",
224     ]
225   } else {
226     sources += [ "printing/ppd_provider_unittest.cc" ]
227   }
228
229   data = [ "test/data/" ]
230 }
231
232 # The following definitions only apply when building for a CrOS board (ie: not
233 # linux-chromeos). See the following for reference:
234 # https://chromium.googlesource.com/chromium/src/+/master/docs/chromeos_build_instructions.md
235 # https://chromium.googlesource.com/chromiumos/docs/+/master/simple_chrome_workflow.md
236 if (is_chromeos_device) {
237   # This builds a tool that prepares a DUT or VM for testing, which can be
238   # utilized by wrapping a host-side script test.
239   generate_runner_script("cros_test_wrapper") {
240     generated_script = "$root_build_dir/bin/cros_test_wrapper"
241
242     # Assume every time we build cros_test_wrapper, we also build chrome and
243     # want to deploy it to the DUT.
244     deploy_chrome = true
245   }
246
247   # The sanity test's actual binary is baked into the OS image. All we need to
248   # do is build the test wrapper and build our own browser to push to the DUT
249   # before testing it.
250   generate_runner_script("cros_browser_sanity_test") {
251     testonly = true
252     test_exe = "cros_browser_sanity_test"
253     generated_script = "$root_build_dir/bin/run_cros_browser_sanity_test"
254     runtime_deps_file = "$root_out_dir/cros_browser_sanity_test.runtime_deps"
255
256     data_deps = [
257       ":cros_chrome_deploy",
258       "//:chromiumos_preflight",  # Builds the browser.
259     ]
260   }
261
262   tast_test("chrome_login_tast_tests") {
263     tast_tests = [
264       "ui.ChromeLogin",
265       "ui.ChromeCrashLoggedIn",
266       "ui.ChromeCrashNotLoggedIn",
267     ]
268   }
269
270   # Used to report the size of various partitions. For more details, see:
271   # https://source.chromium.org/search?q=report_disk_usage.go
272   tast_test("disk_usage_tast_test") {
273     tast_tests = [ "platform.ReportDiskUsage" ]
274   }
275
276   # Tast test sources live in the Chromium OS repository.
277   # To diagnose tast failures or disable tests, see go/tast-failures
278   tast_test("chrome_all_tast_tests") {
279     # To disable a specific test, add it the following list and cite a bug.
280     tast_disabled_tests = [
281       # crbug.com/1097630
282       "security.OpenFDs",
283
284       # crbug.com/1051059
285       "security.SELinuxProcessesARC",
286
287       # crbug.com/1062289
288       "security.NetworkListenersARC",
289       "security.NetworkListenersNonARC",
290
291       # crbug.com/1056163
292       "hwsec.LoginGuest",
293
294       # crbug.com/1059426
295       "ui.ChromeCrashNotLoggedInDirect.breakpad",
296       "ui.ChromeCrashLoggedInDirect.breakpad",
297
298       # crbug.com/1073084
299       "crostini.CopyPaste.wayland_to_x11_artifact",
300
301       # crbug.com/1098810
302       "security.SELinuxFilesSystem",
303     ]
304   }
305
306   tast_test("chrome_all_tast_tests_informational") {
307     enable_tast_informational_tests = true
308   }
309
310   group("cros_chrome_deploy") {
311     # The following run-time dependencies are needed to deploy chrome to a
312     # ChromeOS device. See the link for the full list:
313     # https://codesearch.chromium.org/chromium/src/third_party/chromite/lib/chrome_util.py?l=341
314     # Most of these are copy targets, for which GN doesn't add their outputs
315     # as runtime-deps. See the link below for more details:
316     # https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/reference.md#actions-and-copies
317     data_deps = [
318       "//chrome:xdg_mime",
319       "//mojo/core:shared_library_arc32",
320       "//mojo/core:shared_library_arc64",
321     ]
322
323     # TODO(bpastene): Figure out what's generating resources/chromeos/ and
324     # declare it as a dep instead of adding the dir directly.
325     data = [ "$root_out_dir/resources/chromeos/" ]
326   }
327 }
328
329 fuzzer_test("ppd_line_reader_fuzzer") {
330   sources = [ "printing/ppd_line_reader_fuzzer.cc" ]
331   deps = [ ":chromeos" ]
332 }
333
334 fuzzer_test("printer_configuration_fuzzer") {
335   sources = [ "printing/printer_configuration_fuzzer.cc" ]
336   seed_corpus = "printing/uri_fuzzer_seed_corpus"
337   deps = [
338     ":chromeos",
339     "//base",
340   ]
341 }
342
343 fuzzer_test("uri_fuzzer") {
344   sources = [ "printing/uri_fuzzer.cc" ]
345   seed_corpus = "printing/uri_fuzzer_seed_corpus"
346   deps = [ ":chromeos" ]
347 }