| # Copyright 2023 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//android_webview/variables.gni") |
| import("//build/config/android/rules.gni") |
| |
| # Upstream and Downstream WebView both have instrumentation tests. |
| # These templates enables a shared basis for these test, ensuring that they use |
| # the same instrumentation. |
| |
| # These templates are for test only |
| testonly = true |
| |
| # Build the webview_instrumentation_apk with extra dependencies. |
| # Args: |
| # deps: extra dependencies to add - platform-specific libraries. |
| # apk_name: Desired apk name. |
| template("base_webview_instrumentation_apk") { |
| android_apk(target_name) { |
| apk_name = invoker.apk_name |
| deps = [ |
| "//android_webview:android_webview_java", |
| "//android_webview:android_webview_product_config_java", |
| "//android_webview:common_java", |
| "//android_webview:locale_pak_assets", |
| "//android_webview/test:base_webview_instrumentation_java", |
| "//android_webview/test:draw_fn_impl_java", |
| "//android_webview/test:webview_instrumentation_apk_assets", |
| "//android_webview/test:webview_instrumentation_apk_resources", |
| "//android_webview/test:webview_instrumentation_test_mock_services_java", |
| "//android_webview/test:webview_instrumentation_test_utils_java", |
| "//base:base_java", |
| "//base:base_java_test_support", |
| "//components/android_autofill/browser/test_support:java", |
| "//components/content_capture/android/test_support:java", |
| "//components/embedder_support/android:util_java", |
| "//components/heap_profiling/multi_process:heap_profiling_java_test_support", |
| "//components/policy/android:policy_java_test_support", |
| "//content/public/android:content_java", |
| "//third_party/androidx:androidx_annotation_annotation_java", |
| "//third_party/androidx:androidx_core_core_java", |
| "//third_party/androidx:androidx_test_monitor_java", |
| "//third_party/androidx_javascriptengine:javascriptengine_java", |
| "//third_party/jni_zero:jni_zero_java", |
| "//third_party/junit", |
| "//ui/android:ui_java", |
| "//url:gurl_java", |
| ] + invoker.deps |
| |
| android_manifest = "//android_webview/test/shell/AndroidManifest.xml" |
| |
| product_config_java_packages = [ webview_product_config_java_package ] |
| |
| shared_libraries = |
| [ "//android_webview/test:libstandalonelibwebviewchromium" ] |
| srcjar_deps = [ "//android_webview/test:libstandalonelibwebviewchromium__jni_registration" ] |
| |
| command_line_flags_file = "android-webview-command-line" |
| } |
| } |
| |
| # Builds the WebView instrumentation test APK |
| # This template provides the base shared test instrumentation. |
| # Targets should contain sources and dependencies that are tests, while this |
| # template should contain sources and dependencies that support multiple tests. |
| # Args: |
| # apk_name: Test APK name |
| # apk_under_test: Target APK for tests. |
| # sources: Test sources |
| # deps: Additional deps for test sources |
| template("base_webview_instrumentation_test_apk") { |
| instrumentation_test_apk(target_name) { |
| apk_name = invoker.apk_name |
| apk_under_test = invoker.apk_under_test |
| android_manifest = "//android_webview/javatests/AndroidManifest.xml" |
| |
| deps = [ |
| "//android_webview:android_webview_java", |
| "//android_webview:common_platform_services_java", |
| "//android_webview/test:base_webview_instrumentation_java", |
| "//android_webview/test:base_webview_instrumentation_test_java", |
| "//base:base_java", |
| "//base:base_java_test_support", |
| "//third_party/android_deps:com_googlecode_java_diff_utils_diffutils_java", |
| "//third_party/androidx:androidx_annotation_annotation_java", |
| "//third_party/androidx:androidx_test_runner_java", |
| "//third_party/junit", |
| "//third_party/mockito:mockito_java", |
| "//url:gurl_java", |
| ] |
| if (defined(invoker.deps)) { |
| deps += invoker.deps |
| } |
| |
| forward_variables_from(invoker, |
| [ |
| "sources", |
| "data", |
| "data_deps", |
| "srcjar_deps", |
| ]) |
| |
| additional_apks = [ |
| "//android_webview/test/embedded_test_server:aw_net_test_support_apk", |
| "//net/android:net_test_support_apk", |
| ] |
| } |
| } |