chromium/android_webview/test/BUILD.gn

# 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("//android_webview/system_webview_apk_tmpl.gni")
import("//android_webview/test/shared.gni")
import("//android_webview/variables.gni")
import("//build/config/android/rules.gni")
import("//build/config/python.gni")
import("//device/vr/buildflags/buildflags.gni")
import("//testing/test.gni")
import("//third_party/jni_zero/jni_zero.gni")

# Mark all targets as test only.
testonly = true

group("test") {
  deps = [
    ":android_webview_junit_tests",
    ":android_webview_unittests",
    ":webview_instrumentation_test_apk",
  ]
}

python_library("webview_cts_tests") {
  pydeps_file = "//android_webview/tools/run_cts.pydeps"
  deps = [ "//android_webview:system_webview_apk" ]
  data_deps = [
    "//build/android:test_runner_py",
    "//testing/buildbot/filters:webview_cts_tests_filters",
  ]
  data = [ "//android_webview/tools/cts_config/" ]
}

python_library("webview_trichrome_cts_tests") {
  pydeps_file = "//android_webview/tools/run_cts.pydeps"
  deps = [ "//android_webview:trichrome_webview_apk" ]
  data_deps = [ "//build/android:test_runner_py" ]
  data = [ "//android_webview/tools/cts_config/" ]
}

if (android_64bit_target_cpu) {
  python_library("webview_64_cts_tests") {
    pydeps_file = "//android_webview/tools/run_cts.pydeps"
    deps = [ "//android_webview:system_webview_64_apk" ]
    data_deps = [
      "//build/android:test_runner_py",
      "//testing/buildbot/filters:webview_cts_tests_filters",
    ]
    data = [ "//android_webview/tools/cts_config/" ]
  }

  python_library("webview_trichrome_64_cts_hostside_tests") {
    pydeps_file = "//android_webview/tools/run_cts.pydeps"
    deps = [ "//android_webview:trichrome_webview_64_apk" ]
    data_deps = [ "//build/android:test_runner_py" ]
    data = [
      "//android_webview/tools/cts_config/",
      "//third_party/chromium-variations",
    ]
  }

  python_library("webview_trichrome_64_cts_tests") {
    pydeps_file = "//android_webview/tools/run_cts.pydeps"
    deps = [ "//android_webview:trichrome_webview_64_apk" ]
    data_deps = [ "//build/android:test_runner_py" ]
    data = [
      "//android_webview/tools/cts_config/",
      "//third_party/chromium-variations",
    ]
  }
}

script_test("system_webview_crx_smoke_tests") {
  script =
      "//android_webview/test/components/run_webview_component_smoketest.py"
  args = [ "--webview-package-name=$system_webview_package_name" ]
  data = [ "//android_webview/test/components/crx_smoke_tests.py" ]
  data_deps = [
    "//android_webview:system_webview_apk",
    "//android_webview/tools/system_webview_shell:system_webview_shell_apk",
  ]
}

script_test("system_webview_wpt") {
  script = "//third_party/blink/tools/run_wpt_tests.py"
  args = [
    "--product",
    "android_webview",
    "--test-type",
    "testharness",
    "reftest",
    "crashtest",
    "print-reftest",
    "--zero-tests-executed-ok",
    "--webview-provider",
    "@WrappedPath(apks/SystemWebView.apk)",
    "--browser-apk",
    "@WrappedPath(apks/SystemWebViewShell.apk)",
  ]
  data = [
    "//third_party/blink/web_tests/platform/webview/",
    "//third_party/blink/web_tests/MobileTestExpectations",
  ]
  data_deps = [
    "//android_webview:system_webview_apk",
    "//android_webview/tools/system_webview_shell:system_webview_shell_layout_test_apk",
    "//chrome/test/chromedriver:chromedriver_server($host_toolchain)",
    "//third_party/blink/tools:wpt_tests_android_isolate",
  ]
}

script_test("trichrome_webview_wpt") {
  script = "//third_party/blink/tools/run_wpt_tests.py"
  args = [
    "--product",
    "android_webview",
    "--test-type",
    "testharness",
    "reftest",
    "crashtest",
    "print-reftest",
    "--zero-tests-executed-ok",
    "--webview-provider",
    "@WrappedPath(apks/TrichromeWebView.apk)",
    "--browser-apk",
    "@WrappedPath(apks/SystemWebViewShell.apk)",
    "--additional-apk",
    "@WrappedPath(apks/TrichromeLibrary.apk)",
  ]
  data = [
    "//third_party/blink/web_tests/platform/webview/",
    "//third_party/blink/web_tests/MobileTestExpectations",
  ]
  data_deps = [
    "//android_webview:trichrome_webview_apk",
    "//android_webview/tools/system_webview_shell:system_webview_shell_layout_test_apk",
    "//chrome/test/chromedriver:chromedriver_server($host_toolchain)",
    "//third_party/blink/tools:wpt_tests_android_isolate",
  ]
}

