blob: fe448177b936d7b6027a654aec76bc3348d08393 [file] [log] [blame]
# Copyright 2018 The Chromium 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/apple/compile_entitlements.gni")
import("//build/apple/tweak_info_plist.gni")
import("//build/config/ios/rules.gni")
import("//ios/build/chrome_build.gni")
import("//ios/public/provider/chrome/browser/build_config.gni")
import("//ios/third_party/earl_grey2/ios_eg2_test.gni")
template("chrome_ios_eg2_test_app_host") {
if (!defined(entitlements_path) && !defined(entitlements_target)) {
_target_name = target_name
_tweak_entitlements = target_name + "_tweak_entitlements"
compile_entitlements(_tweak_entitlements) {
substitutions = [ "IOS_BUNDLE_ID_PREFIX=$ios_app_bundle_id_prefix" ]
output_name = "$target_gen_dir/$_target_name.entitlements"
entitlements_templates =
[ "//ios/chrome/test/earl_grey/resources/Chrome.entitlements" ]
if (ios_egtests_entitlements_additions != []) {
entitlements_templates += ios_egtests_entitlements_additions
}
}
}
if (!defined(info_plist) && !defined(info_plist_target)) {
_tweak_info_plist = target_name + "_tweak_info_plist"
tweak_info_plist(_tweak_info_plist) {
info_plists = [
"//ios/chrome/app/resources/Info.plist",
"//ios/chrome/app/resources/EarlGreyAddition+Info.plist",
]
if (ios_chrome_info_plist_additions != []) {
info_plists += ios_chrome_info_plist_additions
}
if (ios_chrome_info_plist_addition_targets != []) {
if (!defined(deps)) {
deps = []
}
deps += ios_chrome_info_plist_addition_targets
}
if (defined(invoker.extra_info_plists)) {
info_plists += invoker.extra_info_plists
}
args = [
"--breakpad=$breakpad_enabled_as_int",
"--branding=$chromium_short_name",
"--version-overrides=MINOR=9999",
]
}
}
_deps_group_name = target_name + "_deps_group"
group(_deps_group_name) {
testonly = true
public_deps = []
if (defined(invoker.deps)) {
public_deps += invoker.deps
}
if (defined(invoker.public_deps)) {
public_deps += invoker.public_deps
}
}
ios_eg2_test_app_host(target_name) {
forward_variables_from(invoker,
[
"entitlements_path",
"entitlements_target",
"eg_main_application_delegate",
"info_plist",
"info_plist_target",
],
[
"deps",
"public_deps",
])
testonly = true
xcode_product_bundle_id = "gtest.$target_name"
if (!defined(entitlements_path) && !defined(entitlements_target)) {
entitlements_target = ":$_tweak_entitlements"
}
if (!defined(info_plist) && !defined(info_plist_target)) {
info_plist_target = ":$_tweak_info_plist"
}
_eg_main_application_delegate = "MainApplicationDelegate"
if (defined(eg_main_application_delegate)) {
_eg_main_application_delegate = eg_main_application_delegate
}
deps = [
":$_deps_group_name",
"//ios/chrome/app:main",
"//ios/chrome/test/earl_grey:eg_app_support+eg2",
"//ios/chrome/test/earl_grey:hooks",
"//ios/testing:http_server_bundle_data",
"//ios/third_party/earl_grey2:app_framework+link",
]
if (!defined(bundle_deps)) {
bundle_deps = []
}
bundle_deps += [
"//ios/chrome/app/resources",
"//ios/third_party/earl_grey2:app_framework+bundle",
"//ios/third_party/gtx:gtx+bundle",
ios_application_icons_target,
]
if (!defined(extra_substitutions)) {
extra_substitutions = []
}
extra_substitutions += [
"CHROMIUM_HANDOFF_ID=$chromium_handoff_id",
"CHROMIUM_SHORT_NAME=$target_name",
"CHROMIUM_URL_SCHEME_1=$url_unsecure_scheme",
"CHROMIUM_URL_SCHEME_2=$url_secure_scheme",
"CHROMIUM_URL_SCHEME_3=$url_x_callback_scheme",
"CHROMIUM_URL_CHANNEL_SCHEME=$url_channel_scheme",
"EG_MAIN_APPLICATION_DELEGATE=$_eg_main_application_delegate",
"SSOAUTH_URL_SCHEME=$url_ssoauth_scheme",
"CONTENT_WIDGET_EXTENSION_BUNDLE_ID=$chromium_bundle_id.ContentTodayExtension",
"CHROMIUM_BUNDLE_ID=gtest.$target_name",
"IOS_MOVE_TAB_ACTIVITY_TYPE=$ios_move_tab_activity_type",
]
}
}
set_defaults("chrome_ios_eg_v2_test_app_host") {
configs = default_executable_configs
}
template("chrome_ios_eg2_test") {
_deps_group_name = target_name + "_deps_group"
group(_deps_group_name) {
testonly = true
public_deps = []
if (defined(invoker.deps)) {
public_deps += invoker.deps
}
if (defined(invoker.public_deps)) {
public_deps += invoker.public_deps
}
}
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 earl grey test file.")
ios_eg2_test(target_name) {
forward_variables_from(invoker,
[
"bundle_deps",
"deps",
"data_deps",
"executable_args",
"retries",
"shards",
"xcode_test_application_name",
])
xctest_bundle_principal_class = "ChromeEGTestBundleMain"
if (!defined(deps)) {
deps = []
}
deps += [ "//ios/chrome/test/earl_grey:eg_test_support+eg2" ]
if (!defined(bundle_deps)) {
bundle_deps = []
}
bundle_deps += [
"//ios/chrome/app/resources",
"//ios/third_party/gtx:gtx+bundle",
"//third_party/icu:icudata",
]
}
}
set_defaults("chrome_ios_eg2_test") {
configs = default_shared_library_configs
}