| # Copyright 2019 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/packages/prebuilt_test_manifest.gni") |
| import("//src/chromium/generate_pkg.gni") |
| |
| prebuilt_archive_root_path = "//prebuilt/third_party" |
| build_output_gen_base_path = "/gen" |
| |
| # Generates targets for WebEngine prebuilts. |
| # |
| # Parameters |
| # |
| # archive_path_suffix (required) |
| # Appended to the name of the target in archive paths. |
| # |
| # repository (required; string) |
| # The repository host name part of the package URL. |
| # See https://fuchsia.dev/fuchsia-src/concepts/packages/package_url#repository |
| # for more details. |
| template("generate_fuchsia_web_targets") { |
| # Default visibility for targets generated by this template. |
| visibility = [] |
| assert(defined(invoker.archive_path_suffix)) |
| assert(defined(invoker.repository)) |
| not_needed([ "target_name" ]) |
| |
| repository = invoker.repository |
| |
| # WebEngine - a Chromium implementation of `fuchsia.web`. |
| # Only buildbot bundles that need WebEngine to run tests should depend on |
| # this target. See https://fxbug.dev/42070261 for why this is necessary. |
| # The in-tree tests themselves depend on ":web_context_provider_for_test" |
| # below. |
| group("web_engine") { |
| visibility += [ |
| # Allow developers to include it using `--with-cache` or `--with`. |
| # This has a side effect of allowing in-tree //products to include it due |
| # to the way they are currently assembled. |
| "//:developer_cache_packages", |
| "//:developer_universe_packages", |
| |
| # Allow buildbot bundles to include it so that tests can be run. |
| "//bundles/buildbot/*", |
| ] |
| deps = [ ":web_engine_pkg" ] |
| testonly = true |
| } |
| |
| # Used by integration tests to indicate they need WebEngine, specifically the |
| # `context_provider.cm` Component, in the Products on which they run. It has |
| # no effect. Bots and developers running such tests must build and depend on, |
| # respectively, ":web_engine". |
| # TODO(https://fxbug.dev/42070261): Remove once a better solution is available. |
| group("web_context_provider_for_test") { |
| # No new tests relying on WebEngine should be added in tree. |
| visibility += [ |
| "//src/chromium/web_runner_tests/*", |
| "//src/testing/system-validation:*", |
| "//src/ui/a11y/lib/semantics/tests:*", |
| "//src/ui/tests/integration_graphics_tests/web-pixel-tests:*", |
| "//src/ui/tests/integration_input_tests/mouse/*", |
| "//src/ui/tests/integration_input_tests/text-input//*", |
| "//src/ui/tests/integration_input_tests/touch/*", |
| "//src/ui/tests/integration_input_tests/virtual-keyboard/*", |
| "//src/ui/tests/integration_input_tests/web-touch-input/*", |
| ] |
| testonly = true |
| } |
| |
| # Generates ":web_engine_pkg". |
| generate_fuchsia_web_package_flavors("web_engine") { |
| # Prevent dependencies on the package other than ":web_engine", which has |
| # a specific visibility list. |
| visibility += [ ":web_engine" ] |
| |
| prebuilt_archive_base_path = "${prebuilt_archive_root_path}/${target_name}${invoker.archive_path_suffix}" |
| custom_package_path = "${build_output_gen_base_path}/fuchsia_web/webengine/${target_name}/${target_name}.far" |
| } |
| } |
| |
| # Generates targets for prebuilts used for testing WebEngine. |
| # |
| # Parameters |
| # |
| # archive_path_suffix (required) |
| # Appended to the name of the target in archive base paths. |
| # |
| # repository (required; string) |
| # The repository host name part of the package URL. |
| # See https://fuchsia.dev/fuchsia-src/concepts/packages/package_url#repository |
| # for more details. |
| template("generate_fuchsia_web_test_targets") { |
| # Default visibility for targets generated by this template. |
| visibility = [] |
| assert(defined(invoker.archive_path_suffix)) |
| assert(defined(invoker.repository)) |
| not_needed([ "target_name" ]) |
| |
| repository = invoker.repository |
| |
| group("web_engine_shell") { |
| visibility += [ "*" ] |
| deps = [ ":web_engine_shell_pkg" ] |
| testonly = true |
| } |
| |
| # Generates ":web_engine_shell_pkg". |
| generate_fuchsia_web_package_flavors("web_engine_shell") { |
| visibility += [ ":web_engine_shell" ] |
| |
| prebuilt_archive_base_path = "${prebuilt_archive_root_path}/${target_name}${invoker.archive_path_suffix}" |
| custom_package_path = "${build_output_gen_base_path}/fuchsia_web/shell/${target_name}/${target_name}.far" |
| |
| testonly = true |
| } |
| } |
| |
| if (current_cpu == "riscv64") { |
| # The real generate_test_targets() definition below fails at `gn gen` time |
| # because prebuilt_test_manifest() uses read_file() to parse a manifest |
| # file that does not exist for riscv64 yet. |
| # |
| # TODO(https://fxbug.dev/42072732): Provide riscv64 Chromium prebuilts |
| # Alternatively, move this check up in the dependency chain. |
| template("generate_test_targets") { |
| visibility = [ ":*" ] |
| not_needed([ "target_name" ]) |
| not_needed(invoker, "*") |
| group("tests") { |
| } |
| } |
| } else { |
| # Generates targets for Chromium test prebuilts and manifests. |
| # |
| # Parameters |
| # |
| # archive_path_suffix (required) |
| # Appended to the name of the target in archive paths. |
| template("generate_test_targets") { |
| # Default visibility for targets generated by this template. |
| visibility = [ ":*" ] |
| assert(defined(invoker.archive_path_suffix)) |
| not_needed([ "target_name" ]) |
| |
| # Configure groups of prebuilt tests from Chromium. |
| |
| default_test_environments = [ |
| atlas_env, |
| nuc7_env, |
| nuc11_env, |
| ] |
| |
| _prebuilt_archive_base_path = "${prebuilt_archive_root_path}/web_engine_tests${invoker.archive_path_suffix}" |
| archive_dir = "${_prebuilt_archive_base_path}/arch/${target_cpu}" |
| |
| # The specific tests binaries are specified by the "tests" target in |
| # https://source.chromium.org/chromium/chromium/src/+/main:build/fuchsia/cipd/BUILD.gn. |
| prebuilt_test_manifest("chromium_common_tests") { |
| manifest_name = "common_tests_manifest.json" |
| environments = default_test_environments |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| deps = [ ":chromium_test_base_deps" ] |
| } |
| |
| prebuilt_test_manifest("chromium_web_engine_tests") { |
| manifest_name = "web_engine_tests_manifest.json" |
| environments = default_test_environments |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| deps = [ ":chromium_test_base_deps" ] |
| } |
| |
| # This target is provided for use by //src:test* targets. Dependencies on |
| # Chromium tests should reference specific target(s). |
| group("tests") { |
| testonly = true |
| visibility += [ "//src:*" ] |
| |
| deps = [ |
| ":chromium_common_tests", |
| ":chromium_web_engine_tests", |
| ":web_engine_shell", |
| "web_runner_tests:tests", |
| "//src/fonts:downstream_test_deps", |
| ] |
| } |
| } |
| } |