if (android_64bit_target_cpu) {
  script_test("trichrome_webview_wpt_64") {
    script = "//third_party/blink/tools/run_wpt_tests.py"
    args = [
      "--product",
      "android_webview",
      "--test-type",
      "testharness",
      "reftest",
      "crashtest",
      "print-reftest",
      "--zero-tests-executed-ok",
      "--webview-provider",
      "@WrappedPath(apks/TrichromeWebView64.apk)",
      "--browser-apk",
      "@WrappedPath(apks/SystemWebViewShell.apk)",
      "--additional-apk",
      "@WrappedPath(apks/TrichromeLibrary64.apk)",
    ]
    data = [
      "//third_party/blink/web_tests/platform/webview/",
      "//third_party/blink/web_tests/MobileTestExpectations",
    ]
    data_deps = [
      "//android_webview:trichrome_webview_64_apk",
      "//android_webview/tools/system_webview_shell:system_webview_shell_layout_test_apk",
      "//chrome/test/chromedriver:chromedriver_server($host_toolchain)",
      "//third_party/blink/tools:wpt_tests_android_isolate",
    ]
  }
}

base_webview_instrumentation_apk("webview_instrumentation_apk") {
  deps = [
    "//android_webview:platform_service_bridge_upstream_implementation_java",
  ]
  apk_name = "WebViewInstrumentation"
}

android_resources("webview_instrumentation_apk_resources") {
  sources = [
    "../javatests/res/raw/add_two_numbers.wasm",
    "shell/res/layout/testshell_activity.xml",
    "shell/res/raw/resource_file.html",
    "shell/res/raw/resource_icon.png",
    "shell/res/values/config.xml",
    "shell/res/values/strings.xml",
    "shell/res/xml/provider_paths.xml",
  ]
}

android_assets("webview_instrumentation_apk_assets") {
  disable_compression = true
  deps = [
    "//android_webview:pak_file_assets",
    "//gin:v8_snapshot_assets",
    "//third_party/icu:icu_assets",
  ]

  sources = [
    "../javatests/assets/empty_file.js",
    "../javatests/assets/hello.html",
    "../javatests/assets/print_hello.js",
    "../javatests/assets/wrong_js.txt",
    "shell/assets/asset_file.html",
    "shell/assets/asset_icon.png",
    "shell/assets/autofill.html",
    "shell/assets/cookie_test.html",
    "shell/assets/cors.html",
    "shell/assets/full_screen_video.js",
    "shell/assets/full_screen_video_inside_div_test.html",
    "shell/assets/full_screen_video_test.html",
    "shell/assets/full_screen_video_test_not_preloaded.html",
    "shell/assets/key-system-test.html",
    "shell/assets/mod.m.js",
    "shell/assets/page_with_module.html",
    "shell/assets/star.svg",
    "shell/assets/star.svgz",
    "shell/assets/video.webm",
    "shell/assets/visual_state_during_fullscreen_test.html",
    "shell/assets/visual_state_on_page_commit_visible_test.html",
    "shell/assets/visual_state_waits_for_js_detached_test.html",
    "shell/assets/visual_state_waits_for_js_test.html",
  ]
}

generate_jni("draw_fn_impl_jni_headers") {
  sources =
      [ "shell/src/org/chromium/android_webview/shell/ContextManager.java" ]
}

android_library("draw_fn_impl_java") {
  sources =
      [ "shell/src/org/chromium/android_webview/shell/ContextManager.java" ]
  srcjar_deps = [ ":draw_fn_impl_jni_headers" ]
  deps = [ "//third_party/jni_zero:jni_zero_java" ]
}

