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/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")
12 assert(is_chromeos, "Non-Chrome-OS builds must not depend on //chromeos")
14 # Used by targets that compile into the implementation.
15 config("chromeos_implementation") {
16 defines = [ "CHROMEOS_IMPLEMENTATION" ]
20 # Defines a buildflag for ease of iteration on the print team's
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
27 buildflag_header("chromeos_buildflags") {
28 header = "chromeos_buildflags.h"
29 flags = [ "IS_CHROMEOS_DEVICE=$is_chromeos_device" ]
32 component("chromeos") {
34 ":chromeos_implementation",
35 "//build/config/linux/nss:system_nss_no_ssl_config",
37 if (is_chromeos_device) {
38 configs += [ "//build/config/compiler:use_orderfile_for_hugepage" ]
40 public_deps = [ "//chromeos/constants" ]
46 "//chromeos/dbus/constants",
47 "//components/policy/proto",
49 "//services/network/public/cpp:cpp",
50 "//third_party/protobuf:protobuf_lite",
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",
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",
89 if (current_cpu == "arm" || current_cpu == "x86") {
90 defines = [ "BINDER_IPC_32BIT" ]
93 if (is_printing_ppd_provider_v3) {
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",
102 sources += [ "printing/ppd_provider.cc" ]
106 source_set("chromeos_export") {
108 sources = [ "chromeos_export.h" ]
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.
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") {
118 public_deps = [ ":test_support_source_set" ]
121 source_set("test_support_source_set") {
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",
137 "//net:test_support",
138 "//services/network:test_support",
144 source_set("test_utils") {
147 "test/chromeos_test_utils.cc",
148 "test/chromeos_test_utils.h",
152 test("chromeos_unittests") {
154 "//build/config/linux/dbus",
155 "//build/config/linux/nss:system_nss_no_ssl_config",
158 ":chromeos_buildflags",
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",
181 "//components/policy:generated",
182 "//components/policy/proto",
183 "//components/prefs:test_support",
184 "//components/proxy_config",
187 "//dbus:test_support",
189 "//mojo/core/embedder",
191 "//net:test_support",
192 "//services/network:test_support",
193 "//services/network/public/cpp",
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",
218 if (is_printing_ppd_provider_v3) {
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",
226 sources += [ "printing/ppd_provider_unittest.cc" ]
229 data = [ "test/data/" ]
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"
242 # Assume every time we build cros_test_wrapper, we also build chrome and
243 # want to deploy it to the DUT.
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
250 generate_runner_script("cros_browser_sanity_test") {
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"
257 ":cros_chrome_deploy",
258 "//:chromiumos_preflight", # Builds the browser.
262 tast_test("chrome_login_tast_tests") {
265 "ui.ChromeCrashLoggedIn",
266 "ui.ChromeCrashNotLoggedIn",
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" ]
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 = [
285 "security.SELinuxProcessesARC",
288 "security.NetworkListenersARC",
289 "security.NetworkListenersNonARC",
295 "ui.ChromeCrashNotLoggedInDirect.breakpad",
296 "ui.ChromeCrashLoggedInDirect.breakpad",
299 "crostini.CopyPaste.wayland_to_x11_artifact",
302 "security.SELinuxFilesSystem",
306 tast_test("chrome_all_tast_tests_informational") {
307 enable_tast_informational_tests = true
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
319 "//mojo/core:shared_library_arc32",
320 "//mojo/core:shared_library_arc64",
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/" ]
329 fuzzer_test("ppd_line_reader_fuzzer") {
330 sources = [ "printing/ppd_line_reader_fuzzer.cc" ]
331 deps = [ ":chromeos" ]
334 fuzzer_test("printer_configuration_fuzzer") {
335 sources = [ "printing/printer_configuration_fuzzer.cc" ]
336 seed_corpus = "printing/uri_fuzzer_seed_corpus"
343 fuzzer_test("uri_fuzzer") {
344 sources = [ "printing/uri_fuzzer.cc" ]
345 seed_corpus = "printing/uri_fuzzer_seed_corpus"
346 deps = [ ":chromeos" ]