# Copyright 2020 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("//third_party/jni_zero/jni_zero.gni")
android_resources("java_resources") {
sources = [
"java/res/drawable-hdpi/infobar_translate_compact.png",
"java/res/drawable-mdpi/infobar_translate_compact.png",
"java/res/drawable-xhdpi/infobar_translate_compact.png",
"java/res/drawable-xxhdpi/infobar_translate_compact.png",
"java/res/drawable-xxxhdpi/infobar_translate_compact.png",
"java/res/layout/infobar_translate_tab_content.xml",
"java/res/layout/translate_menu_extended_item.xml",
"java/res/layout/translate_menu_item.xml",
"java/res/layout/translate_menu_item_checked.xml",
"java/res/values/dimens.xml",
]
deps = [
"//components/browser_ui/widget/android:java_resources",
"//components/strings:components_strings_grd",
"//third_party/android_deps:material_design_java",
]
}
android_library("java") {
srcjar_deps = [ ":jni_headers" ]
sources = [
"java/src/org/chromium/components/translate/TranslateFeatureMap.java",
"java/src/org/chromium/components/translate/TranslateMenu.java",
"java/src/org/chromium/components/translate/TranslateMenuHelper.java",
"java/src/org/chromium/components/translate/TranslateMessage.java",
"java/src/org/chromium/components/translate/TranslateMessageSecondaryMenu.java",
"java/src/org/chromium/components/translate/TranslateMessageSecondaryMenuAdapter.java",
"java/src/org/chromium/components/translate/TranslateOptions.java",
"java/src/org/chromium/components/translate/TranslateTabContent.java",
"java/src/org/chromium/components/translate/TranslateTabLayout.java",
]
resources_package = "org.chromium.components.translate"
deps = [
":java_resources",
"//base:base_java",
"//build/android:build_java",
"//components/browser_ui/widget/android:java",
"//components/messages/android:java",
"//content/public/android:content_java",
"//third_party/android_deps:material_design_java",
"//third_party/androidx:androidx_annotation_annotation_java",
"//third_party/androidx:androidx_appcompat_appcompat_java",
"//third_party/androidx:androidx_core_core_java",
"//third_party/jni_zero:jni_zero_java",
"//ui/android:ui_java",
]
}
static_library("android") {
sources = [
"translate_feature_map.cc",
"translate_message.cc",
"translate_message.h",
"translate_utils.cc",
"translate_utils.h",
]
deps = [
":jni_headers",
"//base",
"//components/language/core/common",
"//components/messages/android",
"//components/metrics",
"//components/strings:components_strings_grit",
"//components/translate/core/browser",
"//components/translate/core/common",
"//content/public/browser",
"//ui/base",
]
}
generate_jni("jni_headers") {
sources = [
"java/src/org/chromium/components/translate/TranslateFeatureMap.java",
"java/src/org/chromium/components/translate/TranslateMessage.java",
]
}
java_cpp_enum("translate_android_enums") {
sources = [ "translate_utils.h" ]
}
android_library("translate_android_enums_java") {
deps = [ "//third_party/androidx:androidx_annotation_annotation_java" ]
srcjar_deps = [ ":translate_android_enums" ]
}
robolectric_library("junit") {
resources_package = "org.chromium.components.translate"
sources = [
"java/src/org/chromium/components/translate/TranslateMessageTest.java",
"java/src/org/chromium/components/translate/TranslateOptionsTest.java",
]
deps = [
":java",
":java_resources",
"//base:base_java",
"//base:base_java_test_support",
"//base:base_junit_test_support",
"//components/browser_ui/widget/android:java",
"//components/messages/android:java",
"//content/public/android:content_java",
"//third_party/androidx:androidx_appcompat_appcompat_java",
"//third_party/androidx:androidx_test_runner_java",
"//third_party/jni_zero:jni_zero_java",
"//third_party/junit:junit",
"//third_party/mockito:mockito_java",
"//ui/android:ui_java",
]
}
android_library("unit_device_javatests") {
testonly = true
resources_package = "org.chromium.components.translate"
sources = [ "java/src/org/chromium/components/translate/TranslateMessageSecondaryMenuTest.java" ]
deps = [
":java",
":java_resources",
"//base:base_java",
"//base:base_java_test_support",
"//components/browser_ui/test/android:test_support_java",
"//components/browser_ui/widget/android:java",
"//components/messages/android:java",
"//content/public/android:content_java",
"//content/public/test/android:content_java_test_support",
"//third_party/android_deps:espresso_java",
"//third_party/androidx:androidx_test_runner_java",
"//third_party/hamcrest:hamcrest_java",
"//third_party/hamcrest:hamcrest_library_java",
"//third_party/jni_zero:jni_zero_java",
"//third_party/junit",
"//third_party/mockito:mockito_java",
"//ui/android:ui_java",
"//ui/android:ui_java_test_support",
]
}
source_set("unit_tests") {
testonly = true
sources = [
"translate_message_unittest.cc",
"translate_utils_unittest.cc",
]
deps = [
":android",
"//base",
"//base/test:test_support",
"//components/infobars/core",
"//components/language/core/browser",
"//components/language/core/browser:test_support",
"//components/language/core/common",
"//components/messages/android",
"//components/metrics",
"//components/pref_registry:pref_registry",
"//components/prefs",
"//components/prefs:test_support",
"//components/sync_preferences:test_support",
"//components/translate/core/browser",
"//components/translate/core/browser:test_support",
"//components/translate/core/common",
"//testing/gmock",
"//testing/gtest",
"//url",
]
}