shared_library_with_jni("libstandalonelibwebviewchromium") {
  testonly = true
  sources = [
    "shell/src/draw_fn/allocator.cc",
    "shell/src/draw_fn/allocator.h",
    "shell/src/draw_fn/context_manager.cc",
    "shell/src/draw_fn/context_manager.h",
    "shell/src/draw_fn/overlays_manager.cc",
    "shell/src/draw_fn/overlays_manager.h",
  ]
  ldflags = [ "-Wl,-shared,-Bsymbolic" ]
  deps = [
    ":draw_fn_impl_jni_headers",
    ":webview_instrumentation_test_native_jni_impl",
    "//android_webview/browser/gfx",
    "//android_webview/lib",
    "//android_webview/lib:webview_entry_point",
    "//android_webview/nonembedded",
    "//android_webview/public",
    "//base",
    "//components/android_autofill/browser/test_support:native",
    "//components/content_capture/android/test_support",
    "//components/heap_profiling/multi_process:test_support",
    "//content/public/test/android:content_native_test_support",
    "//gpu/vulkan",
    "//gpu/vulkan/init",
    "//gpu/vulkan/init:skia",
    "//ui/gl",
  ]
  libs = [ "android" ]
  configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
  configs += [ "//build/config/android:hide_all_but_jni" ]
  java_targets = [ ":webview_instrumentation_apk" ]
}

generate_jni("webview_instrumentation_test_jni") {
  testonly = true
  sources = [ "../javatests/src/org/chromium/android_webview/test/component_updater/EmbeddedComponentLoaderTest.java" ]
}

