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") {
android_library("content_javatests") {
testonly = true
srcjar_deps = [
"//content/shell/android:content_javatests_aidl",
"//ui/base:ui_base_cursor_type_java_enums_srcjar",
]
deps = [
":content_java",
"//base:base_java",
......
......@@ -38,7 +38,7 @@ import java.util.concurrent.TimeoutException;
public class ChildProcessLauncherTest {
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 =
"org.chromium.content_shell_apk.TestChildProcessService";
private static final String SERVICE_COUNT_META_DATA_KEY =
......
......@@ -10,6 +10,8 @@ import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
content_shell_manifest =
"$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") {
sources = [
......@@ -97,6 +99,15 @@ jinja_template("content_shell_manifest") {
testonly = true
input = "shell_apk/AndroidManifest.xml.jinja2"
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") {
......@@ -105,8 +116,7 @@ android_resources("content_shell_apk_resources") {
deps = [
":content_shell_java_resources",
]
android_manifest = content_shell_manifest
android_manifest_dep = ":content_shell_manifest"
custom_package = "org.chromium.content_shell_apk"
}
android_library("content_shell_apk_java") {
......@@ -127,8 +137,6 @@ android_library("content_shell_apk_java") {
"//ui/android:ui_java",
]
android_manifest_for_lint = content_shell_manifest
java_files = [
"shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestHelperService.java",
"shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestUtils.java",
......@@ -164,32 +172,64 @@ android_assets("content_shell_assets") {
}
}
android_apk("content_shell_apk") {
testonly = true
deps = [
":content_shell_apk_java",
":content_shell_assets",
":content_shell_java",
"//base:base_java",
"//base:base_java_test_support",
"//components/crash/android:java",
"//components/crash/content/app:chrome_crashpad_handler_named_as_so",
"//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",
]
template("content_shell_apk_tmpl") {
_target_type = invoker.target_type
target(_target_type, target_name) {
forward_variables_from(invoker, "*")
testonly = true
if (!defined(deps)) {
deps = []
}
deps += [
":content_shell_apk_java",
":content_shell_assets",
":content_shell_java",
"//base:base_java",
"//base:base_java_test_support",
"//components/crash/android:java",
"//components/crash/content/app:chrome_crashpad_handler_named_as_so",
"//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"
android_manifest = content_shell_manifest
android_manifest_dep = ":content_shell_manifest"
shared_libraries = [ ":libcontent_shell_content_view" ]
loadable_modules = [ "$root_out_dir/libchrome_crashpad_handler.so" ]
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") {
testonly = true
deps = [
......@@ -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") {
chromium_linker_test_manifest =
"$target_gen_dir/linker_test_apk/AndroidManifest.xml"
......
<?xml version="1.0" encoding="utf-8"?>
<!-- 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
in the LICENSE file. -->
<!-- package name must be unique so suffix with "tests" so package loader
doesn't ignore this. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.chromium.content_shell_apk.tests">
{% extends "content/shell/android/shell_apk/AndroidManifest.xml.jinja2" %}
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{% block application_label %}Content Shell Test{% endblock %}
{% block extra_uses_permissions %}
<uses-permission android:name="android.permission.RUN_INSTRUMENTATION" />
<!-- We add an application tag here just so that we can indicate that this
package needs to link against the android.test library, which is
needed when building test cases. -->
<application>
{% endblock %}
{% block extra_application_definitions_for_test %}
<uses-library android:name="android.test.runner" />
<activity android:name="org.chromium.test.broker.OnDeviceInstrumentationBroker"
android:exported="true"/>
</application>
{% endblock %}
{% block extra_root_definitions %}
<instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner"
android:targetPackage="org.chromium.content_shell_apk"
android:label="JUnit4-based tests for org.chromium.content_shell_apk" />
</manifest>
android:targetPackage="{{manifest_package}}"
android:label="JUnit4-based tests for content shell" />
{% endblock %}
......@@ -7,7 +7,7 @@
-->
<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_NETWORK_STATE"/>
......@@ -19,10 +19,13 @@
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<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:label="Content Shell">
<activity android:name="ContentShellActivity"
android:label="{% block application_label %}Content Shell{% endblock %}">
<activity android:name="org.chromium.content_shell_apk.ContentShellActivity"
android:launchMode="singleTask"
android:theme="@android:style/Theme.Holo.Light.NoActionBar"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize"
......@@ -81,6 +84,10 @@
android:isolatedProcess="true"
android:exported="false" />
{% endfor %}
{% block extra_application_definitions_for_test %}
{% endblock %}
</application>
{% block extra_root_definitions %}
{% endblock %}
</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