1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72

build / config / ios / ios_test_runner_xcuitest.gni [blame]

# Copyright 2021 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/config/ios/ios_test_runner_wrapper.gni")
import("//build/config/ios/rules.gni")

# ios_test_runner_xcuitest are just ios_xcuitest_test with an
# ios_test_runner_wrapper. Currently used by Crashpad tests, which do not depend
# on EG2 (and therefore do not use ios_eg2_test)
template("ios_test_runner_xcuitest") {
  assert(defined(invoker.xcode_test_application_name),
         "xcode_test_application_name must be defined for $target_name")
  assert(
      defined(invoker.deps),
      "deps must be defined for $target_name to include at least one xctest" +
          "file.")

  _target_name = target_name
  _test_target = "${target_name}_test"
  ios_xcuitest_test(_test_target) {
    forward_variables_from(invoker,
                           [
                             "xcode_test_application_name",
                             "xctest_bundle_principal_class",
                             "bundle_deps",
                             "deps",
                             "data_deps",
                           ])

    # TODO(crbug.com/40120290) Because we change the target name, the subnodes
    # are going to append with the _test in the naming, which won't be backwards
    # compatible during migration from iOS recipe to Chromium.
    output_name = "${_target_name}"
  }

  ios_test_runner_wrapper(target_name) {
    forward_variables_from(invoker,
                           [
                             "clones",
                             "data",
                             "data_deps",
                             "deps",
                             "executable_args",
                             "retries",
                             "xcode_test_application_name",
                           ])
    _root_build_dir = rebase_path("${root_build_dir}", root_build_dir)

    if (!defined(data_deps)) {
      data_deps = []
    }

    # Include the top ios_test_runner_xcuitest target, and the host app
    data_deps += [ ":${_test_target}" ]

    if (!defined(executable_args)) {
      executable_args = []
    }

    # The xcuitest module is bundled as *-Runner.app, while the host app is
    # bundled as *.app.
    executable_args += [
      "--app",
      "@WrappedPath(${_root_build_dir}/${target_name}-Runner.app)",
    ]
    executable_args += [
      "--host-app",
      "@WrappedPath(${_root_build_dir}/${xcode_test_application_name}.app)",
    ]
  }
}