1 # Copyright 2014 The Chromium Authors
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/ui.gni")
7 import("//testing/libfuzzer/fuzzer_test.gni")
8 import("//testing/test.gni")
9 import("./features.gni")
10 import("./tast_control.gni")
12 if (is_chromeos_device) {
13 import("//build/config/chromeos/rules.gni")
16 assert(is_chromeos, "Non-Chrome-OS builds must not depend on //chromeos")
18 # Used by targets that compile into the implementation.
19 config("chromeos_implementation") {
20 defines = [ "CHROMEOS_IMPLEMENTATION" ]
23 buildflag_header("features") {
25 flags = [ "USE_REAL_CHROMEOS_SERVICES=$use_real_chromeos_services" ]
28 component("chromeos") {
29 deps = [ "//chromeos/dbus/constants" ]
32 if (is_chromeos_ash) {
33 configs += [ ":chromeos_implementation" ]
34 if (current_cpu == "arm" || current_cpu == "x86") {
35 defines = [ "BINDER_IPC_32BIT" ]
40 source_set("chromeos_export") {
42 sources = [ "chromeos_export.h" ]
45 # This must be a static library instead of a source set because some of the
46 # files pull in things with dependencies that aren't linked in all cases.
48 # TODO this should probably be changed such that it links in all cases and
49 # can be converted to a source set.
50 static_library("test_support") {
52 public_deps = [ ":test_support_source_set" ]
55 source_set("test_support_source_set") {
65 if (is_chromeos_ash) {
67 "//chromeos/ash/components/dbus:test_support",
68 "//chromeos/ash/components/login/login_state:test_support",
69 "//chromeos/ash/components/network:test_support",
72 "//services/network:test_support",
77 source_set("test_utils") {
80 "test/chromeos_test_utils.cc",
81 "test/chromeos_test_utils.h",
85 test("chromeos_unittests") {
86 configs += [ "//build/config/linux/dbus" ]
90 "//base/test:test_support",
91 "//build:chromeos_buildflags",
92 "//mojo/core/embedder",
95 sources = [ "test/run_all_unittests.cc" ]
97 # Tests that are common to Ash and Lacros.
99 "//chromeos/components/firewall_hole:unit_tests",
100 "//chromeos/constants:unit_tests",
101 "//chromeos/system:unit_tests",
104 if (is_chromeos_ash) {
107 "//chromeos/ash/components:test_support",
108 "//chromeos/ash/components:unit_tests",
109 "//chromeos/ash/components/dbus:test_support",
110 "//chromeos/ash/components/network:test_support",
111 "//chromeos/ash/services:unit_tests",
112 "//chromeos/crosapi/cpp:unit_tests",
113 "//chromeos/crosapi/mojom:unit_tests",
114 "//chromeos/dbus:unit_tests",
115 "//chromeos/printing:unit_tests",
116 "//chromeos/process_proxy:unit_tests",
117 "//chromeos/services:unit_tests",
118 "//chromeos/startup:unit_tests",
119 "//chromeos/ui/base:unit_tests",
120 "//chromeos/utils:unit_tests",
121 "//chromeos/version:unit_tests",
123 "//components/prefs:test_support",
124 "//components/proxy_config",
126 "//dbus:test_support",
129 "//net:test_support",
130 "//services/network/public/cpp",
135 data = [ "test/data/" ]
138 # The following definitions only apply when building for a CrOS board (ie: not
139 # linux-chromeos). See the following for reference:
140 # https://chromium.googlesource.com/chromium/src/+/main/docs/chromeos_build_instructions.md
141 # https://chromium.googlesource.com/chromiumos/docs/+/main/simple_chrome_workflow.md
142 if (is_chromeos_ash && is_chromeos_device) {
143 # This builds a tool that prepares a DUT or VM for testing, which can be
144 # utilized by wrapping a host-side script test.
145 generate_runner_script("cros_test_wrapper") {
146 generated_script = "$root_build_dir/bin/cros_test_wrapper"
148 # Assume every time we build cros_test_wrapper, we also build chrome and
149 # want to deploy it to the DUT.
152 # The only targets that currently use cros_test_wrapper are Telemetry-based
153 # tests, which have their own crash/symbolization handling code. So, strip
154 # Chrome before deploying in order to save disk space and avoid potential
155 # memory issues on 32-bit devices.
159 tast_test("chrome_login_tast_tests") {
161 "ui.ChromeCrashLoggedIn",
162 "ui.ChromeCrashNotLoggedIn",
166 # Used to report the size of various partitions. For more details, see:
167 # https://source.chromium.org/search?q=report_disk_usage.go
168 tast_test("disk_usage_tast_test") {
169 tast_tests = [ "platform.ReportDiskUsage" ]
172 # Tast test sources live in the Chromium OS repository.
173 # To diagnose tast failures or disable tests, see go/tast-failures
174 # For any builders that run this target, it should also build Lacros.
175 tast_test("chrome_all_tast_tests") {
177 # TODO(b/284405976): Add a !no_chrome_dcheck condition automatically by reading the build configuration.
178 tast_attr_expr = "(\"group:mainline\" && \"dep:chrome\" && !\"dep:no_chrome_dcheck\" && !informational)"
180 deploy_lacros_chrome = true
183 # To disable a specific test, add it to the
184 # tast_disabled_tests_from_chrome_all list in "tast_control.gni" and cite
186 tast_disabled_tests = tast_disabled_tests_from_chrome_all
189 tast_test("chrome_all_tast_tests_informational") {
190 enable_tast_informational_tests = true
193 tast_test("chrome_criticalstaging_tast_tests") {
195 # TODO(b/284405976): Add a !no_chrome_dcheck condition automatically by reading the build configuration.
196 # TODO(b/294489383): Re-enable lacros tests once lacros chrome is deployed to ash skylab builders.
197 tast_attr_expr = "(\"group:mainline\" && \"dep:chrome\" && !\"dep:no_chrome_dcheck\" && !\"dep:lacros\" && \"informational\" && \"group:criticalstaging\")"
199 deploy_lacros_chrome = true
202 # To disable a specific test, add it to the
203 # tast_disabled_tests_from_chrome_all list in "tast_control.gni" and cite
205 tast_disabled_tests = tast_disabled_tests_from_chrome_all
208 tast_test("chrome_disabled_tast_tests") {
209 tast_tests = tast_disabled_tests_from_chrome_all
212 tast_test("chrome_variations_tast_tests") {
213 tast_tests = [ "ui.ChromeVariationsSmoke" ]
216 group("cros_chrome_deploy") {
217 # The following run-time dependencies are needed to deploy chrome to a
218 # ChromeOS device. See the link for the full list:
219 # https://codesearch.chromium.org/chromium/src/third_party/chromite/lib/chrome_util.py?l=341
220 # Most of these are copy targets, for which GN doesn't add their outputs
221 # as runtime-deps. See the link below for more details:
222 # https://chromium.googlesource.com/chromium/src/+/main/tools/gn/docs/reference.md#actions-and-copies
225 "//mojo/core:shared_library_arc32",
226 "//mojo/core:shared_library_arc64",
229 # TODO(bpastene): Figure out what's generating resources/chromeos/ and
230 # declare it as a dep instead of adding the dir directly.
231 data = [ "$root_out_dir/resources/chromeos/" ]