1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170

android_webview / tools / system_webview_shell / BUILD.gn [blame]

# 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/JankActivity.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_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_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_monitor_java",
    "//third_party/androidx:androidx_test_runner_java",
    "//third_party/junit",
  ]
  data = [
    "test/data/",
    "//third_party/chromium-variations",
  ]

  # 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
}