OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # ============================================================================== | 5 # ============================================================================== |
6 # TEST SETUP | 6 # TEST SETUP |
7 # ============================================================================== | 7 # ============================================================================== |
8 | 8 |
9 # Define a test as an executable (or apk on Android) with the "testonly" flag | 9 # Define a test as an executable (or apk on Android) with the "testonly" flag |
10 # set. | 10 # set. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 # TODO(GYP): Delete this after we've converted everything to GN. | 128 # TODO(GYP): Delete this after we've converted everything to GN. |
129 # The _run targets exist only for compatibility w/ GYP. | 129 # The _run targets exist only for compatibility w/ GYP. |
130 group("${target_name}_apk_run") { | 130 group("${target_name}_apk_run") { |
131 testonly = true | 131 testonly = true |
132 deps = [ | 132 deps = [ |
133 ":$main_target_name", | 133 ":$main_target_name", |
134 ] | 134 ] |
135 } | 135 } |
136 } else if (is_ios) { | 136 } else if (is_ios) { |
137 if (is_ios) { | 137 import("//build/config/ios/rules.gni") |
138 import("//build/config/ios/rules.gni") | 138 |
| 139 _test_target = target_name |
| 140 _resources_bundle_data = target_name + "_resources_bundle_data" |
| 141 |
| 142 bundle_data(_resources_bundle_data) { |
| 143 visibility = [ ":$_test_target" ] |
| 144 sources = [ |
| 145 "//testing/gtest_ios/Default.png", |
| 146 ] |
| 147 outputs = [ |
| 148 "{{bundle_resources_dir}}/{{source_file_part}}", |
| 149 ] |
139 } | 150 } |
140 | 151 |
141 ios_app(target_name) { | 152 app(_test_target) { |
142 # TODO(GYP): Make this configurable and only provide a default | 153 # TODO(GYP): Make this configurable and only provide a default |
143 # that can be overridden. | 154 # that can be overridden. |
144 info_plist = "//testing/gtest_ios/unittest-Info.plist" | 155 info_plist = "//testing/gtest_ios/unittest-Info.plist" |
145 app_name = target_name | 156 app_name = target_name |
146 entitlements_path = "//testing/gtest_ios" | 157 entitlements_path = "//testing/gtest_ios" |
147 code_signing_identity = "" | 158 code_signing_identity = "" |
148 testonly = true | 159 testonly = true |
| 160 extra_substitutions = [ "BUNDLE_ID_TEST_NAME=$app_name" ] |
149 | 161 |
150 # See above call. | 162 # See above call. |
151 set_sources_assignment_filter([]) | 163 set_sources_assignment_filter([]) |
152 | 164 |
153 forward_variables_from(invoker, | 165 forward_variables_from(invoker, "*") |
154 [ | |
155 "all_dependent_configs", | |
156 "allow_circular_includes_from", | |
157 "cflags", | |
158 "cflags_c", | |
159 "cflags_cc", | |
160 "cflags_objc", | |
161 "cflags_objcc", | |
162 "check_includes", | |
163 "configs", | |
164 "data", | |
165 "data_deps", | |
166 "defines", | |
167 "include_dirs", | |
168 "ldflags", | |
169 "libs", | |
170 "public", | |
171 "public_configs", | |
172 "public_deps", | |
173 "sources", | |
174 "visibility", | |
175 ]) | |
176 | 166 |
177 if (defined(invoker.deps)) { | 167 if (!defined(deps)) { |
178 deps = invoker.deps | |
179 } else { | |
180 deps = [] | 168 deps = [] |
181 } | 169 } |
182 deps += [ | 170 deps += [ |
183 # All shared libraries must have the sanitizer deps to properly link in | 171 # All shared libraries must have the sanitizer deps to properly link in |
184 # asan mode (this target will be empty in other cases). | 172 # asan mode (this target will be empty in other cases). |
185 "//build/config/sanitizers:deps", | 173 "//build/config/sanitizers:deps", |
186 ] | 174 ] |
| 175 if (!defined(data_deps)) { |
| 176 data_deps = [] |
| 177 } |
| 178 data_deps += [ ":$_resources_bundle_data" ] |
187 } | 179 } |
188 } else { | 180 } else { |
189 main_target_name = target_name | 181 main_target_name = target_name |
190 | 182 |
191 executable(target_name) { | 183 executable(target_name) { |
192 forward_variables_from(invoker, "*") | 184 forward_variables_from(invoker, "*") |
193 | 185 |
194 testonly = true | 186 testonly = true |
195 | 187 |
196 if (!defined(invoker.deps)) { | 188 if (!defined(invoker.deps)) { |
(...skipping 12 matching lines...) Expand all Loading... |
209 # TODO(GYP): Delete this after we've converted everything to GN. | 201 # TODO(GYP): Delete this after we've converted everything to GN. |
210 # The _run targets exist only for compatibility with GYP. | 202 # The _run targets exist only for compatibility with GYP. |
211 group("${target_name}_run") { | 203 group("${target_name}_run") { |
212 testonly = true | 204 testonly = true |
213 deps = [ | 205 deps = [ |
214 ":$main_target_name", | 206 ":$main_target_name", |
215 ] | 207 ] |
216 } | 208 } |
217 } | 209 } |
218 } | 210 } |
OLD | NEW |