base_webview_instrumentation_test_apk("webview_instrumentation_test_apk") {
  apk_name = "WebViewInstrumentationTest"
  apk_under_test = ":webview_instrumentation_apk"

  deps = [
    "//components/android_autofill/browser:java",
    "//components/android_autofill/browser/test_support:java",
    "//components/autofill/android:autofill_java",
    "//components/autofill/core/common/mojom:mojo_types_java",
    "//components/background_task_scheduler:background_task_scheduler_task_ids_java",
    "//components/component_updater/android:component_provider_service_aidl_java",
    "//components/component_updater/android:embedded_component_loader_java",
    "//components/embedder_support/android:context_menu_java",
    "//components/heap_profiling/multi_process:heap_profiling_java_test_support",
    "//components/minidump_uploader:minidump_uploader_java",
    "//components/minidump_uploader:minidump_uploader_java_test_support",
    "//components/policy/android:policy_java",
    "//components/policy/android:policy_java_test_support",
    "//components/safe_browsing/android:safe_browsing_java",
    "//services/device/public/java:geolocation_java",
    "//services/device/public/java:geolocation_java_test_support",
    "//third_party/androidx:androidx_privacysandbox_ads_ads_adservices_java",
    "//third_party/androidx:androidx_privacysandbox_ads_ads_adservices_java_java",
    "//third_party/androidx_javascriptengine:javascriptengine_common_java",
    "//third_party/androidx_javascriptengine:javascriptengine_java",
    "//ui/accessibility:ax_base_java",
  ]
  sources = [
    "../javatests/src/org/chromium/android_webview/test/AcceptLanguageTest.java",
    "../javatests/src/org/chromium/android_webview/test/AndroidAutofillSafeModeTest.java",
    "../javatests/src/org/chromium/android_webview/test/AndroidProtocolHandlerTest.java",
    "../javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java",
    "../javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java",
    "../javatests/src/org/chromium/android_webview/test/ApiImplementationLoggerTest.java",
    "../javatests/src/org/chromium/android_webview/test/ArchiveTest.java",
    "../javatests/src/org/chromium/android_webview/test/AttributionReportingTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwAutofillTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwBackForwardCacheTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwBrowserContextFormDataTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentCaptureTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsAnchorViewTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsClientAutoLoginTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsClientCallbackHelperTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsClientFaviconTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsClientGetDefaultVideoPosterTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsClientOnFormResubmissionTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsClientOnRenderProcessGoneTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsClientOnRendererUnresponsiveTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsClientOnScaleChangedTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsClientOnUnhandledKeyEventTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsClientVisitedHistoryTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsContainerViewTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsGarbageCollectionTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsLifecycleNotifierTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsOriginMatcherTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsStaticsTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwContentsTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwCrashyClassUtilsTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwDarkModeTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwDisplayCutoutTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwFileChooserTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwImeTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwJavaBridgeTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwKeyboardShortcutsTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwLegacyQuirksTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwMediaIntegrityApiStatusConfigTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwMediaIntegrityApiTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwMetricsIntegrationTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwMetricsLogUploaderTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwNetworkConfigurationTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwPacProcessorTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwPageLoadMetricsTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwParameterizedTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwPermissionManagerTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwPermissionQueryApiTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwPersistentOriginTrialTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwPrerenderTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwProxyControllerTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwQuotaManagerBridgeTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwSecondBrowserProcessTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwServiceWorkerClientTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwServiceWorkerSettingsTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwSettingsTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwStrictModeTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwSupervisedUserTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwUncaughtExceptionTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwVariationsSeedFetcherTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwWebContentsObserverTest.java",
    "../javatests/src/org/chromium/android_webview/test/AwZoomTest.java",
    "../javatests/src/org/chromium/android_webview/test/CleanupReferenceTest.java",
    "../javatests/src/org/chromium/android_webview/test/ClearHistoryTest.java",
    "../javatests/src/org/chromium/android_webview/test/ClientAddMessageToConsoleTest.java",
    "../javatests/src/org/chromium/android_webview/test/ClientHintsTest.java",
    "../javatests/src/org/chromium/android_webview/test/ClientOnPageFinishedTest.java",
    "../javatests/src/org/chromium/android_webview/test/ClientOnPageStartedTest.java",
    "../javatests/src/org/chromium/android_webview/test/ClientOnReceivedError2Test.java",
    "../javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java",
    "../javatests/src/org/chromium/android_webview/test/ClientOnReceivedHttpErrorTest.java",
    "../javatests/src/org/chromium/android_webview/test/ConsoleMessagesForBlockedLoadsTest.java",
    "../javatests/src/org/chromium/android_webview/test/ContentViewMiscTest.java",
    "../javatests/src/org/chromium/android_webview/test/ContextMenuTest.java",
    "../javatests/src/org/chromium/android_webview/test/CookieManagerStartupTest.java",
    "../javatests/src/org/chromium/android_webview/test/CookieManagerTest.java",
    "../javatests/src/org/chromium/android_webview/test/DarkModeTest.java",
    "../javatests/src/org/chromium/android_webview/test/DisableOriginTrialsSafeModeTest.java",
    "../javatests/src/org/chromium/android_webview/test/FencedFrameTest.java",
    "../javatests/src/org/chromium/android_webview/test/FullScreenVideoTestAwContentsClient.java",
    "../javatests/src/org/chromium/android_webview/test/GeolocationTest.java",
    "../javatests/src/org/chromium/android_webview/test/GetTitleTest.java",
    "../javatests/src/org/chromium/android_webview/test/HeapProfilingTest.java",
    "../javatests/src/org/chromium/android_webview/test/HttpAuthDatabaseTest.java",
    "../javatests/src/org/chromium/android_webview/test/JsJavaInteractionTest.java",
    "../javatests/src/org/chromium/android_webview/test/KeySystemTest.java",
    "../javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java",
    "../javatests/src/org/chromium/android_webview/test/LoadUrlTest.java",
    "../javatests/src/org/chromium/android_webview/test/ManifestMetadataUtilTest.java",
    "../javatests/src/org/chromium/android_webview/test/MediaAccessPermissionRequestTest.java",
    "../javatests/src/org/chromium/android_webview/test/MemoryMetricsLoggerTest.java",
    "../javatests/src/org/chromium/android_webview/test/MetricsFilteringDecoratorTest.java",
    "../javatests/src/org/chromium/android_webview/test/MetricsTestPlatformServiceBridge.java",
    "../javatests/src/org/chromium/android_webview/test/MultiProfileTest.java",
    "../javatests/src/org/chromium/android_webview/test/MultiProfileTestRule.java",
    "../javatests/src/org/chromium/android_webview/test/NavigationHistoryTest.java",
    "../javatests/src/org/chromium/android_webview/test/NavigationListenerTest.java",
    "../javatests/src/org/chromium/android_webview/test/OnDiskFileTest.java",
    "../javatests/src/org/chromium/android_webview/test/PolicyUrlFilteringTest.java",
    "../javatests/src/org/chromium/android_webview/test/PopupWindowTest.java",
    "../javatests/src/org/chromium/android_webview/test/PostMessageTest.java",
    "../javatests/src/org/chromium/android_webview/test/RenderProcessGoneHelper.java",
    "../javatests/src/org/chromium/android_webview/test/RendererProcessMetricsProviderTest.java",
    "../javatests/src/org/chromium/android_webview/test/SafeBrowsingSafeModeTest.java",
    "../javatests/src/org/chromium/android_webview/test/SafeBrowsingTest.java",
    "../javatests/src/org/chromium/android_webview/test/SafeModeTest.java",
    "../javatests/src/org/chromium/android_webview/test/SaveRestoreStateTest.java",
    "../javatests/src/org/chromium/android_webview/test/SslPreferencesTest.java",
    "../javatests/src/org/chromium/android_webview/test/StandaloneAwQuotaManagerBridgeTest.java",
    "../javatests/src/org/chromium/android_webview/test/TestAwContents.java",
    "../javatests/src/org/chromium/android_webview/test/TestAwServiceWorkerClient.java",
    "../javatests/src/org/chromium/android_webview/test/TestPageLoadedNotifier.java",
    "../javatests/src/org/chromium/android_webview/test/TestWebMessageListener.java",
    "../javatests/src/org/chromium/android_webview/test/UserAgentTest.java",
    "../javatests/src/org/chromium/android_webview/test/VariationsHeadersTest.java",
    "../javatests/src/org/chromium/android_webview/test/VariationsSeedHolderTest.java",
    "../javatests/src/org/chromium/android_webview/test/VariationsSeedLoaderTest.java",
    "../javatests/src/org/chromium/android_webview/test/VariationsTest.java",
    "../javatests/src/org/chromium/android_webview/test/VisualStateTest.java",
    "../javatests/src/org/chromium/android_webview/test/WebKitHitTestTest.java",
    "../javatests/src/org/chromium/android_webview/test/WebViewAsynchronousFindApisTest.java",
    "../javatests/src/org/chromium/android_webview/test/WebViewFindApisTestRule.java",
    "../javatests/src/org/chromium/android_webview/test/WebViewModalDialogOverrideTest.java",
    "../javatests/src/org/chromium/android_webview/test/XRWOriginTrialTest.java",
    "../javatests/src/org/chromium/android_webview/test/common/services/ServiceConnectionDelayRecorderTest.java",
    "../javatests/src/org/chromium/android_webview/test/common/variations/VariationsUtilsTest.java",
    "../javatests/src/org/chromium/android_webview/test/component_updater/EmbeddedComponentLoaderTest.java",
    "../javatests/src/org/chromium/android_webview/test/devui/AwNonembeddedUmaRecorderTest.java",
    "../javatests/src/org/chromium/android_webview/test/devui/ComponentsListFragmentTest.java",
    "../javatests/src/org/chromium/android_webview/test/devui/ComponentsListFragmentUpdateButtonTest.java",
    "../javatests/src/org/chromium/android_webview/test/devui/CrashesListFragmentTest.java",
    "../javatests/src/org/chromium/android_webview/test/devui/DeveloperUiTest.java",
    "../javatests/src/org/chromium/android_webview/test/devui/DeveloperUiTestUtils.java",
    "../javatests/src/org/chromium/android_webview/test/devui/FlagsFragmentTest.java",
    "../javatests/src/org/chromium/android_webview/test/devui/HomeFragmentTest.java",
    "../javatests/src/org/chromium/android_webview/test/devui/NetLogsFragmentTest.java",
    "../javatests/src/org/chromium/android_webview/test/devui/SafeModeFragmentTest.java",
    "../javatests/src/org/chromium/android_webview/test/devui/util/ComponentsInfoLoaderTest.java",
    "../javatests/src/org/chromium/android_webview/test/devui/util/CrashBugUrlFactoryTest.java",
    "../javatests/src/org/chromium/android_webview/test/devui/util/UnuploadedFilesStateLoaderTest.java",
    "../javatests/src/org/chromium/android_webview/test/devui/util/UploadedCrashesInfoLoaderTest.java",
    "../javatests/src/org/chromium/android_webview/test/devui/util/WebViewCrashInfoCollectorTest.java",
    "../javatests/src/org/chromium/android_webview/test/devui/util/WebViewCrashLogParserTest.java",
    "../javatests/src/org/chromium/android_webview/test/services/AwComponentUpdateServiceTest.java",
    "../javatests/src/org/chromium/android_webview/test/services/AwNetLogServiceTest.java",
    "../javatests/src/org/chromium/android_webview/test/services/ComponentsProviderServiceTest.java",
    "../javatests/src/org/chromium/android_webview/test/services/CrashLoggingUtilsTest.java",
    "../javatests/src/org/chromium/android_webview/test/services/CrashReceiverServiceTest.java",
    "../javatests/src/org/chromium/android_webview/test/services/JsSandboxFledgeTest.java",
    "../javatests/src/org/chromium/android_webview/test/services/JsSandboxServiceTest.java",
    "../javatests/src/org/chromium/android_webview/test/services/MetricsBridgeServiceTest.java",
    "../javatests/src/org/chromium/android_webview/test/services/MetricsBridgeServiceUnitTest.java",
    "../javatests/src/org/chromium/android_webview/test/services/MetricsUploadServiceTest.java",
    "../javatests/src/org/chromium/android_webview/test/services/MinidumpUploadJobTest.java",
    "../javatests/src/org/chromium/android_webview/test/services/ServiceConnectionHelper.java",
    "../javatests/src/org/chromium/android_webview/test/services/VariationsSeedServerTest.java",
    "../javatests/src/org/chromium/android_webview/test/services/VisualStateCallbackTest.java",
  ]

  data = [
    "data/",
    "//third_party/chromium-variations/",
  ]
  data_deps =
      [ "//testing/buildbot/filters:webview_instrumentation_test_apk_filters" ]

  if (enable_chrome_android_internal) {
    data_deps +=
        [ "//clank/build/bot/filters:webview_instrumentation_test_apk_filters" ]
  }
}

