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

Unified Diff: chrome/android/webapk/shell_apk/BUILD.gn

Issue 2076583002: Add WebAPK's tests in ChildProcessLauncherTest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move ChildProcessLaucherTest back to content. Created 4 years, 6 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
Index: chrome/android/webapk/shell_apk/BUILD.gn
diff --git a/chrome/android/webapk/shell_apk/BUILD.gn b/chrome/android/webapk/shell_apk/BUILD.gn
index 285a1eb8025616e16acfde1d8718286a3b899668..0d564076f142a1e0389662ac3d5b89db5efea625 100644
--- a/chrome/android/webapk/shell_apk/BUILD.gn
+++ b/chrome/android/webapk/shell_apk/BUILD.gn
@@ -24,20 +24,34 @@ declare_args() {
shell_apk_manifest_package =
"org.chromium.webapk.$webapk_manifest_package_origin"
+test_shell_apk_manifest_package = "org.chromium.webapk.template.test"
-shell_apk_manifest = "$target_gen_dir/shell_apk_manifest/AndroidManifest.xml"
+webapk_common_jinja_variables = [
+ "host_url=$webapk_start_url",
+ "scope_url=$webapk_scope_url",
+ "scope_url_host=$webapk_scope_url_host",
+]
+
+webapk_jinja_variables = [
+ "manifest_package=$shell_apk_manifest_package",
+ "runtime_host=$webapk_runtime_host",
+]
+
+test_webapk_jinja_variables = [
+ "manifest_package=$test_shell_apk_manifest_package",
+ "runtime_host=org.chromium.chrome",
+]
jinja_template("shell_apk_manifest") {
input = "AndroidManifest.xml"
- output = shell_apk_manifest
-
- variables = [
- "manifest_package=$shell_apk_manifest_package",
- "host_url=$webapk_start_url",
- "runtime_host=$webapk_runtime_host",
- "scope_url=$webapk_scope_url",
- "scope_url_host=$webapk_scope_url_host",
- ]
+ output = "$target_gen_dir/shell_apk_manifest/AndroidManifest.xml"
+ variables = webapk_common_jinja_variables + webapk_jinja_variables
+}
+
+jinja_template("test_shell_apk_manifest") {
+ input = "AndroidManifest.xml"
+ output = "$target_gen_dir/test_shell_apk_manifest/AndroidManifest.xml"
+ variables = webapk_common_jinja_variables + test_webapk_jinja_variables
}
android_resources("shell_apk_resources") {
@@ -52,24 +66,49 @@ android_library("dex_loader_lib") {
# Template for WebAPK. When a WebAPK is generated:
# - Android manifest is customized to the website.
# - App icon is extracted from the website and added to the APK's resources.
-android_apk("webapk") {
- android_manifest = shell_apk_manifest
+template("webapk_template") {
+ android_apk(target_name) {
+ forward_variables_from(invoker, "*")
+ java_files = [
+ "src/org/chromium/webapk/shell_apk/MainActivity.java",
+ "src/org/chromium/webapk/shell_apk/WebApkServiceFactory.java",
+ ]
+ deps += [
+ ":dex_loader_lib",
+ ":shell_apk_manifest",
+ ":shell_apk_resources",
+ "//chrome/android/webapk/libs/common",
+ "//chrome/android/webapk/libs/runtime_library",
+ ]
+ if (!is_debug) {
+ proguard_enabled = true
+ proguard_configs = [ "//chrome/android/java/proguard.flags" ]
+ }
+ }
+}
+
+webapk_template("webapk") {
+ android_manifest = get_target_outputs(":shell_apk_manifest")
+ android_manifest = android_manifest[1]
apk_name = "WebApk.$webapk_manifest_package_origin"
- java_files = [
- "src/org/chromium/webapk/shell_apk/MainActivity.java",
- "src/org/chromium/webapk/shell_apk/WebApkServiceFactory.java",
- ]
+
deps = [
- ":dex_loader_lib",
":shell_apk_manifest",
- ":shell_apk_resources",
- "//chrome/android/webapk/libs/common",
- "//chrome/android/webapk/libs/runtime_library",
]
- if (!is_debug) {
- proguard_enabled = true
- proguard_configs = [ "//chrome/android/java/proguard.flags" ]
- }
+}
+
+# The |test_webapk| target is used for WebAPK's instrumentation tests in the
+# target chrome_public_test_apk. |test_webapk|'s package name and runtime
+# host are set to be compatible with the instrumentation tests and are not
+# customizable.
+webapk_template("test_webapk") {
+ android_manifest = get_target_outputs(":test_shell_apk_manifest")
+ android_manifest = android_manifest[1]
+ apk_name = "TestWebApk"
+
+ deps = [
+ ":test_shell_apk_manifest",
+ ]
}
android_library("shell_apk_javatests") {

Powered by Google App Engine
This is Rietveld 408576698