# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
import("//third_party/icu/config.gni")
import("//third_party/jni_zero/jni_zero.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 = [
"java/src/org/chromium/content_shell/Shell.java",
"java/src/org/chromium/content_shell/ShellManager.java",
]
}
shared_library_with_jni("libcontent_shell_content_view") {
testonly = true
deps = [
":content_shell_jni_headers",
"//components/crash/content/browser",
"//content/shell:content_shell_app",
"//content/shell:content_shell_lib",
"//content/shell:pak",
"//media",
"//skia",
]
# Explicit dependency required for JNI registration to be able to
# find the native side functions.
if (is_component_build) {
deps += [
"//device/gamepad",
"//media/midi",
]
}
sources = [ "shell_library_loader.cc" ]
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
configs += [ "//build/config/android:hide_all_but_jni" ]
java_targets = [ ":content_shell_apk" ]
}
shared_library_with_jni("libcontent_native_test") {
testonly = true
deps = [
"//base",
"//base:base_javatests_lib",
"//content/public/test/android:content_native_test_support",
"//content/shell:content_shell_app",
"//content/shell:content_shell_lib",
]
sources = [ "shell_test_library_loader.cc" ]
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
configs += [ "//build/config/android:hide_all_but_jni" ]
java_targets = [ ":content_shell_test_apk__test_apk" ]
}
android_resources("content_shell_java_resources") {
testonly = true
sources = [
"java/res/drawable/ic_refresh.png",
"java/res/drawable/progress.xml",
"java/res/layout/shell_view.xml",
"java/res/mipmap-hdpi/app_icon.png",
"java/res/mipmap-mdpi/app_icon.png",
"java/res/mipmap-xhdpi/app_icon.png",
"java/res/mipmap-xxhdpi/app_icon.png",
"java/res/mipmap-xxxhdpi/app_icon.png",
"java/res/values/strings.xml",
]
}
android_library("content_shell_java") {
testonly = true
resources_package = "org.chromium.content_shell"
deps = [
":content_shell_java_resources",
":content_shell_manifest",
"//base:base_java",
"//build/android:build_java",
"//components/download/internal/common:internal_java",
"//components/embedder_support/android:content_view_java",
"//components/embedder_support/android:view_java",
"//components/viz/service:service_java",
"//content/public/android:content_java",
"//media/base/android:media_java",
"//media/capture/video/android:capture_java",
"//mojo/public/java:system_java",
"//net/android:net_java",
"//third_party/jni_zero:jni_zero_java",
"//ui/android:ui_java",
"//ui/base/cursor/mojom:cursor_type_java",
"//url:gurl_java",
]
srcjar_deps = [ ":content_shell_jni_headers" ]
sources = [
"java/src/org/chromium/content_shell/Shell.java",
"java/src/org/chromium/content_shell/ShellManager.java",
"java/src/org/chromium/content_shell/ShellViewAndroidDelegate.java",
]
}
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") {
testonly = true
sources = [
"shell_apk/res/layout/content_shell_activity.xml",
"shell_apk/res/values/strings.xml",
]
deps = [ ":content_shell_java_resources" ]
}
android_library("content_shell_apk_java") {
testonly = true
srcjar_deps = [ ":content_javatests_aidl" ]
resources_package = "org.chromium.content_shell_apk"
deps = [
":content_shell_apk_resources",
":content_shell_java",
":content_shell_manifest",
"//base:base_java",
"//base:process_launcher_java",
"//build/android:build_java",
"//components/embedder_support/android:view_java",
"//content/public/android:content_java",
"//media/capture/video/android:capture_java",
"//net/android:net_java",
"//third_party/android_deps:com_google_code_findbugs_jsr305_java",
"//ui/android:ui_java",
"//url:gurl_java",
]
sources = [
"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/ContentShellActivity.java",
"shell_apk/src/org/chromium/content_shell_apk/ContentShellApplication.java",
"shell_apk/src/org/chromium/content_shell_apk/TestChildProcessService.java",
"shell_apk/src/org/chromium/content_shell_apk/TestChildProcessService0.java",
"shell_apk/src/org/chromium/content_shell_apk/TestChildProcessService1.java",
]
}
android_aidl("content_javatests_aidl") {
import_include = [ "shell_apk/src" ]
sources =
[ "shell_apk/src/org/chromium/content_shell_apk/IChildProcessTest.aidl" ]
}
android_assets("content_shell_assets") {
testonly = true
sources = [ "$root_out_dir/content_shell.pak" ]
disable_compression = true
deps = [
"//content/shell:pak",
"//gin:v8_snapshot_assets",
"//third_party/icu:icu_assets",
]
}
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_test_support",
"//components/crash/android:java",
"//components/crash/core/app:chrome_crashpad_handler_named_as_so",
"//components/metrics:metrics_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"
android_manifest = content_shell_manifest
android_manifest_dep = ":content_shell_manifest"
shared_libraries = [ ":libcontent_shell_content_view" ]
srcjar_deps = [ ":libcontent_shell_content_view__jni_registration" ]
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" ]
srcjar_deps = [ ":libcontent_native_test__jni_registration" ]
deps = [
"//base:base_java_test_support",
"//base:base_javatests",
"//content/public/android:content_javatests",
"//net/android:net_tests_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" ]
}
additional_apks = [ "//net/android:net_test_support_apk" ]
# TODO(crbug.com/40137544): Fix tests that break when this is increased.
target_sdk_version = 24
}
android_library("content_shell_test_java") {
testonly = true
deps = [
":content_shell_apk_java",
":content_shell_java",
"//base:base_java",
"//base:base_java_test_support",
"//content/public/android:content_java",
"//content/public/test/android:content_java_test_support",
"//content/shell/android:content_shell_java",
"//mojo/public/java/system:test_support_java",
"//third_party/androidx:androidx_test_monitor_java",
"//third_party/androidx:androidx_test_runner_java",
"//third_party/hamcrest:hamcrest_java",
"//third_party/junit:junit",
"//ui/android:ui_java",
"//url:gurl_java",
]
sources = [
"javatests/src/org/chromium/content_shell_apk/ContentShellActivityTestRule.java",
"javatests/src/org/chromium/content_shell_apk/ContentShellPreconditionsTest.java",
"javatests/src/org/chromium/content_shell_apk/ContentShellShellManagementTest.java",
"javatests/src/org/chromium/content_shell_apk/ContentShellUrlTest.java",
]
}
android_library("content_shell_browsertests_java") {
testonly = true
deps = [
":content_shell_java",
"//base:base_java",
"//content/public/android:content_java",
"//testing/android/native_test:native_browser_test_java",
"//third_party/androidx:androidx_core_core_java",
"//ui/android:ui_java",
]
sources = [ "browsertests/src/org/chromium/content_shell/browsertests/ContentShellBrowserTestActivity.java" ]
}