# Copyright 2015 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/rules.gni") import("//testing/test.gni") # Mark all targets as test only. testonly = true group("system_webview_shell") { deps = [ ":system_webview_shell_apk", ":system_webview_shell_layout_test_apk", ":system_webview_shell_page_cycler_apk", ] } declare_args() { # Android package name to use for system_webview_shell_apk (the WebView shell # browser). You can change this package name to work around signing key # conflicts (INSTALL_FAILED_UPDATE_INCOMPATIBLE) on devices/emulators which # have the shell browser preinstalled under the default package name. system_webview_shell_package_name = "org.chromium.webview_shell" } system_webview_shell_android_manifest = "$root_gen_dir/android_webview/system_webview_shell_apk/AndroidManifest.xml" layout_tests_android_manifest = "$root_gen_dir/android_webview/system_webview_shell_apk/layout_tests/AndroidManifest.xml" page_cycler_tests_android_manifest = "$root_gen_dir/android_webview/system_webview_shell_apk/page_cycler/AndroidManifest.xml" android_apk("system_webview_shell_apk") { apk_name = "SystemWebViewShell" android_manifest = system_webview_shell_android_manifest android_manifest_dep = ":system_webview_shell_manifest" deps = [ ":system_webview_shell_apk_java", ":system_webview_shell_apk_resources", ] enable_lint = true min_sdk_version = min_supported_sdk_version lint_baseline_file = "lint-baseline.xml" lint_suppressions_file = "lint-suppressions.xml" } android_library("system_webview_shell_apk_java") { testonly = true sources = [ "apk/src/org/chromium/webview_shell/EdgeToEdgeUtil.java", "apk/src/org/chromium/webview_shell/FullscreenActivity.java", "apk/src/org/chromium/webview_shell/InspectUserActionsActivity.java", "apk/src/org/chromium/webview_shell/JankActivity.java", "apk/src/org/chromium/webview_shell/ManuallyTriggeredStartupActivity.java", "apk/src/org/chromium/webview_shell/MultiFileSelector.java", "apk/src/org/chromium/webview_shell/PageCyclerTestActivity.java", "apk/src/org/chromium/webview_shell/StartupTimeActivity.java", "apk/src/org/chromium/webview_shell/TelemetryActivity.java", "apk/src/org/chromium/webview_shell/TelemetryMemoryPressureActivity.java", "apk/src/org/chromium/webview_shell/WebPlatformTestsActivity.java", "apk/src/org/chromium/webview_shell/WebViewAnimationTestActivity.java", "apk/src/org/chromium/webview_shell/WebViewBrowserActivity.java", "apk/src/org/chromium/webview_shell/WebViewBrowserFragment.java", "apk/src/org/chromium/webview_shell/WebViewBrowserSecondProcessActivity.java", "apk/src/org/chromium/webview_shell/WebViewCreateDestroyActivity.java", "apk/src/org/chromium/webview_shell/WebViewLayoutTestActivity.java", "apk/src/org/chromium/webview_shell/WebViewMultiProfileBrowserActivity.java", "apk/src/org/chromium/webview_shell/WebViewThreadTestActivity.java", "apk/src/org/chromium/webview_shell/WebViewTracingActivity.java", "apk/src/org/chromium/webview_shell/WebViewWithClipPath.java", ] deps = [ ":system_webview_shell_apk_resources", "//base:base_java", "//net/android:net_java", "//third_party/android_deps:guava_android_java", "//third_party/androidx:androidx_activity_activity_java", "//third_party/androidx:androidx_annotation_annotation_experimental_java", "//third_party/androidx:androidx_annotation_annotation_java", "//third_party/androidx:androidx_appcompat_appcompat_java", "//third_party/androidx:androidx_core_core_java", "//third_party/androidx:androidx_fragment_fragment_java", "//third_party/androidx:androidx_savedstate_savedstate_java", "//third_party/androidx:androidx_webkit_webkit_java", ] resources_package = "org.chromium.webview_shell" } jinja_template("system_webview_shell_manifest") { input = "apk/AndroidManifest.xml" output = system_webview_shell_android_manifest variables = [ "manifest_package=$system_webview_shell_package_name" ] } jinja_template("layout_tests_manifest") { input = "layout_tests/AndroidManifest.xml" output = layout_tests_android_manifest variables = [ "target_package=$system_webview_shell_package_name" ] } jinja_template("page_cycler_tests_manifest") { input = "page_cycler/AndroidManifest.xml" output = page_cycler_tests_android_manifest variables = [ "target_package=$system_webview_shell_package_name" ] } android_resources("system_webview_shell_apk_resources") { sources = [ "apk/res/drawable-mdpi/breadcrumb_arrow_black.png", "apk/res/drawable-mdpi/ic_launcher.png", "apk/res/layout/activity_empty.xml", "apk/res/layout/activity_inspect_user_actions.xml", "apk/res/layout/activity_web_platform_tests.xml", "apk/res/layout/activity_web_platform_tests_child.xml", "apk/res/layout/activity_webview.xml", "apk/res/layout/activity_webview_animation_test.xml", "apk/res/layout/activity_webview_browser.xml", "apk/res/layout/activity_webview_multi_profile.xml", "apk/res/layout/fragment_webview_browser.xml", "apk/res/menu/main_menu.xml", "apk/res/values-night/colors.xml", "apk/res/values-v17/styles.xml", "apk/res/values-v29/styles.xml", "apk/res/values/colors.xml", "apk/res/values/ids.xml", "apk/res/values/strings.xml", "apk/res/values/styles.xml", "apk/res/xml/ad_services_config.xml", "apk/res/xml/network_security_config.xml", ] } instrumentation_test_apk("system_webview_shell_page_cycler_apk") { apk_name = "SystemWebViewShellPageCycler" apk_under_test = ":system_webview_shell_apk" android_manifest = page_cycler_tests_android_manifest android_manifest_dep = ":page_cycler_tests_manifest" sources = [ "page_cycler/src/org/chromium/webview_shell/page_cycler/PageCyclerTest.java" ] deps = [ ":system_webview_shell_apk_java", "//base:base_java_test_support", "//content/public/android:content_java", "//content/public/test/android:content_java_test_support", "//third_party/androidx:androidx_test_monitor_java", "//third_party/androidx:androidx_test_runner_java", "//third_party/junit", ] } instrumentation_test_apk("system_webview_shell_layout_test_apk") { apk_name = "SystemWebViewShellLayoutTest" apk_under_test = ":system_webview_shell_apk" android_manifest = layout_tests_android_manifest android_manifest_dep = ":layout_tests_manifest" sources = [ "layout_tests/src/org/chromium/webview_shell/test/WebPlatformTestsActivityTest.java", "layout_tests/src/org/chromium/webview_shell/test/WebViewLayoutTest.java", "layout_tests/src/org/chromium/webview_shell/test/WebViewThreadTest.java", ] deps = [ ":system_webview_shell_apk_java", "//base:base_java", "//base:base_java_test_support", "//third_party/androidx:androidx_test_core_java", "//third_party/androidx:androidx_test_monitor_java", "//third_party/androidx:androidx_test_runner_java", "//third_party/junit", ] data = [ "test/data/", "//components/variations/test_data/cipd", ] # Tell GN to ignore 'incremental_install' even if the user has it in their GN # args because it's incompatible with 'use_webview_provider'. never_incremental = true use_webview_provider = system_webview_apk_target }