| # 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/config/ios/rules.gni") |
| import("//build/mac/tweak_info_plist.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 (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 |
| |
| 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:hooks", |
| "//ios/chrome/test/earl_grey2:eg_app_support+eg2", |
| "//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_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", |
| ] |
| if (ios_automatically_manage_certs) { |
| # Use the same bundle identifier for EarlGrey tests as for unit tests |
| # when managing certificates as the number of free certs is limited. |
| extra_substitutions += |
| [ "CHROMIUM_BUNDLE_ID=gtest.${ios_generic_test_bundle_id_suffix}" ] |
| } else { |
| extra_substitutions += [ "CHROMIUM_BUNDLE_ID=gtest.$target_name" ] |
| } |
| } |
| } |
| |
| set_defaults("chrome_ios_eg_v2_test_app_host") { |
| configs = default_executable_configs |
| } |
| |
| template("chrome_ios_eg2_test") { |
| 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, |
| [ |
| "xcode_test_application_name", |
| "deps", |
| ]) |
| |
| if (!defined(deps)) { |
| deps = [] |
| } |
| deps += [ "//ios/chrome/test/earl_grey2:eg_test_support+eg2" ] |
| } |
| } |
| |
| set_defaults("chrome_ios_eg2_test") { |
| configs = default_shared_library_configs |
| } |