Commit 29210123 authored by Eric Stevenson's avatar Eric Stevenson Committed by Commit Bot

Android: Refactor content shell to not use apk_under_test.

Necessary for converting test JNI in content to use proxy natives.

Bug: 997199, 890452
Change-Id: Id08769bcc349204e35dc1324dda659905f0c3311
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1888379Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Commit-Queue: Yaron Friedman <yfriedman@chromium.org>
Auto-Submit: Eric Stevenson <estevenson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712783}
parent d6bdfe78
...@@ -453,11 +453,6 @@ group("jni") { ...@@ -453,11 +453,6 @@ group("jni") {
android_library("content_javatests") { android_library("content_javatests") {
testonly = true testonly = true
srcjar_deps = [
"//content/shell/android:content_javatests_aidl",
"//ui/base:ui_base_cursor_type_java_enums_srcjar",
]
deps = [ deps = [
":content_java", ":content_java",
"//base:base_java", "//base:base_java",
......
...@@ -38,7 +38,7 @@ import java.util.concurrent.TimeoutException; ...@@ -38,7 +38,7 @@ import java.util.concurrent.TimeoutException;
public class ChildProcessLauncherTest { public class ChildProcessLauncherTest {
private static final long CONDITION_WAIT_TIMEOUT_MS = 5000; private static final long CONDITION_WAIT_TIMEOUT_MS = 5000;
private static final String SERVICE_PACKAGE_NAME = "org.chromium.content_shell_apk"; private static final String SERVICE_PACKAGE_NAME = "org.chromium.content_shell_apk.tests";
private static final String SERVICE_NAME = private static final String SERVICE_NAME =
"org.chromium.content_shell_apk.TestChildProcessService"; "org.chromium.content_shell_apk.TestChildProcessService";
private static final String SERVICE_COUNT_META_DATA_KEY = private static final String SERVICE_COUNT_META_DATA_KEY =
......
...@@ -10,6 +10,8 @@ import("//tools/v8_context_snapshot/v8_context_snapshot.gni") ...@@ -10,6 +10,8 @@ import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
content_shell_manifest = content_shell_manifest =
"$target_gen_dir/content_shell_manifest/AndroidManifest.xml" "$target_gen_dir/content_shell_manifest/AndroidManifest.xml"
content_shell_test_manifest =
"$target_gen_dir/content_shell_test_manifest/AndroidManifest.xml"
generate_jni("content_shell_jni_headers") { generate_jni("content_shell_jni_headers") {
sources = [ sources = [
...@@ -97,6 +99,15 @@ jinja_template("content_shell_manifest") { ...@@ -97,6 +99,15 @@ jinja_template("content_shell_manifest") {
testonly = true testonly = true
input = "shell_apk/AndroidManifest.xml.jinja2" input = "shell_apk/AndroidManifest.xml.jinja2"
output = content_shell_manifest output = content_shell_manifest
variables = [ "manifest_package=org.chromium.content_shell_apk" ]
}
jinja_template("content_shell_test_manifest") {
testonly = true
input = "javatests/AndroidManifest.xml"
includes = [ "shell_apk/AndroidManifest.xml.jinja2" ]
output = content_shell_test_manifest
variables = [ "manifest_package=org.chromium.content_shell_apk.tests" ]
} }
android_resources("content_shell_apk_resources") { android_resources("content_shell_apk_resources") {
...@@ -105,8 +116,7 @@ android_resources("content_shell_apk_resources") { ...@@ -105,8 +116,7 @@ android_resources("content_shell_apk_resources") {
deps = [ deps = [
":content_shell_java_resources", ":content_shell_java_resources",
] ]
android_manifest = content_shell_manifest custom_package = "org.chromium.content_shell_apk"
android_manifest_dep = ":content_shell_manifest"
} }
android_library("content_shell_apk_java") { android_library("content_shell_apk_java") {
...@@ -127,8 +137,6 @@ android_library("content_shell_apk_java") { ...@@ -127,8 +137,6 @@ android_library("content_shell_apk_java") {
"//ui/android:ui_java", "//ui/android:ui_java",
] ]
android_manifest_for_lint = content_shell_manifest
java_files = [ java_files = [
"shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestHelperService.java", "shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestHelperService.java",
"shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestUtils.java", "shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestUtils.java",
...@@ -164,32 +172,64 @@ android_assets("content_shell_assets") { ...@@ -164,32 +172,64 @@ android_assets("content_shell_assets") {
} }
} }
android_apk("content_shell_apk") { template("content_shell_apk_tmpl") {
testonly = true _target_type = invoker.target_type
deps = [ target(_target_type, target_name) {
":content_shell_apk_java", forward_variables_from(invoker, "*")
":content_shell_assets", testonly = true
":content_shell_java", if (!defined(deps)) {
"//base:base_java", deps = []
"//base:base_java_test_support", }
"//components/crash/android:java", deps += [
"//components/crash/content/app:chrome_crashpad_handler_named_as_so", ":content_shell_apk_java",
"//content/public/android:content_java", ":content_shell_assets",
"//content/public/test/android:android_test_message_pump_support_java", ":content_shell_java",
"//media/capture/video/android:capture_java", "//base:base_java",
"//net/android:net_java", "//base:base_java_test_support",
"//services/shape_detection:shape_detection_java", "//components/crash/android:java",
"//third_party/mesa_headers", "//components/crash/content/app:chrome_crashpad_handler_named_as_so",
"//ui/android:ui_java", "//content/public/android:content_java",
] "//content/public/test/android:android_test_message_pump_support_java",
"//media/capture/video/android:capture_java",
"//net/android:net_java",
"//services/shape_detection:shape_detection_java",
"//third_party/mesa_headers",
"//ui/android:ui_java",
]
loadable_modules = [ "$root_out_dir/libchrome_crashpad_handler.so" ]
}
}
content_shell_apk_tmpl("content_shell_apk") {
target_type = "android_apk"
apk_name = "ContentShell" apk_name = "ContentShell"
android_manifest = content_shell_manifest android_manifest = content_shell_manifest
android_manifest_dep = ":content_shell_manifest" android_manifest_dep = ":content_shell_manifest"
shared_libraries = [ ":libcontent_shell_content_view" ] shared_libraries = [ ":libcontent_shell_content_view" ]
loadable_modules = [ "$root_out_dir/libchrome_crashpad_handler.so" ]
command_line_flags_file = "content-shell-command-line" command_line_flags_file = "content-shell-command-line"
} }
content_shell_apk_tmpl("content_shell_test_apk") {
target_type = "instrumentation_test_apk"
apk_name = "ContentShellTest"
android_manifest = content_shell_test_manifest
android_manifest_dep = ":content_shell_test_manifest"
shared_libraries = [ ":libcontent_native_test" ]
deps = [
"//base:base_java_test_support",
"//base:base_javatests",
"//content/public/android:content_javatests",
"//net/android:net_javatests",
"//third_party/android_support_test_runner:runner_java",
]
data_deps = [
"//testing/buildbot/filters:content_shell_test_apk_filters",
]
if (enable_chrome_android_internal) {
data_deps += [ "//clank/build/bot/filters:content_shell_test_apk_filters" ]
}
}
android_library("content_shell_test_java") { android_library("content_shell_test_java") {
testonly = true testonly = true
deps = [ deps = [
...@@ -214,32 +254,6 @@ android_library("content_shell_test_java") { ...@@ -214,32 +254,6 @@ android_library("content_shell_test_java") {
] ]
} }
instrumentation_test_apk("content_shell_test_apk") {
deps = [
"//base:base_java_test_support",
"//base:base_javatests",
"//content/public/android:content_javatests",
"//net/android:net_javatests",
"//third_party/android_support_test_runner:runner_java",
]
apk_under_test = ":content_shell_apk"
apk_name = "ContentShellTest"
# Explicitly disabling multidex since there are build errors with this
# apk_under_test providing the same classes as the instrumentation_test_apk.
enable_multidex = false
shared_libraries = [ ":libcontent_native_test" ]
android_manifest = "javatests/AndroidManifest.xml"
data_deps = [
"//testing/buildbot/filters:content_shell_test_apk_filters",
]
if (enable_chrome_android_internal) {
data_deps += [ "//clank/build/bot/filters:content_shell_test_apk_filters" ]
}
}
if (current_cpu != "x64") { if (current_cpu != "x64") {
chromium_linker_test_manifest = chromium_linker_test_manifest =
"$target_gen_dir/linker_test_apk/AndroidManifest.xml" "$target_gen_dir/linker_test_apk/AndroidManifest.xml"
......
<?xml version="1.0" encoding="utf-8"?> {% extends "content/shell/android/shell_apk/AndroidManifest.xml.jinja2" %}
<!-- Copyright (c) 2012 The Chromium Authors. All rights reserved. Use of
this source code is governed by a BSD-style license that can be found # Copyright 2019 The Chromium Authors. All rights reserved.
in the LICENSE file. --> # Use of this source code is governed by a BSD-style license that can be
<!-- package name must be unique so suffix with "tests" so package loader # found in the LICENSE file.
doesn't ignore this. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" {% block application_label %}Content Shell Test{% endblock %}
package="org.chromium.content_shell_apk.tests">
{% block extra_uses_permissions %}
<uses-permission android:name="android.permission.RUN_INSTRUMENTATION" /> <uses-permission android:name="android.permission.RUN_INSTRUMENTATION" />
<!-- We add an application tag here just so that we can indicate that this {% endblock %}
package needs to link against the android.test library, which is
needed when building test cases. --> {% block extra_application_definitions_for_test %}
<application>
<uses-library android:name="android.test.runner" /> <uses-library android:name="android.test.runner" />
<activity android:name="org.chromium.test.broker.OnDeviceInstrumentationBroker" <activity android:name="org.chromium.test.broker.OnDeviceInstrumentationBroker"
android:exported="true"/> android:exported="true"/>
</application> {% endblock %}
{% block extra_root_definitions %}
<instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner" <instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner"
android:targetPackage="org.chromium.content_shell_apk" android:targetPackage="{{manifest_package}}"
android:label="JUnit4-based tests for org.chromium.content_shell_apk" /> android:label="JUnit4-based tests for content shell" />
</manifest> {% endblock %}
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.chromium.content_shell_apk"> package="{{ manifest_package }}">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
...@@ -19,10 +19,13 @@ ...@@ -19,10 +19,13 @@
<uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application android:name="ContentShellApplication" {% block extra_uses_permissions %}
{% endblock %}
<application android:name="org.chromium.content_shell_apk.ContentShellApplication"
android:icon="@mipmap/app_icon" android:icon="@mipmap/app_icon"
android:label="Content Shell"> android:label="{% block application_label %}Content Shell{% endblock %}">
<activity android:name="ContentShellActivity" <activity android:name="org.chromium.content_shell_apk.ContentShellActivity"
android:launchMode="singleTask" android:launchMode="singleTask"
android:theme="@android:style/Theme.Holo.Light.NoActionBar" android:theme="@android:style/Theme.Holo.Light.NoActionBar"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize" android:configChanges="orientation|keyboardHidden|keyboard|screenSize"
...@@ -81,6 +84,10 @@ ...@@ -81,6 +84,10 @@
android:isolatedProcess="true" android:isolatedProcess="true"
android:exported="false" /> android:exported="false" />
{% endfor %} {% endfor %}
{% block extra_application_definitions_for_test %}
{% endblock %}
</application> </application>
{% block extra_root_definitions %}
{% endblock %}
</manifest> </manifest>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment