Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Unified Diff: build/config/android/rules.gni

Issue 1975153003: Enable NativeActivity based Android tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/pylib/remote/device/remote_device_gtest_run.py ('k') | testing/android/native_test/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/android/rules.gni
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni
index f5bc6c6be42b773550d4d56e71187863a70d9864..6bc82e19f2c8a7a73f3bc69319cf5fd255099409 100644
--- a/build/config/android/rules.gni
+++ b/build/config/android/rules.gni
@@ -2120,6 +2120,7 @@ template("instrumentation_test_apk") {
# of the unittests_dep target postfixed with "_apk"
# use_default_launcher: Whether the default activity (NativeUnitTestActivity)
# should be used for launching tests.
+# use_native_activity: Test implements ANativeActivity_onCreate().
#
# Example
# unittest_apk("foo_unittests_apk") {
@@ -2127,6 +2128,39 @@ template("instrumentation_test_apk") {
# unittests_dep = ":foo_unittests"
# }
template("unittest_apk") {
+ assert(defined(invoker.unittests_dep), "Need unittests_dep for $target_name")
+
+ test_suite_name = get_label_info(invoker.unittests_dep, "name")
+
+ # This trivial assert is needed in case both unittests_binary and apk_name
+ # are defined, as otherwise test_suite_name would not be used.
+ assert(test_suite_name != "")
+
+ _use_native_activity =
+ defined(invoker.use_native_activity) && invoker.use_native_activity
+ _android_manifest = "$target_gen_dir/$target_name/AndroidManifest.xml"
+
+ # This trivial assert is needed in case android_manifest is defined,
+ # as otherwise _use_native_activity and _android_manifest would not be used.
+ assert(_use_native_activity != "" && _android_manifest != "")
+
+ if (!defined(invoker.android_manifest)) {
+ jinja_template("${target_name}_manifest") {
+ if (!defined(invoker.unittests_binary)) {
+ native_library_name = test_suite_name
+ } else {
+ native_library_name = invoker.unittests_binary
+ }
+ input = "//testing/android/native_test/java/AndroidManifest.xml.jinja2"
+ output = _android_manifest
+ variables = [
+ "is_component_build=${is_component_build}",
+ "native_library_name=${native_library_name}",
+ "use_native_activity=${_use_native_activity}",
+ ]
+ }
+ }
+
android_apk(target_name) {
set_sources_assignment_filter([])
data_deps = []
@@ -2134,14 +2168,6 @@ template("unittest_apk") {
forward_variables_from(invoker, "*")
testonly = true
- assert(defined(unittests_dep), "Need unittests_dep for $target_name")
-
- test_suite_name = get_label_info(unittests_dep, "name")
-
- # This trivial assert is needed in case both unittests_binary and apk_name
- # are defined, as otherwise test_suite_name would not be used.
- assert(test_suite_name != "")
-
if (defined(invoker.proguard_enabled) && invoker.proguard_enabled) {
assert(invoker.proguard_configs != [])
proguard_enabled = true
@@ -2153,8 +2179,8 @@ template("unittest_apk") {
}
if (!defined(android_manifest)) {
- android_manifest =
- "//testing/android/native_test/java/AndroidManifest.xml"
+ deps += [ ":${target_name}_manifest" ]
+ android_manifest = _android_manifest
}
if (!defined(unittests_binary)) {
« no previous file with comments | « build/android/pylib/remote/device/remote_device_gtest_run.py ('k') | testing/android/native_test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698