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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
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 import("//build/config/android/rules.gni") 5 import("//build/config/android/rules.gni")
6 6
7 declare_args() { 7 declare_args() {
8 # The origin URL of the WebAPK. Used to generate a unique package name for 8 # The origin URL of the WebAPK. Used to generate a unique package name for
9 # WebAPK. Example: "foo.com" 9 # WebAPK. Example: "foo.com"
10 webapk_manifest_package_origin = "template" 10 webapk_manifest_package_origin = "template"
11 11
12 # The URL that the WebAPK should navigate to when it is launched. 12 # The URL that the WebAPK should navigate to when it is launched.
13 webapk_start_url = "https://www.template.com/home_page" 13 webapk_start_url = "https://www.template.com/home_page"
14 14
15 # The browser that the WebAPK will be bound to. 15 # The browser that the WebAPK will be bound to.
16 webapk_runtime_host = "com.google.android.apps.chrome" 16 webapk_runtime_host = "com.google.android.apps.chrome"
17 17
18 # The scope of the urls that the WebAPK can navigate to. 18 # The scope of the urls that the WebAPK can navigate to.
19 webapk_scope_url = "https://www.template.com" 19 webapk_scope_url = "https://www.template.com"
20 20
21 # Host part of |webapk_scope|. 21 # Host part of |webapk_scope|.
22 webapk_scope_url_host = "www.template.com" 22 webapk_scope_url_host = "www.template.com"
23 } 23 }
24 24
25 shell_apk_manifest_package = 25 shell_apk_manifest_package =
26 "org.chromium.webapk.$webapk_manifest_package_origin" 26 "org.chromium.webapk.$webapk_manifest_package_origin"
27 test_shell_apk_manifest_package =
28 "org.chromium.webapk.$webapk_manifest_package_origin.test"
pkotwicz 2016/06/20 19:14:43 Don't you need to hard code test_shell_apk_manifes
Xi Han 2016/06/20 20:07:23 Good point. Updated.
27 29
28 shell_apk_manifest = "$target_gen_dir/shell_apk_manifest/AndroidManifest.xml" 30 webapk_common_jinja_variables = [
31 "host_url=$webapk_start_url",
32 "scope_url=$webapk_scope_url",
33 "scope_url_host=$webapk_scope_url_host",
34 ]
35
36 webapk_jinja_variables = [
37 "manifest_package=$shell_apk_manifest_package",
38 "runtime_host=$webapk_runtime_host",
39 ]
40
41 test_webapk_jinja_variables = [
42 "manifest_package=$test_shell_apk_manifest_package",
43 "runtime_host=org.chromium.chrome",
44 ]
29 45
30 jinja_template("shell_apk_manifest") { 46 jinja_template("shell_apk_manifest") {
31 input = "AndroidManifest.xml" 47 input = "AndroidManifest.xml"
32 output = shell_apk_manifest 48 output = "$target_gen_dir/shell_apk_manifest/AndroidManifest.xml"
33 49
pkotwicz 2016/06/20 19:14:43 Nit: remove the new line
Xi Han 2016/06/20 20:07:23 Done.
34 variables = [ 50 variables = webapk_common_jinja_variables + webapk_jinja_variables
35 "manifest_package=$shell_apk_manifest_package", 51 }
36 "host_url=$webapk_start_url", 52
37 "runtime_host=$webapk_runtime_host", 53 jinja_template("test_shell_apk_manifest") {
38 "scope_url=$webapk_scope_url", 54 input = "AndroidManifest.xml"
39 "scope_url_host=$webapk_scope_url_host", 55 output = "$target_gen_dir/test_shell_apk_manifest/AndroidManifest.xml"
40 ] 56
pkotwicz 2016/06/20 19:14:43 Nit: remove the new line
Xi Han 2016/06/20 20:07:23 Done.
57 variables = webapk_common_jinja_variables + test_webapk_jinja_variables
41 } 58 }
42 59
43 android_resources("shell_apk_resources") { 60 android_resources("shell_apk_resources") {
44 resource_dirs = [ "res" ] 61 resource_dirs = [ "res" ]
45 custom_package = "org.chromium.webapk.shell_apk" 62 custom_package = "org.chromium.webapk.shell_apk"
46 } 63 }
47 64
48 android_library("dex_loader_lib") { 65 android_library("dex_loader_lib") {
49 java_files = [ "src/org/chromium/webapk/shell_apk/DexLoader.java" ] 66 java_files = [ "src/org/chromium/webapk/shell_apk/DexLoader.java" ]
50 } 67 }
51 68
52 # Template for WebAPK. When a WebAPK is generated: 69 # Template for WebAPK. When a WebAPK is generated:
53 # - Android manifest is customized to the website. 70 # - Android manifest is customized to the website.
54 # - App icon is extracted from the website and added to the APK's resources. 71 # - App icon is extracted from the website and added to the APK's resources.
55 android_apk("webapk") { 72 template("webapk_template") {
56 android_manifest = shell_apk_manifest 73 android_apk(target_name) {
57 apk_name = "WebApk.$webapk_manifest_package_origin" 74 forward_variables_from(invoker, "*")
58 java_files = [ 75 java_files = [
59 "src/org/chromium/webapk/shell_apk/MainActivity.java", 76 "src/org/chromium/webapk/shell_apk/MainActivity.java",
60 "src/org/chromium/webapk/shell_apk/WebApkServiceFactory.java", 77 "src/org/chromium/webapk/shell_apk/WebApkServiceFactory.java",
61 ] 78 ]
62 deps = [ 79 deps += [
63 ":dex_loader_lib", 80 ":dex_loader_lib",
64 ":shell_apk_manifest", 81 ":shell_apk_manifest",
65 ":shell_apk_resources", 82 ":shell_apk_resources",
66 "//chrome/android/webapk/libs/common", 83 "//chrome/android/webapk/libs/common",
67 "//chrome/android/webapk/libs/runtime_library", 84 "//chrome/android/webapk/libs/runtime_library",
68 ] 85 ]
69 if (!is_debug) { 86 if (!is_debug) {
70 proguard_enabled = true 87 proguard_enabled = true
71 proguard_configs = [ "//chrome/android/java/proguard.flags" ] 88 proguard_configs = [ "//chrome/android/java/proguard.flags" ]
89 }
72 } 90 }
73 } 91 }
74 92
93 webapk_template("webapk") {
94 android_manifest = get_target_outputs(":shell_apk_manifest")
95 android_manifest = android_manifest[1]
96 apk_name = "WebApk.$webapk_manifest_package_origin"
97
98 deps = [
99 ":shell_apk_manifest",
100 ]
101 }
102
103 # The "test_webapk" target is used for WebAPK's instrument tests in the target
104 # chrome_public_test_apk, and its runtime host package is "org.chromium.chrome".
pkotwicz 2016/06/20 19:14:43 How about: "The |test_webapk| target is used for W
Xi Han 2016/06/20 20:07:23 Sounds good to me.
105 webapk_template("test_webapk") {
106 android_manifest = get_target_outputs(":test_shell_apk_manifest")
107 android_manifest = android_manifest[1]
108 apk_name = "WebApk.$webapk_manifest_package_origin.test"
pkotwicz 2016/06/20 19:14:43 Can you hard code apk_name? TestWebApk maybe?
Xi Han 2016/06/20 20:07:23 Done.
109
110 deps = [
111 ":test_shell_apk_manifest",
112 ]
113 }
114
75 android_library("shell_apk_javatests") { 115 android_library("shell_apk_javatests") {
76 testonly = true 116 testonly = true
77 java_files = 117 java_files =
78 [ "javatests/src/org/chromium/webapk/shell_apk/DexLoaderTest.java" ] 118 [ "javatests/src/org/chromium/webapk/shell_apk/DexLoaderTest.java" ]
79 deps = [ 119 deps = [
80 ":dex_loader_lib", 120 ":dex_loader_lib",
81 "//base:base_java", 121 "//base:base_java",
82 "//base:base_java_test_support", 122 "//base:base_java_test_support",
83 "//chrome/android/webapk/libs/common", 123 "//chrome/android/webapk/libs/common",
84 "//content/public/test/android:content_java_test_support", 124 "//content/public/test/android:content_java_test_support",
85 ] 125 ]
86 srcjar_deps = [ "javatests/dex_optimizer:dex_optimizer_service_aidl" ] 126 srcjar_deps = [ "javatests/dex_optimizer:dex_optimizer_service_aidl" ]
87 } 127 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698