android_library("webview_instrumentation_test_mock_services_java") {
  testonly = true
  sources = [
    "../javatests/src/org/chromium/android_webview/test/component_updater/MockComponentsProviderService.java",
    "../javatests/src/org/chromium/android_webview/test/services/MockAwComponentUpdateService.java",
    "../javatests/src/org/chromium/android_webview/test/services/MockMetricsBridgeService.java",
    "../javatests/src/org/chromium/android_webview/test/services/MockVariationsSeedServer.java",
  ]
  deps = [
    "//android_webview:common_aidl_java",
    "//android_webview/nonembedded:services_java",
    "//base:base_java",
    "//base:base_java_test_support",
    "//components/component_updater/android:component_provider_service_aidl_java",
    "//third_party/junit",
  ]
}

android_library("webview_instrumentation_test_utils_java") {
  testonly = true
  sources = [
    "../javatests/src/org/chromium/android_webview/test/util/DisableOriginTrialsSafeModeTestUtils.java",
    "../javatests/src/org/chromium/android_webview/test/util/EmbeddedComponentLoaderFactory.java",
    "../javatests/src/org/chromium/android_webview/test/util/ManifestMetadataMockApplicationContext.java",
    "../javatests/src/org/chromium/android_webview/test/util/RendererProcessMetricsProviderUtils.java",
    "../javatests/src/org/chromium/android_webview/test/util/VariationsTestUtils.java",
    "shell/src/org/chromium/android_webview/test/util/MemoryMetricsLoggerUtils.java",
  ]
  srcjar_deps = [ ":webview_instrumentation_test_native_jni" ]
  deps = [
    "//android_webview:common_variations_java",
    "//base:base_java_test_support",
    "//build/android:build_java",
    "//components/component_updater/android:embedded_component_loader_java",
    "//components/variations/android:variations_java",
    "//third_party/blink/public/common",
    "//third_party/jni_zero:jni_zero_java",
    "//third_party/junit",
    "//third_party/mockito:mockito_java",
  ]
}

