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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } | 110 } |
109 unittest_apk(_apk_target) { | 111 unittest_apk(_apk_target) { |
110 forward_variables_from(invoker, _apk_specific_vars + [ "deps" ]) | 112 forward_variables_from(invoker, _apk_specific_vars + [ "deps" ]) |
111 shared_library = ":$_library_target" | 113 shared_library = ":$_library_target" |
112 apk_name = invoker.target_name | 114 apk_name = invoker.target_name |
113 if (defined(invoker.output_name)) { | 115 if (defined(invoker.output_name)) { |
114 apk_name = invoker.output_name | 116 apk_name = invoker.output_name |
115 install_script_name = "install_${invoker.output_name}" | 117 install_script_name = "install_${invoker.output_name}" |
116 } | 118 } |
117 | 119 |
| 120 # Add the Java classes so that each target does not have to do it. |
| 121 deps += [ "//base/test:test_support_java" ] |
| 122 |
118 # TODO(agrieve): Remove this data_dep once bots don't build the _apk | 123 # TODO(agrieve): Remove this data_dep once bots don't build the _apk |
119 # target (post-GYP). | 124 # target (post-GYP). |
120 # It's a bit backwards for the apk to depend on the runner script, since | 125 # It's a bit backwards for the apk to depend on the runner script, since |
121 # the apk is conceptually a runtime_dep of the script. However, it is | 126 # the apk is conceptually a runtime_dep of the script. However, it is |
122 # currently necessary because the bots build this _apk target directly | 127 # currently necessary because the bots build this _apk target directly |
123 # rather than the group() below. | 128 # rather than the group() below. |
124 data_deps = [ | 129 data_deps = [ |
125 ":$_test_runner_target", | 130 ":$_test_runner_target", |
126 ] | 131 ] |
127 } | 132 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 } | 289 } |
285 | 290 |
286 # Test defaults. | 291 # Test defaults. |
287 set_defaults("test") { | 292 set_defaults("test") { |
288 if (is_android) { | 293 if (is_android) { |
289 configs = default_shared_library_configs | 294 configs = default_shared_library_configs |
290 } else { | 295 } else { |
291 configs = default_executable_configs | 296 configs = default_executable_configs |
292 } | 297 } |
293 } | 298 } |
OLD | NEW |