OLD | NEW |
| (Empty) |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import("//build/mac/tweak_info_plist.gni") | |
6 import("//ios/build/chrome_build.gni") | |
7 import("//ios/public/provider/chrome/browser/build_config.gni") | |
8 import("//ios/third_party/earl_grey/ios_eg_test.gni") | |
9 | |
10 # Template wrapping ios_eg_test, setting default values for EarlGrey test | |
11 # based on //ios/chrome/app:chrome. | |
12 # | |
13 # Arguments: | |
14 # | |
15 # info_plist: | |
16 # (optional) string, path to the Info.plist file that will be used for | |
17 # the bundle. | |
18 # | |
19 # info_plist_target: | |
20 # (optional) string, if the info_plist is generated from an action, | |
21 # rather than a regular source file, specify the target name in lieu | |
22 # of info_plist. The two arguments are mutually exclusive. | |
23 # | |
24 # extra_info_plists: | |
25 # (optional) string array, extra list of plist files that will be merged | |
26 # and tweaked; ignored if either info_plist or info_plist_target is set. | |
27 # | |
28 # entitlements_path: | |
29 # (optional) path to the template to use to generate the application | |
30 # entitlements by performing variable substitutions, defaults to | |
31 # //build/config/ios/entitlements.plist. | |
32 # | |
33 # entitlements_target: | |
34 # (optional) label of the target generating the application | |
35 # entitlements (must generate a single file as output); cannot be | |
36 # defined if entitlements_path is set. | |
37 # | |
38 # deps | |
39 # list of labels to depends on. | |
40 # | |
41 # This template defines two targets, one named "${target_name}" is the EarlGrey | |
42 # test application, and the other named "${target_name}_deps_group" is a group | |
43 # target that depends on the template "deps" property (used to implement the | |
44 # test suite running the FLAKY_ tests). | |
45 # | |
46 template("chrome_ios_eg_test") { | |
47 if (!defined(entitlements_path) && !defined(entitlements_target)) { | |
48 _target_name = target_name | |
49 _tweak_entitlements = target_name + "_tweak_entitlements" | |
50 compile_plist(_tweak_entitlements) { | |
51 format = "xml1" | |
52 substitutions = [ "IOS_BUNDLE_ID_PREFIX=$ios_app_bundle_id_prefix" ] | |
53 output_name = "$target_gen_dir/$_target_name.entitlements" | |
54 plist_templates = | |
55 [ "//ios/chrome/test/earl_grey/resources/Chrome.entitlements" ] | |
56 } | |
57 } | |
58 | |
59 if (!defined(info_plist) && !defined(info_plist_target)) { | |
60 _tweak_info_plist = target_name + "_tweak_info_plist" | |
61 tweak_info_plist(_tweak_info_plist) { | |
62 info_plists = [ | |
63 "//ios/chrome/app/resources/Info.plist", | |
64 "//ios/chrome/app/resources/EarlGreyAddition+Info.plist", | |
65 ] | |
66 if (ios_chrome_info_plist_additions != []) { | |
67 info_plists += ios_chrome_info_plist_additions | |
68 } | |
69 if (defined(invoker.extra_info_plists)) { | |
70 info_plists += invoker.extra_info_plists | |
71 } | |
72 args = [ | |
73 "--breakpad=$breakpad_enabled_as_int", | |
74 "--branding=$chromium_short_name", | |
75 "--version-overrides=MINOR=9999", | |
76 ] | |
77 } | |
78 } | |
79 | |
80 _deps_group_name = target_name + "_deps_group" | |
81 group(_deps_group_name) { | |
82 testonly = true | |
83 public_deps = invoker.deps | |
84 if (defined(invoker.public_deps)) { | |
85 public_deps += invoker.public_deps | |
86 } | |
87 } | |
88 | |
89 ios_eg_test(target_name) { | |
90 forward_variables_from(invoker, | |
91 "*", | |
92 [ | |
93 "deps", | |
94 "entitlements_path", | |
95 "entitlements_target", | |
96 "eg_main_application_delegate", | |
97 "info_plist", | |
98 "info_plist_target", | |
99 "public_deps", | |
100 ]) | |
101 | |
102 if (!defined(entitlements_path) && !defined(entitlements_target)) { | |
103 entitlements_target = ":$_tweak_entitlements" | |
104 } | |
105 | |
106 if (!defined(info_plist) && !defined(info_plist_target)) { | |
107 info_plist_target = ":$_tweak_info_plist" | |
108 } | |
109 | |
110 _eg_main_application_delegate = "MainApplicationDelegate" | |
111 if (defined(invoker.eg_main_application_delegate)) { | |
112 _eg_main_application_delegate = invoker.eg_main_application_delegate | |
113 } | |
114 | |
115 deps = [ | |
116 ":$_deps_group_name", | |
117 "//ios/chrome/app:main", | |
118 "//ios/chrome/test/earl_grey:hooks", | |
119 "//ios/testing:http_server_bundle_data", | |
120 ] | |
121 if (!defined(bundle_deps)) { | |
122 bundle_deps = [] | |
123 } | |
124 bundle_deps += [ "//ios/chrome/app/resources" ] | |
125 | |
126 if (!defined(extra_substitutions)) { | |
127 extra_substitutions = [] | |
128 } | |
129 extra_substitutions += [ | |
130 "CHROMIUM_BUNDLE_ID=gtest.$target_name", | |
131 "CHROMIUM_HANDOFF_ID=$chromium_handoff_id", | |
132 "CHROMIUM_SHORT_NAME=$target_name", | |
133 "CHROMIUM_URL_SCHEME_1=$url_unsecure_scheme", | |
134 "CHROMIUM_URL_SCHEME_2=$url_secure_scheme", | |
135 "CHROMIUM_URL_SCHEME_3=$url_x_callback_scheme", | |
136 "CHROMIUM_URL_SCHEME_4=$url_channel_scheme", | |
137 "EG_MAIN_APPLICATION_DELEGATE=$_eg_main_application_delegate", | |
138 "SSOAUTH_URL_SCHEME=$url_ssoauth_scheme", | |
139 ] | |
140 } | |
141 } | |
OLD | NEW |