generate_jni("webview_instrumentation_test_native_jni") {
  testonly = true
  sources = [
    "../javatests/src/org/chromium/android_webview/test/util/DisableOriginTrialsSafeModeTestUtils.java",
    "../javatests/src/org/chromium/android_webview/test/util/EmbeddedComponentLoaderFactory.java",
    "../javatests/src/org/chromium/android_webview/test/util/RendererProcessMetricsProviderUtils.java",
    "../javatests/src/org/chromium/android_webview/test/util/VariationsTestUtils.java",
    "shell/src/org/chromium/android_webview/test/util/MemoryMetricsLoggerUtils.java",
  ]
}

source_set("webview_instrumentation_test_native_jni_impl") {
  sources = [
    "browser/disable_origin_trials_safemode_test_utils.cc",
    "browser/embedded_component_loader_test_helper.cc",
    "browser/renderer_process_metrics_provider_utils.cc",
    "browser/variations_test_utils.cc",
    "shell/memory_metrics_logger_utils.cc",
  ]

  deps = [
    ":webview_instrumentation_test_jni",
    ":webview_instrumentation_test_native_jni",
    "//android_webview/browser",
    "//android_webview/browser/metrics",
    "//android_webview/js_sandbox/service:js_sandbox",
    "//base",
    "//base/test:test_support",
    "//components/component_updater/android:embedded_component_loader",
    "//components/component_updater/android:embedded_component_loader_jni_headers",
    "//components/embedder_support/android/metrics",
    "//components/embedder_support/origin_trials",
    "//content/public/common",
    "//third_party/protobuf:protobuf_lite",
  ]
}

