chromium/android_webview/tools/captured_sites_tests/BUILD.gn

# Copyright 2023 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")

testonly = true

group("captured_sites_test_app") {
  deps = [
    ":captured_sites_junit_tests",
    ":webview_captured_sites_app_apk",
    ":webview_captured_sites_test_apk",
  ]
}

android_apk("webview_captured_sites_app_apk") {
  apk_name = "WebViewCapturedSitesApp"
  android_manifest = "java/AndroidManifest.xml"
  deps = [
    ":webview_captured_sites_app_apk_resources",
    ":webview_captured_sites_app_java",
  ]
}

robolectric_binary("captured_sites_junit_tests") {
  android_manifest = "java/AndroidManifest.xml"
  sources = [
    "javatests/src/org/chromium/webview_ui_test/test/robolectric/AutofillProfileTest.java",
    "javatests/src/org/chromium/webview_ui_test/test/robolectric/CapturedSitesInstructionsTest.java",
    "javatests/src/org/chromium/webview_ui_test/test/util/Action.java",
    "javatests/src/org/chromium/webview_ui_test/test/util/AutofillProfile.java",
    "javatests/src/org/chromium/webview_ui_test/test/util/CapturedSitesInstructions.java",
    "javatests/src/org/chromium/webview_ui_test/test/util/CapturedSitesSyncWrapper.java",
    "javatests/src/org/chromium/webview_ui_test/test/util/CapturedSitesTestRule.java",
    "javatests/src/org/chromium/webview_ui_test/test/util/JavaScriptExecutionViewAction.java",
    "javatests/src/org/chromium/webview_ui_test/test/util/PerformActions.java",
  ]
  deps = [
    ":webview_captured_sites_app_java",
    "//base:base_java",
    "//base:base_java_test_support",
    "//base:base_junit_test_support",
    "//third_party/android_deps:espresso_java",
    "//third_party/android_deps:playcore_java",
    "//third_party/androidx:androidx_annotation_annotation_java",
    "//third_party/androidx:androidx_test_monitor_java",
    "//third_party/androidx:androidx_test_runner_java",
    "//third_party/androidx:androidx_test_uiautomator_uiautomator_java",
    "//third_party/hamcrest:hamcrest_java",
    "//third_party/junit",
    "//ui/android:ui_java_test_support",
  ]
}
android_library("webview_captured_sites_app_java") {
  sources = [
    "../automated_ui_tests/java/src/org/chromium/webview_ui_test/WebViewUiTestActivity.java",
    "../automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/util/UseLayout.java",
  ]
  deps = [
    ":webview_captured_sites_app_apk_resources",
    "//base:base_java",
  ]
}

android_resources("webview_captured_sites_app_apk_resources") {
  deps = [ "//android_webview/tools/automated_ui_tests:webview_ui_test_app_apk_resources" ]
  sources = [ "java/res/layout/autofill_dataset_picker_text_only.xml" ]
}

instrumentation_test_apk("webview_captured_sites_test_apk") {
  apk_name = "WebViewCapturedSitesTestAppTest"
  apk_under_test = ":webview_captured_sites_app_apk"
  android_manifest = "javatests/AndroidManifest.xml"
  sources = [
    "javatests/src/org/chromium/webview_ui_test/test/CapturedSitesTest.java",
    "javatests/src/org/chromium/webview_ui_test/test/TestAutofillService.java",
    "javatests/src/org/chromium/webview_ui_test/test/util/Action.java",
    "javatests/src/org/chromium/webview_ui_test/test/util/AutofillProfile.java",
    "javatests/src/org/chromium/webview_ui_test/test/util/CapturedSitesInstructions.java",
    "javatests/src/org/chromium/webview_ui_test/test/util/CapturedSitesSyncWrapper.java",
    "javatests/src/org/chromium/webview_ui_test/test/util/CapturedSitesTestRule.java",
    "javatests/src/org/chromium/webview_ui_test/test/util/JavaScriptExecutionViewAction.java",
    "javatests/src/org/chromium/webview_ui_test/test/util/PerformActions.java",
  ]
  deps = [
    ":webview_captured_sites_app_apk_resources",
    ":webview_captured_sites_app_java",
    "//base:base_java",
    "//base:base_java_test_support",
    "//third_party/android_deps:espresso_java",
    "//third_party/android_deps:playcore_java",
    "//third_party/androidx:androidx_annotation_annotation_java",
    "//third_party/androidx:androidx_test_monitor_java",
    "//third_party/androidx:androidx_test_runner_java",
    "//third_party/androidx:androidx_test_uiautomator_uiautomator_java",
    "//third_party/hamcrest:hamcrest_java",
    "//third_party/junit",
    "//ui/android:ui_java_test_support",
  ]
  data = [ "test/data/" ]

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