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 "output_extension", | |
171 "output_name", | |
172 "public", | |
173 "public_configs", | |
174 "public_deps", | |
175 "sources", | |
176 "visibility", | |
177 ]) | |
178 | 166 |
179 if (defined(invoker.deps)) { | 167 if (!defined(deps)) { |
180 deps = invoker.deps | |
181 } else { | |
182 deps = [] | 168 deps = [] |
183 } | 169 } |
184 deps += [ | 170 deps += [ |
185 # 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 |
186 # asan mode (this target will be empty in other cases). | 172 # asan mode (this target will be empty in other cases). |
187 "//build/config/sanitizers:deps", | 173 "//build/config/sanitizers:deps", |
188 ] | 174 ] |
| 175 if (!defined(data_deps)) { |
| 176 data_deps = [] |
| 177 } |
| 178 data_deps += [ ":$_resources_bundle_data" ] |
189 } | 179 } |
190 } else { | 180 } else { |
191 main_target_name = target_name | 181 main_target_name = target_name |
192 | 182 |
193 executable(target_name) { | 183 executable(target_name) { |
194 forward_variables_from(invoker, "*") | 184 forward_variables_from(invoker, "*") |
195 | 185 |
196 testonly = true | 186 testonly = true |
197 | 187 |
198 if (!defined(invoker.deps)) { | 188 if (!defined(invoker.deps)) { |
(...skipping 12 matching lines...) Expand all Loading... |
211 # TODO(GYP): Delete this after we've converted everything to GN. | 201 # TODO(GYP): Delete this after we've converted everything to GN. |
212 # The _run targets exist only for compatibility with GYP. | 202 # The _run targets exist only for compatibility with GYP. |
213 group("${target_name}_run") { | 203 group("${target_name}_run") { |
214 testonly = true | 204 testonly = true |
215 deps = [ | 205 deps = [ |
216 ":$main_target_name", | 206 ":$main_target_name", |
217 ] | 207 ] |
218 } | 208 } |
219 } | 209 } |
220 } | 210 } |
OLD | NEW |