test("android_webview_unittests") {
  deps = [
    ":android_webview_unittests_assets",
    ":android_webview_unittests_java",
    ":android_webview_unittests_jni",
    "//android_webview/browser",
    "//android_webview/browser/gfx",
    "//android_webview/browser/lifecycle",
    "//android_webview/browser/metrics",
    "//android_webview/common",
    "//android_webview/nonembedded",
    "//base/test:proto_test_support",
    "//base/test:test_support",
    "//components/autofill/core/browser",
    "//components/component_updater",
    "//components/component_updater/android:embedded_component_loader",
    "//components/embedder_support:browser_util",
    "//components/embedder_support/android:util",
    "//components/embedder_support/android/metrics:metrics",
    "//components/flags_ui:flags_ui",
    "//components/ip_protection:browser",
    "//components/ip_protection:ip_protection",
    "//components/ip_protection:unit_tests",
    "//components/metrics",
    "//components/metrics:component_metrics",
    "//components/metrics:content",
    "//components/optimization_guide/core:bloomfilter",
    "//components/policy/core/browser:test_support",
    "//components/prefs:prefs",
    "//components/prefs:test_support",
    "//components/safe_browsing/content/browser/web_ui",
    "//components/safe_browsing/core/browser",
    "//components/safe_browsing/core/common",
    "//components/tracing:background_tracing_utils",
    "//components/update_client",
    "//components/viz/service:service",
    "//content:content",
    "//content/test:test_support",
    "//gin:v8_snapshot_assets",
    "//mojo/core/embedder",
    "//net:net",
    "//net:test_support",
    "//net/third_party/quiche:blind_sign_auth",
    "//services/cert_verifier/public/mojom",
    "//services/network:test_support",
    "//third_party/anonymous_tokens:anonymous_tokens_cc_proto",
    "//ui/base:ui_base_jni_headers",
    "//ui/gl",
    "//ui/gl:test_support",
  ]

  data_deps = [
    "//third_party/perfetto/protos/perfetto/config/chrome:scenario_descriptor",
  ]

  data = [
    "data/",
    "$root_gen_dir/third_party/perfetto/protos/perfetto/config/chrome/scenario_config.descriptor",
  ]

  sources = [
    "../browser/aw_browser_context_unittest.cc",
    "../browser/aw_client_hints_controller_delegate_unittest.cc",
    "../browser/aw_contents_client_bridge_unittest.cc",
    "../browser/aw_crash_keys_unittest.cc",
    "../browser/aw_feature_entries_unittest.cc",
    "../browser/aw_field_trials_unittest.cc",
    "../browser/aw_form_database_service_unittest.cc",
    "../browser/aw_media_url_interceptor_unittest.cc",
    "../browser/aw_pac_processor_unittest.cc",
    "../browser/aw_permission_manager_unittest.cc",
    "../browser/aw_user_agent_metadata_unittest.cc",
    "../browser/enterprise_authentication_app_link_policy_handler_unittest.cc",
    "../browser/gfx/begin_frame_source_webview_unittest.cc",
    "../browser/gfx/browser_view_renderer_unittest.cc",
    "../browser/gfx/test/fake_window.cc",
    "../browser/gfx/test/fake_window.h",
    "../browser/gfx/test/invalidate_test.cc",
    "../browser/gfx/test/rendering_test.cc",
    "../browser/gfx/test/rendering_test.h",
    "../browser/ip_protection/aw_ip_protection_config_provider_unittest.cc",
    "../browser/lifecycle/aw_contents_lifecycle_notifier_unittest.cc",
    "../browser/metrics/android_metrics_provider_unittest.cc",
    "../browser/metrics/aw_component_metrics_provider_delegate_unittests.cc",
    "../browser/metrics/aw_metrics_filtering_status_metrics_provider_unittests.cc",
    "../browser/metrics/aw_metrics_service_client_sample_rate_unittest.cc",
    "../browser/metrics/aw_metrics_service_client_unittest.cc",
    "../browser/metrics/aw_server_side_allowlist_metrics_provider_unittests.cc",
    "../browser/metrics/visibility_metrics_logger_unittest.cc",
    "../browser/permission/media_access_permission_request_unittest.cc",
    "../browser/permission/permission_request_handler_unittest.cc",
    "../browser/renderer_host/auto_login_parser_unittest.cc",
    "../browser/safe_browsing/aw_ping_manager_factory_unittest.cc",
    "../browser/safe_browsing/aw_safe_browsing_allowlist_manager_unittest.cc",
    "../browser/state_serializer_unittest.cc",
    "../browser/tracing/aw_background_tracing_metrics_provider_unittest.cc",
    "../browser/tracing/aw_tracing_delegate_unittest.cc",
    "../browser/tracing/background_tracing_field_trial_unittest.cc",
    "../lib/webview_tests.cc",
    "../nonembedded/component_updater/aw_component_installer_policy_shim_unittest.cc",
    "../nonembedded/component_updater/aw_component_installer_policy_unittest.cc",
    "../nonembedded/component_updater/aw_component_update_service_test.cc",
    "../nonembedded/component_updater/aw_component_updater_configurator_unittest.cc",
  ]
}

