Index: testing/test.gni |
diff --git a/testing/test.gni b/testing/test.gni |
index 4503860eedcb07b4c186e92ae239045e33ab41bb..897926b605d7c6b52e8db0463c3a012b9f9e0ee8 100644 |
--- a/testing/test.gni |
+++ b/testing/test.gni |
@@ -6,6 +6,23 @@ |
# TEST SETUP |
# ============================================================================== |
+if (is_android) { |
+ template("_gen_apk_isolate") { |
+ action(target_name) { |
+ script = "//build/android/gyp/gen-android-test-isolate.py" |
+ outputs = [ |
+ invoker.output, |
+ ] |
+ args = [ |
+ "--out-file", |
+ rebase_path(invoker.output, root_build_dir), |
+ ".", |
+ invoker.lib_target, |
+ ] |
+ } |
+ } |
+} |
+ |
# Define a test as an executable (or apk on Android) with the "testonly" flag |
# set. |
template("test") { |
@@ -17,6 +34,19 @@ template("test") { |
library_name = "_${target_name}__library" |
apk_name = "${target_name}_apk" |
+ # TODO(agrieve): Delete invoker.isolate_file when write_runtime_deps() is |
+ # available. http://crbug.com/593416 |
+ _requires_apk_isolate = |
+ defined(invoker.isolate_file) && invoker.isolate_file != "" |
+ |
+ if (_requires_apk_isolate) { |
+ _apk_isolate_target_name = "_${target_name}__apk_isolate" |
+ _apk_isolate_path = "$target_gen_dir/$target_name.apk.isolate" |
+ _gen_apk_isolate(_apk_isolate_target_name) { |
+ lib_target = get_label_info(":$library_name", "label_no_toolchain") |
+ output = _apk_isolate_path |
+ } |
+ } |
shared_library(library_name) { |
# Configs will always be defined since we set_defaults for a component |
# in the main config. We want to use those rather than whatever came with |
@@ -89,8 +119,8 @@ template("test") { |
test_name = _test_name |
test_type = "gtest" |
test_suite = _test_name |
- if (defined(invoker.isolate_file)) { |
- isolate_file = invoker.isolate_file |
+ if (_requires_apk_isolate) { |
+ isolate_file = _apk_isolate_path |
} |
} |
incremental_test_runner_script_name = |
@@ -101,25 +131,31 @@ template("test") { |
test_type = "gtest" |
test_suite = _test_name |
incremental_install = true |
- if (defined(invoker.isolate_file)) { |
- isolate_file = invoker.isolate_file |
+ if (_requires_apk_isolate) { |
+ isolate_file = _apk_isolate_path |
} |
} |
group(target_name) { |
testonly = true |
- datadeps = [ |
+ data_deps = [ |
":$test_runner_script_name", |
] |
+ if (_requires_apk_isolate) { |
+ data_deps += [ ":$_apk_isolate_target_name" ] |
+ } |
deps = [ |
":$apk_name", |
] |
} |
group("${target_name}_incremental") { |
testonly = true |
- datadeps = [ |
+ data_deps = [ |
":$incremental_test_runner_script_name", |
] |
+ if (_requires_apk_isolate) { |
+ data_deps += [ ":$_apk_isolate_target_name" ] |
+ } |
deps = [ |
":${apk_name}_incremental", |
] |