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 if (is_android) { |
| 10 import("//build/config/android/config.gni") |
| 11 import("//build/config/android/rules.gni") |
| 12 import("//build/config/sanitizers/sanitizers.gni") |
| 13 } |
| 14 |
9 # Define a test as an executable (or apk on Android) with the "testonly" flag | 15 # Define a test as an executable (or apk on Android) with the "testonly" flag |
10 # set. | 16 # set. |
11 # Variable: | 17 # Variable: |
12 # use_raw_android_executable: Use executable() rather than android_apk(). | 18 # use_raw_android_executable: Use executable() rather than android_apk(). |
13 # use_native_activity: Test implements ANativeActivity_onCreate(). | 19 # use_native_activity: Test implements ANativeActivity_onCreate(). |
14 template("test") { | 20 template("test") { |
15 if (is_android) { | 21 if (is_android) { |
16 import("//build/config/android/config.gni") | |
17 import("//build/config/android/rules.gni") | |
18 import("//build/config/sanitizers/sanitizers.gni") | |
19 | |
20 _use_raw_android_executable = defined(invoker.use_raw_android_executable) && | 22 _use_raw_android_executable = defined(invoker.use_raw_android_executable) && |
21 invoker.use_raw_android_executable | 23 invoker.use_raw_android_executable |
22 | 24 |
23 # output_name is used to allow targets with the same name but in different | 25 # output_name is used to allow targets with the same name but in different |
24 # packages to still produce unique runner scripts. | 26 # packages to still produce unique runner scripts. |
25 _output_name = invoker.target_name | 27 _output_name = invoker.target_name |
26 if (defined(invoker.output_name)) { | 28 if (defined(invoker.output_name)) { |
27 _output_name = invoker.output_name | 29 _output_name = invoker.output_name |
28 } | 30 } |
29 | 31 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 113 } |
112 unittest_apk(_apk_target) { | 114 unittest_apk(_apk_target) { |
113 forward_variables_from(invoker, _apk_specific_vars + [ "deps" ]) | 115 forward_variables_from(invoker, _apk_specific_vars + [ "deps" ]) |
114 shared_library = ":$_library_target" | 116 shared_library = ":$_library_target" |
115 apk_name = invoker.target_name | 117 apk_name = invoker.target_name |
116 if (defined(invoker.output_name)) { | 118 if (defined(invoker.output_name)) { |
117 apk_name = invoker.output_name | 119 apk_name = invoker.output_name |
118 install_script_name = "install_${invoker.output_name}" | 120 install_script_name = "install_${invoker.output_name}" |
119 } | 121 } |
120 | 122 |
| 123 # Add the Java classes so that each target does not have to do it. |
| 124 deps += [ "//base/test:test_support_java" ] |
| 125 |
121 # TODO(agrieve): Remove this data_dep once bots don't build the _apk | 126 # TODO(agrieve): Remove this data_dep once bots don't build the _apk |
122 # target (post-GYP). | 127 # target (post-GYP). |
123 # It's a bit backwards for the apk to depend on the runner script, since | 128 # It's a bit backwards for the apk to depend on the runner script, since |
124 # the apk is conceptually a runtime_dep of the script. However, it is | 129 # the apk is conceptually a runtime_dep of the script. However, it is |
125 # currently necessary because the bots build this _apk target directly | 130 # currently necessary because the bots build this _apk target directly |
126 # rather than the group() below. | 131 # rather than the group() below. |
127 data_deps = [ | 132 data_deps = [ |
128 ":$_test_runner_target", | 133 ":$_test_runner_target", |
129 ] | 134 ] |
130 } | 135 } |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 } | 306 } |
302 | 307 |
303 # Test defaults. | 308 # Test defaults. |
304 set_defaults("test") { | 309 set_defaults("test") { |
305 if (is_android) { | 310 if (is_android) { |
306 configs = default_shared_library_configs | 311 configs = default_shared_library_configs |
307 } else { | 312 } else { |
308 configs = default_executable_configs | 313 configs = default_executable_configs |
309 } | 314 } |
310 } | 315 } |
OLD | NEW |