android_assets("android_webview_unittests_assets") {
  sources = [ "unittest/assets/asset_file.ogg" ]
}

android_library("android_webview_unittests_java") {
  testonly = true
  deps = [
    "//android_webview:android_webview_java",
    "//content/public/test/android:content_java_test_support",
    "//third_party/jni_zero:jni_zero_java",
  ]
  sources = [ "../unittestjava/src/org/chromium/android_webview/unittest/MockAwContentsClientBridge.java" ]
  srcjar_deps = [ ":android_webview_unittests_jni" ]
}

generate_jni("android_webview_unittests_jni") {
  testonly = true
  sources = [ "../unittestjava/src/org/chromium/android_webview/unittest/MockAwContentsClientBridge.java" ]
}

android_library("crash_test_utils_java") {
  testonly = true
  sources = [ "../nonembedded/java/src/org/chromium/android_webview/nonembedded/crash/CrashInfoEqualityMatcher.java" ]
  deps = [
    "//android_webview/nonembedded:crash_java",
    "//third_party/hamcrest:hamcrest_java",
  ]
}

# robolectric tests
robolectric_binary("android_webview_junit_tests") {
  sources = [
    "../junit/src/org/chromium/android_webview/robolectric/AwDisplayCutoutControllerTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/AwDisplayModeControllerTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/AwHttpAuthHandlerTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/AwLayoutSizerTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/AwScrollOffsetManagerTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/AwWebContentsMetricsRecorderTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/FindAddressTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/RectUtilsTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/SupportLibTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/WebAddressParserTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/common/FlagOverrideHelperTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/common/services/ServiceNamesTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/metrics/AwMetricsUtilsTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/metrics/AwNonembeddedUmaReplayerTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/metrics/AwOriginVisitLoggerTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/metrics/AwSiteVisitLoggerTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/metrics/TrackExitReasonsOfInterestTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/nonembedded/AwComponentUpdateServiceSafeModeTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/nonembedded/NetworkFetcherTaskTest.java",
    "../junit/src/org/chromium/android_webview/robolectric/nonembedded/crash/CrashInfoTest.java",
  ]

  deps = [
    ":crash_test_utils_java",
    "//android_webview:android_webview_java",
    "//android_webview/nonembedded:crash_java",
    "//android_webview/nonembedded:services_java",
    "//android_webview/proto:metrics_bridge_records_proto_java",
    "//android_webview/support_library/boundary_interfaces:boundary_interface_java",
    "//base:base_java",
    "//base:base_java_test_support",
    "//base:base_java_test_support_uncommon",
    "//base:base_junit_test_support",
    "//components/component_updater/android:embedded_component_loader_java",
    "//components/content_relationship_verification:java",
    "//components/content_relationship_verification/android:java",
    "//components/content_relationship_verification/android:junit_test_support",
    "//components/crash/android:java",
    "//components/embedder_support/android:util_java",
    "//content/public/android:content_full_java",
    "//content/public/test/android:content_java_test_support",
    "//third_party/android_deps:protobuf_lite_runtime_java",
    "//third_party/androidx:androidx_test_core_java",
    "//third_party/androidx:androidx_test_runner_java",
    "//third_party/blink/public/mojom:mojom_platform_java",
    "//third_party/hamcrest:hamcrest_java",
    "//third_party/jni_zero:jni_zero_java",
    "//url:gurl_java",
  ]

  package_name = "org.chromium.android_webview.robolectric"
}