| # Copyright 2014 The Chromium Authors | 
 | # Use of this source code is governed by a BSD-style license that can be | 
 | # found in the LICENSE file. | 
 |  | 
 | import("//build/buildflag_header.gni") | 
 | import("//build/config/ui.gni") | 
 | import("//testing/libfuzzer/fuzzer_test.gni") | 
 | import("//testing/test.gni") | 
 | import("./features.gni") | 
 | import("./tast_control.gni") | 
 |  | 
 | if (is_chromeos_device) { | 
 |   import("//build/config/chromeos/rules.gni") | 
 | } | 
 |  | 
 | assert(is_chromeos, "Non-Chrome-OS builds must not depend on //chromeos") | 
 |  | 
 | # Used by targets that compile into the implementation. | 
 | config("chromeos_implementation") { | 
 |   defines = [ "CHROMEOS_IMPLEMENTATION" ] | 
 | } | 
 |  | 
 | buildflag_header("features") { | 
 |   header = "features.h" | 
 |   flags = [ "USE_REAL_CHROMEOS_SERVICES=$use_real_chromeos_services" ] | 
 | } | 
 |  | 
 | source_set("chromeos_export") { | 
 |   deps = [ "//base" ] | 
 |   sources = [ "chromeos_export.h" ] | 
 | } | 
 |  | 
 | # This must be a static library instead of a source set because some of the | 
 | # files pull in things with dependencies that aren't linked in all cases. | 
 | static_library("test_support") { | 
 |   testonly = true | 
 |   sources = [ | 
 |     "test/chromeos_test_utils.cc", | 
 |     "test/chromeos_test_utils.h", | 
 |   ] | 
 |   deps = [ "//base" ] | 
 | } | 
 |  | 
 | test("chromeos_unittests") { | 
 |   configs += [ "//build/config/linux/dbus" ] | 
 |  | 
 |   sources = [ "test/run_all_unittests.cc" ] | 
 |  | 
 |   data = [ "test/data/" ] | 
 |  | 
 |   deps = [ | 
 |     "//base", | 
 |     "//base/test:test_support", | 
 |     "//build:chromeos_buildflags", | 
 |     "//chromeos/ash/components:test_support", | 
 |     "//mojo/core/embedder", | 
 |   ] | 
 |  | 
 |   # Collect the actual tests. | 
 |   deps += [ | 
 |     "//chromeos/ash/components:unit_tests", | 
 |     "//chromeos/ash/services:unit_tests", | 
 |     "//chromeos/components/firewall_hole:unit_tests", | 
 |     "//chromeos/constants:unit_tests", | 
 |     "//chromeos/crosapi/cpp:unit_tests", | 
 |     "//chromeos/dbus:unit_tests", | 
 |     "//chromeos/printing:unit_tests", | 
 |     "//chromeos/process_proxy:unit_tests", | 
 |     "//chromeos/services:unit_tests", | 
 |     "//chromeos/system:unit_tests", | 
 |     "//chromeos/ui/base:unit_tests", | 
 |     "//chromeos/utils:unit_tests", | 
 |     "//chromeos/version:unit_tests", | 
 |   ] | 
 | } | 
 |  | 
 | # The following definitions only apply when building for a CrOS board (ie: not | 
 | # linux-chromeos). See the following for reference: | 
 | # https://chromium.googlesource.com/chromium/src/+/main/docs/chromeos_build_instructions.md | 
 | # https://chromium.googlesource.com/chromiumos/docs/+/main/simple_chrome_workflow.md | 
 | if (is_chromeos_device) { | 
 |   # This builds a tool that prepares a DUT or VM for testing, which can be | 
 |   # utilized by wrapping a host-side script test. | 
 |   generate_runner_script("cros_test_wrapper") { | 
 |     generated_script = "$root_build_dir/bin/cros_test_wrapper" | 
 |  | 
 |     # Assume every time we build cros_test_wrapper, we also build chrome and | 
 |     # want to deploy it to the DUT. | 
 |     deploy_chrome = true | 
 |  | 
 |     # The only targets that currently use cros_test_wrapper are Telemetry-based | 
 |     # tests, which have their own crash/symbolization handling code. So, strip | 
 |     # Chrome before deploying in order to save disk space and avoid potential | 
 |     # memory issues on 32-bit devices. | 
 |     strip_chrome = true | 
 |   } | 
 |  | 
 |   tast_test("chrome_login_tast_tests") { | 
 |     tast_tests = [ | 
 |       "ui.ChromeCrashLoggedIn", | 
 |       "ui.ChromeCrashNotLoggedIn", | 
 |     ] | 
 |   } | 
 |  | 
 |   # Used to report the size of various partitions. For more details, see: | 
 |   # https://source.chromium.org/search?q=report_disk_usage.go | 
 |   tast_test("disk_usage_tast_test") { | 
 |     tast_tests = [ "platform.ReportDiskUsage" ] | 
 |   } | 
 |  | 
 |   _tast_disabled_tests_on_this_board = [] | 
 |   foreach(_test, tast_disabled_tests_from_chrome_all) { | 
 |     _test_name_and_board = [] | 
 |     _test_name_and_board = string_split(_test, "@") + [ "" ] | 
 |     _test_name = _test_name_and_board[0] | 
 |     _test_board = _test_name_and_board[1] | 
 |     if (_test_board == "" || _test_board == cros_board) { | 
 |       _tast_disabled_tests_on_this_board += [ _test_name ] | 
 |     } | 
 |   } | 
 |  | 
 |   # Tast test sources live in the Chromium OS repository. | 
 |   # To diagnose tast failures or disable tests, see go/tast-failures | 
 |   # For any builders that run this target, it should also build Lacros. | 
 |   tast_test("chrome_all_tast_tests") { | 
 |     tast_attr_expr = "\"group:mainline\" && \"dep:chrome\" && !informational" | 
 |     if (is_skylab) { | 
 |       # TODO(b/284405976): Add a !no_chrome_dcheck condition automatically by reading the build configuration. | 
 |       tast_attr_expr = "($tast_attr_expr && !\"dep:no_chrome_dcheck\")" | 
 |     } | 
 |  | 
 |     # To disable a specific test, add it to the | 
 |     # tast_disabled_tests_from_chrome_all list in "tast_control.gni" and cite | 
 |     # a bug. | 
 |     tast_disabled_tests = _tast_disabled_tests_on_this_board | 
 |   } | 
 |  | 
 |   tast_test("chrome_all_tast_tests_informational") { | 
 |     enable_tast_informational_tests = true | 
 |   } | 
 |  | 
 |   tast_test("chrome_criticalstaging_tast_tests") { | 
 |     tast_attr_expr = "\"group:mainline\" && \"dep:chrome\" && !\"dep:lacros\" && \"informational\" && \"group:criticalstaging\"" | 
 |     if (is_skylab) { | 
 |       # TODO(b/284405976): Add a !no_chrome_dcheck condition automatically by reading the build configuration. | 
 |       # TODO(b/294489383): Re-enable lacros tests once lacros chrome is deployed to ash skylab builders. | 
 |       tast_attr_expr = "($tast_attr_expr && !\"dep:no_chrome_dcheck\")" | 
 |     } | 
 |  | 
 |     tast_disabled_tests = _tast_disabled_tests_on_this_board | 
 |   } | 
 |  | 
 |   tast_test("chrome_disabled_tast_tests") { | 
 |     tast_tests = _tast_disabled_tests_on_this_board | 
 |   } | 
 |  | 
 |   tast_test("chrome_variations_tast_tests") { | 
 |     tast_tests = [ "ui.ChromeVariationsSmoke" ] | 
 |   } | 
 |  | 
 |   # Test suite to test the CrOS basic functionality (See http://go/cq-medium). | 
 |   tast_test("cq_medium_tast_tests") { | 
 |     tast_attr_expr = "\"group:cq-medium\" && \"dep:chrome\" && \"group:mainline\" && !informational" | 
 |     if (is_skylab) { | 
 |       # TODO(b/284405976): Add a !no_chrome_dcheck condition automatically by reading the build configuration. | 
 |       tast_attr_expr = "($tast_attr_expr && !\"dep:no_chrome_dcheck\")" | 
 |     } | 
 |  | 
 |     tast_disabled_tests = _tast_disabled_tests_on_this_board | 
 |   } | 
 |  | 
 |   group("cros_chrome_deploy") { | 
 |     # The following run-time dependencies are needed to deploy chrome to a | 
 |     # ChromeOS device. See the link for the full list: | 
 |     # https://codesearch.chromium.org/chromium/src/third_party/chromite/lib/chrome_util.py?l=341 | 
 |     # Most of these are copy targets, for which GN doesn't add their outputs | 
 |     # as runtime-deps. See the link below for more details: | 
 |     # https://chromium.googlesource.com/chromium/src/+/main/tools/gn/docs/reference.md#actions-and-copies | 
 |     data_deps = [ "//chrome:xdg_mime" ] | 
 |  | 
 |     # TODO(bpastene): Figure out what's generating resources/chromeos/ and | 
 |     # declare it as a dep instead of adding the dir directly. | 
 |     data = [ "$root_out_dir/resources/chromeos/" ] | 
 |   } | 
 | } |