chromium/ios/chrome/test/wpt/BUILD.gn

# Copyright 2019 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/apple/tweak_info_plist.gni")
import("//build/config/ios/ios_sdk.gni")
import("//build/config/ios/rules.gni")
import("//ios/build/chrome_build.gni")
import("//ios/chrome/test/xcuitest/ios_chrome_xcuitest_app_host.gni")
import("//ios/public/provider/chrome/browser/build_config.gni")
import("//testing/test.gni")

script_test("chrome_ios_wpt") {
  script = "//third_party/blink/tools/run_wpt_tests.py"
  args = [
    "--product",
    "chrome_ios",
    "--target",
    "Release",
    "--zero-tests-executed-ok",
    "--no-retry-failures",
    "--use-upstream-wpt",
  ]
  deps = [ ":all_tests" ]
  data_deps = [
    ":tools",
    "//third_party/blink/tools:wpt_tests_isolate",
  ]
}

group("tools") {
  data = [
    "tools/",
    "//ios/build/bots/scripts/",
    "//ios/testing/plugin",
  ]
}

group("all_tests") {
  testonly = true
  deps = [
    ":ios_cwt_chromedriver_tests",
    ":ios_cwt_chromedriver_tests_module",
  ]
}

copy("copy_clusterfuzz_scripts") {
  sources = [
    "//ios/build/bots/scripts",
    "//ios/chrome/test/wpt/tools",
    "//ios/testing/plugin",

    # Variations test utilities used by variations_runner script.
    "//testing/scripts/variations_seed_access_helper.py",
  ]
  outputs =
      [ "$root_build_dir/{{source_root_relative_dir}}/{{source_file_part}}" ]
}

group("ios_chrome_clusterfuzz_asan_build") {
  testonly = true
  deps = [
    ":all_tests",
    ":copy_clusterfuzz_scripts",
  ]
}

ios_chrome_xcuitest_app_host("ios_cwt_chromedriver_tests") {
  deps = [
    ":app_support",

    # Use the chromium implementation of the provider API.
    "//ios/chrome/browser/providers:chromium_providers",
  ]
  bundle_deps = [ "//ios/third_party/gtx:gtx+bundle" ]
}

ios_xcuitest_test("ios_cwt_chromedriver_tests_module") {
  xcode_test_application_name = "ios_cwt_chromedriver_tests"

  deps = [ ":cwt_chromedriver_tests" ]
  data_deps = [ ":ios_cwt_chromedriver_tests" ]
  bundle_deps = [
    "//ios/chrome/app/resources",
    "//ios/third_party/gtx:gtx+bundle",
    "//third_party/icu:icudata",
  ]

  # Those frameworks are force-linked via //base/test:test_support, so
  # ensure the framework bundles are packaged in the test runner and
  # not the test module.
  runner_only_bundle_deps = [ "//base/test:test_trace_processor+bundle" ]
}

source_set("shared_helper_headers") {
  testonly = true
  sources = [ "cwt_webdriver_app_interface.h" ]
  public_deps = [ "//base" ]
}

source_set("cwt_constants") {
  testonly = true
  sources = [
    "cwt_constants.cc",
    "cwt_constants.h",
  ]
}

source_set("app_support") {
  testonly = true

  sources = [
    "cwt_stderr_logger.h",
    "cwt_stderr_logger.mm",
    "cwt_tests_hook.mm",
    "cwt_webdriver_app_interface.mm",
  ]

  deps = [
    ":cwt_constants",
    "//base",
    "//base/test:test_support",
    "//components/signin/internal/identity_manager",
    "//ios/chrome/app:app_internal",
    "//ios/chrome/app:tests_hook",
    "//ios/chrome/browser/shared/coordinator/scene:scene_state_header",
    "//ios/chrome/browser/shared/model/browser",
    "//ios/chrome/browser/shared/model/web_state_list",
    "//ios/chrome/browser/tabs/model",
    "//ios/chrome/test/app:test_support",
    "//ios/testing:nserror_support",
    "//ios/third_party/edo",
    "//ios/web/public/js_messaging",
    "//ios/web/public/test",
    "//ui/gfx",
  ]

  public_deps = [ ":shared_helper_headers" ]
}

source_set("cwt_chromedriver_tests") {
  testonly = true
  configs += [ "//build/config/ios:xctest_config" ]

  sources = [
    "cwt_chrome_driver.mm",
    "cwt_request_handler.h",
    "cwt_request_handler.mm",
  ]

  deps = [
    ":cwt_constants",
    ":shared_helper_headers",
    "//components/version_info:version_info",
    "//ios/third_party/edo",
    "//net:test_support",
  ]

  frameworks = [ "UIKit.framework" ]
}