chromium/chrome/browser/search_engines/android/BUILD.gn

# Copyright 2021 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("//chrome/browser/buildflags.gni")
import("//third_party/jni_zero/jni_zero.gni")

android_library("java") {
  sources = [
    "java/src/org/chromium/chrome/browser/search_engines/DefaultSearchEngineDialogCoordinator.java",
    "java/src/org/chromium/chrome/browser/search_engines/DefaultSearchEngineDialogHelper.java",
    "java/src/org/chromium/chrome/browser/search_engines/SearchEngineChoiceMetrics.java",
    "java/src/org/chromium/chrome/browser/search_engines/SearchEngineChoiceNotification.java",
    "java/src/org/chromium/chrome/browser/search_engines/SearchEnginePromoState.java",
    "java/src/org/chromium/chrome/browser/search_engines/SearchEnginePromoType.java",
    "java/src/org/chromium/chrome/browser/search_engines/SogouPromoDialog.java",
    "java/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceFactory.java",
    "java/src/org/chromium/chrome/browser/search_engines/choice_screen/ChoiceDialogCoordinator.java",
    "java/src/org/chromium/chrome/browser/search_engines/settings/SearchEngineAdapter.java",
    "java/src/org/chromium/chrome/browser/search_engines/settings/SearchEngineSettings.java",
  ]

  srcjar_deps = [ ":jni_headers" ]

  deps = [
    ":java_resources",
    "//base:base_java",
    "//base/version_info/android:version_constants_java",
    "//build/android:build_java",
    "//chrome/browser/flags:java",
    "//chrome/browser/omaha/android:java",
    "//chrome/browser/preferences:java",
    "//chrome/browser/profiles/android:java",
    "//chrome/browser/settings:java",
    "//chrome/browser/ui/android/favicon:java",
    "//chrome/browser/ui/messages/android:java",
    "//components/browser_ui/settings/android:java",
    "//components/browser_ui/site_settings/android:java",
    "//components/browser_ui/styles/android:java",
    "//components/browser_ui/util/android:java",
    "//components/browser_ui/widget/android:java",
    "//components/content_settings/android:content_settings_enums_java",
    "//components/embedder_support/android:util_java",
    "//components/favicon/android:java",
    "//components/location/android:location_java",
    "//components/search_engines/android:java",
    "//content/public/android:content_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_fragment_fragment_java",
    "//third_party/androidx:androidx_recyclerview_recyclerview_java",
    "//third_party/jni_zero:jni_zero_java",
    "//ui/android:ui_full_java",
    "//url:gurl_java",
  ]

  resources_package = "org.chromium.chrome.browser.search_engines"
}

generate_jni("jni_headers") {
  sources = [ "java/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceFactory.java" ]
}

android_resources("java_resources") {
  sources = [
    "java/res/drawable/blocking_choice_dialog_illustration.xml",
    "java/res/drawable/search_sogou.xml",
    "java/res/layout/blocking_choice_dialog.xml",
    "java/res/layout/default_search_engine_dialog_view.xml",
    "java/res/layout/search_engine.xml",
    "java/res/layout/search_engine_choice_header.xml",
    "java/res/layout/search_engine_recent_title.xml",
    "java/res/layout/search_engine_with_logo.xml",
    "java/res/values/dimens.xml",
    "java/res/values/ids.xml",
  ]
  deps = [
    "//chrome/browser/ui/android/strings:ui_strings_grd",
    "//components/browser_ui/styles/android:java_resources",
    "//components/browser_ui/widget/android:java_resources",
    "//components/strings:components_strings_grd",
  ]
}

robolectric_library("junit") {
  resources_package = "org.chromium.chrome.browser.search_engines"
  sources = [ "junit/src/org/chromium/chrome/browser/search_engines/choice_screen/ChoiceDialogCoordinatorUnitTest.java" ]
  deps = [
    ":java",
    ":java_resources",
    "//base:base_java",
    "//base:base_java_test_support",
    "//base:base_junit_test_support",
    "//chrome/android:chrome_java",
    "//chrome/browser/flags:java",
    "//chrome/test/android:chrome_java_unit_test_support",
    "//components/search_engines/android:java",
    "//components/search_engines/android:test_utils_java",
    "//third_party/android_deps:guava_android_java",
    "//third_party/androidx:androidx_recyclerview_recyclerview_java",
    "//third_party/androidx:androidx_test_core_java",
    "//third_party/androidx:androidx_test_ext_junit_java",
    "//third_party/androidx:androidx_test_runner_java",
    "//third_party/junit",
    "//third_party/mockito:mockito_java",
    "//ui/android:ui_java",
    "//ui/android:ui_java_test_support",
  ]
}

android_library("unit_device_javatests") {
  testonly = true
  resources_package = "org.chromium.chrome.browser.search_engines"
  sources = [ "javatests/src/org/chromium/chrome/browser/search_engines/choice_screen/ChoiceScreenRenderTest.java" ]
  deps = [
    ":java",
    ":java_resources",
    "//base:base_java",
    "//base:base_java_test_support",
    "//chrome/browser/flags:java",
    "//chrome/test/android:chrome_java_unit_test_support",
    "//components/search_engines/android:java",
    "//components/search_engines/android:test_utils_java",
    "//content/public/test/android:content_java_test_support",
    "//third_party/android_deps:guava_android_java",
    "//third_party/androidx:androidx_annotation_annotation_java",
    "//third_party/androidx:androidx_test_espresso_espresso_core_java",
    "//third_party/androidx:androidx_test_runner_java",
    "//third_party/hamcrest:hamcrest_core_java",
    "//third_party/junit",
    "//third_party/mockito:mockito_java",
    "//ui/android:ui_java",
    "//ui/android:ui_java_test_support",
  ]
}