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