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 template("_gen_isolate") { | 9 template("_gen_isolate") { |
10 testonly = true | 10 testonly = true |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 deps = [ | 56 deps = [ |
57 ":${invoker.target_name}__write_deps", | 57 ":${invoker.target_name}__write_deps", |
58 ] | 58 ] |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 # Define a test as an executable (or apk on Android) with the "testonly" flag | 62 # Define a test as an executable (or apk on Android) with the "testonly" flag |
63 # set. | 63 # set. |
64 # Variable: | 64 # Variable: |
65 # use_raw_android_executable: Use executable() rather than android_apk(). | 65 # use_raw_android_executable: Use executable() rather than android_apk(). |
66 # use_native_activity: Test implements ANativeActivity_onCreate(). | |
66 template("test") { | 67 template("test") { |
67 if (is_android) { | 68 if (is_android) { |
68 import("//build/config/android/config.gni") | 69 import("//build/config/android/config.gni") |
69 import("//build/config/android/rules.gni") | 70 import("//build/config/android/rules.gni") |
70 | 71 |
71 _use_raw_android_executable = defined(invoker.use_raw_android_executable) && | 72 _use_raw_android_executable = defined(invoker.use_raw_android_executable) && |
72 invoker.use_raw_android_executable | 73 invoker.use_raw_android_executable |
73 | 74 |
74 # output_name is used to allow targets with the same name but in different | 75 # output_name is used to allow targets with the same name but in different |
75 # packages to still produce unique runner scripts. | 76 # packages to still produce unique runner scripts. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 dist_dir = "$root_out_dir/$target_name" | 147 dist_dir = "$root_out_dir/$target_name" |
147 binary = _exec_output | 148 binary = _exec_output |
148 deps = [ | 149 deps = [ |
149 ":$_exec_target", | 150 ":$_exec_target", |
150 ] | 151 ] |
151 if (defined(invoker.extra_dist_files)) { | 152 if (defined(invoker.extra_dist_files)) { |
152 extra_files = invoker.extra_dist_files | 153 extra_files = invoker.extra_dist_files |
153 } | 154 } |
154 } | 155 } |
155 } else { | 156 } else { |
157 _use_native_activity = | |
158 defined(invoker.use_native_activity) && invoker.use_native_activity | |
agrieve
2016/05/19 00:42:51
nit: it's a bit less code to just add "use_native_
ynovikov
2016/05/20 02:38:10
Done.
| |
156 _library_target = "_${target_name}__library" | 159 _library_target = "_${target_name}__library" |
157 _apk_target = "${target_name}_apk" | 160 _apk_target = "${target_name}_apk" |
158 _apk_specific_vars = [ | 161 _apk_specific_vars = [ |
159 "android_manifest", | 162 "android_manifest", |
160 "enable_multidex", | 163 "enable_multidex", |
161 "use_default_launcher", | 164 "use_default_launcher", |
162 "write_asset_list", | 165 "write_asset_list", |
163 ] | 166 ] |
164 shared_library(_library_target) { | 167 shared_library(_library_target) { |
165 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn . | 168 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn . |
166 configs = [] # Prevent list overwriting warning. | 169 configs = [] # Prevent list overwriting warning. |
167 configs = invoker.configs | 170 configs = invoker.configs |
168 testonly = true | 171 testonly = true |
169 | 172 |
170 deps = [] | 173 deps = [] |
171 forward_variables_from(invoker, | 174 forward_variables_from(invoker, |
172 "*", | 175 "*", |
173 _apk_specific_vars + _wrapper_script_vars + | 176 _apk_specific_vars + _wrapper_script_vars + |
174 _gen_isolate_vars + [ "visibility" ]) | 177 _gen_isolate_vars + [ "visibility" ]) |
175 | 178 |
176 if (!defined(invoker.use_default_launcher) || | 179 if (!defined(invoker.use_default_launcher) || |
177 invoker.use_default_launcher) { | 180 invoker.use_default_launcher) { |
178 deps += [ "//testing/android/native_test:native_test_native_code" ] | 181 deps += [ "//testing/android/native_test:native_test_native_code" ] |
179 } | 182 } |
180 } | 183 } |
181 unittest_apk(_apk_target) { | 184 unittest_apk(_apk_target) { |
182 forward_variables_from(invoker, _apk_specific_vars + [ "deps" ]) | 185 forward_variables_from(invoker, _apk_specific_vars + [ "deps" ]) |
186 use_native_activity = _use_native_activity | |
183 unittests_dep = ":$_library_target" | 187 unittests_dep = ":$_library_target" |
184 apk_name = invoker.target_name | 188 apk_name = invoker.target_name |
185 if (defined(invoker.output_name)) { | 189 if (defined(invoker.output_name)) { |
186 apk_name = invoker.output_name | 190 apk_name = invoker.output_name |
187 unittests_binary = "lib${apk_name}.so" | 191 unittests_binary = "lib${apk_name}.so" |
188 install_script_name = "install_${invoker.output_name}" | 192 install_script_name = "install_${invoker.output_name}" |
189 } | 193 } |
190 deps += [ ":$_library_target" ] | 194 deps += [ ":$_library_target" ] |
191 | 195 |
192 # TODO(agrieve): Remove this data_dep once bots don't build the _apk | 196 # TODO(agrieve): Remove this data_dep once bots don't build the _apk |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
341 if (defined(invoker.output_name) && target_name != invoker.output_name) { | 345 if (defined(invoker.output_name) && target_name != invoker.output_name) { |
342 group("${invoker.output_name}_run") { | 346 group("${invoker.output_name}_run") { |
343 testonly = true | 347 testonly = true |
344 deps = [ | 348 deps = [ |
345 ":${invoker.target_name}", | 349 ":${invoker.target_name}", |
346 ] | 350 ] |
347 } | 351 } |
348 } | 352 } |
349 } | 353 } |
350 } | 354 } |
OLD | NEW |