chromium/chrome/android/BUILD.gn

# Copyright 2014 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/android/resource_sizes.gni")
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
import("//build/config/android/system_image.gni")
import("//build/config/cronet/config.gni")
import("//build/config/python.gni")
import("//build/util/process_version.gni")
import("//chrome/android/chrome_common_shared_library.gni")
import("//chrome/android/chrome_java_resources.gni")
import("//chrome/android/chrome_public_apk_tmpl.gni")
import("//chrome/android/expectations/expectations.gni")
import("//chrome/android/features/dev_ui/dev_ui_module.gni")
import("//chrome/android/features/tab_ui/tab_management_java_sources.gni")
import("//chrome/android/feed/feed_java_sources.gni")
import("//chrome/android/modules/chrome_bundle_tmpl.gni")
import("//chrome/android/modules/chrome_feature_module_tmpl.gni")
import("//chrome/browser/commerce/price_tracking/android/java_sources.gni")
import("//chrome/browser/commerce/subscriptions/android/java_sources.gni")
import(
    "//chrome/browser/commerce/subscriptions/test/android/test_java_sources.gni")
import("//chrome/browser/data_sharing/java_sources.gni")
import("//chrome/browser/page_info/buildflags.gni")
import("//chrome/browser/share/android/java_sources.gni")
import("//chrome/chrome_paks.gni")
import("//chrome/common/features.gni")
import("//chrome/version.gni")
import("//components/password_manager/core/browser/buildflags.gni")
import("//components/plus_addresses/buildflags.gni")
import("//device/vr/buildflags/buildflags.gni")
import("//printing/buildflags/buildflags.gni")
import("//testing/test.gni")
import("//third_party/icu/config.gni")
import("//third_party/jni_zero/jni_zero.gni")
import("//third_party/protobuf/proto_library.gni")
import("//tools/resources/generate_resource_allowlist.gni")
import("channel.gni")
import("java_sources.gni")
import("static_initializers.gni")
import("trichrome.gni")

assert(!is_cronet_build)
assert(enable_supervised_users)

if (android_64bit_target_cpu && skip_secondary_abi_for_cq) {
  assert(current_toolchain != android_secondary_abi_toolchain)
}

# 32-bit library will have browser code in it. 64-bit is webview-only.
if (android_64bit_target_cpu && !skip_secondary_abi_for_cq) {
  _monochrome_browser_toolchain = android_secondary_abi_toolchain
} else {
  _monochrome_browser_toolchain = default_toolchain
}

if (android_64bit_target_cpu) {
  _main_monochrome_public_bundle_target = "monochrome_32_64_public_bundle"
  _main_trichrome_chrome_bundle_target = "trichrome_chrome_32_64_bundle"
  _main_trichrome_library_apk_target = "trichrome_library_32_64_apk"
  _android_lint_target_name = "monochrome_64_public_bundle"

  # monochrome_apk is only 64-bit primary, we have no 32-bit primary version,
  # as we don't ship it to users.
  _main_monochrome_public_apk_target = "monochrome_64_32_public_apk"
} else {
  _main_monochrome_public_bundle_target = "monochrome_public_bundle"
  _main_monochrome_public_apk_target = "monochrome_public_apk"
  _main_trichrome_chrome_bundle_target = "trichrome_chrome_bundle"
  _main_trichrome_library_apk_target = "trichrome_library_apk"
  _android_lint_target_name = "monochrome_public_bundle"
}

if (current_toolchain == default_toolchain) {
  app_hooks_impl = "java/src/org/chromium/chrome/browser/AppHooksImpl.java"

  template("chrome_public_bundle") {
    _is_monochrome = defined(invoker.is_monochrome) && invoker.is_monochrome
    if (_is_monochrome) {
      _module_descs = monochrome_module_descs
    } else {
      _module_descs = chrome_module_descs
    }

    _base_module_target_name = "${invoker.target_name}__base_bundle_module"
    chrome_public_apk_or_module_tmpl(_base_module_target_name) {
      forward_variables_from(invoker,
                             [
                               "assert_no_deps",
                               "add_view_trace_events",
                               "expected_android_manifest",
                               "is_64_bit_browser",
                               "is_monochrome",
                               "is_trichrome",
                               "include_32_bit_webview",
                               "include_64_bit_webview",
                               "static_library_provider",
                               "resource_ids_provider_dep",
                             ])
      target_type = "android_app_bundle_module"

      srcjar_deps = []
      foreach(_module_desc, _module_descs) {
        if (defined(_module_desc.jni_registration)) {
          srcjar_deps += [ _module_desc.jni_registration ]
        }
      }

      if (defined(invoker.expected_android_manifest_template)) {
        expected_android_manifest =
            string_replace(invoker.expected_android_manifest_template,
                           "SPLIT_NAME",
                           "base")
      }
    }

    chrome_bundle(target_name) {
      forward_variables_from(invoker,
                             [
                               "add_view_trace_events",
                               "art_profile_path",
                               "bundle_name",
                               "include_32_bit_webview",
                               "include_64_bit_webview",
                               "is_64_bit_browser",
                               "is_monochrome",
                               "is_trichrome",
                               "static_library_provider",
                               "expected_android_manifest_template",
                               "expected_libs_and_assets",
                               "expected_proguard_config",
                             ])
      base_module_target = ":$_base_module_target_name"
      manifest_package = chrome_public_manifest_package
      module_descs = _module_descs
      chrome_deps = [ ":delegate_public_impl_java" ]

      if (target_name == _android_lint_target_name) {
        enable_lint = true

        # Monochrome bundle is used as our unified lint target, so it needs to set the
        # lowest shipping minSdkVersion to catch all potential NewApi errors.
        lint_min_sdk_version = default_min_sdk_version
        lint_baseline_file = "expectations/lint-baseline.xml"
        lint_suppressions_file = "expectations/lint-suppressions.xml"

        # Since this target's name changes if we are 32 or 64 bit, we want to keep
        # the gen_dir the same for the lint baseline files.
        lint_gen_dir = "$target_gen_dir/monochrome_public_bundle__lint"
      }
    }
  }

  generate_ui_locale_resources("ui_locale_string_resources") {
    ui_locales = platform_pak_locales
  }

  # Resources which are needed in the base module manifest's application tag
  # should be added here. These are split out from chrome_app_java_resources
  # because //chrome resources may be included in a DFM instead of the base
  # module.
  android_resources("chrome_base_module_resources") {
    sources = [
      "java/res_base/anim/no_anim.xml",
      "java/res_base/drawable-v26/ic_launcher.xml",
      "java/res_base/drawable-v26/ic_launcher_round.xml",
      "java/res_base/font/chrome_google_sans.xml",
      "java/res_base/font/chrome_google_sans_bold.xml",
      "java/res_base/font/chrome_google_sans_medium.xml",
      "java/res_base/font/chrome_google_sans_text.xml",
      "java/res_base/font/chrome_google_sans_text_medium.xml",
      "java/res_base/values/ic_launcher_alias.xml",
      "java/res_base/values/ic_launcher_round_alias.xml",
      "java/res_base/values/values.xml",
      "java/res_base/xml/network_security_config.xml",
      "java/res_chromium_base/drawable/themed_app_icon.xml",
      "java/res_chromium_base/mipmap-hdpi/app_icon.png",
      "java/res_chromium_base/mipmap-hdpi/layered_app_icon.png",
      "java/res_chromium_base/mipmap-hdpi/layered_app_icon_background.png",
      "java/res_chromium_base/mipmap-mdpi/app_icon.png",
      "java/res_chromium_base/mipmap-mdpi/layered_app_icon.png",
      "java/res_chromium_base/mipmap-mdpi/layered_app_icon_background.png",
      "java/res_chromium_base/mipmap-nodpi/layered_app_icon_foreground.xml",
      "java/res_chromium_base/mipmap-xhdpi/app_icon.png",
      "java/res_chromium_base/mipmap-xhdpi/layered_app_icon.png",
      "java/res_chromium_base/mipmap-xhdpi/layered_app_icon_background.png",
      "java/res_chromium_base/mipmap-xxhdpi/app_icon.png",
      "java/res_chromium_base/mipmap-xxhdpi/layered_app_icon.png",
      "java/res_chromium_base/mipmap-xxhdpi/layered_app_icon_background.png",
      "java/res_chromium_base/mipmap-xxxhdpi/app_icon.png",
      "java/res_chromium_base/mipmap-xxxhdpi/layered_app_icon.png",
      "java/res_chromium_base/mipmap-xxxhdpi/layered_app_icon_background.png",
      "java/res_chromium_base/values/channel_constants.xml",
    ]
  }

  android_resources("chrome_app_java_resources") {
    sources = chrome_java_resources
    sources += [ "//chrome/android/java/res_app/layout/main.xml" ]

    deps = [
      ":chrome_base_module_resources",
      ":ui_locale_string_resources",
      "//chrome/android/webapk/libs/common:splash_resources",
      "//chrome/app:java_strings_grd",
      "//chrome/browser/android/customtabs/branding:java_resources",
      "//chrome/browser/autofill/android:java_resources",
      "//chrome/browser/commerce/price_change/android:java_resources",
      "//chrome/browser/commerce/price_insights/android:java_resources",
      "//chrome/browser/download/android:java_resources",
      "//chrome/browser/educational_tip:java_resources",
      "//chrome/browser/feed/android:feed_java_resources",
      "//chrome/browser/feedback/android:java_resources",
      "//chrome/browser/hub/internal:java_resources",
      "//chrome/browser/image_descriptions:java_resources",
      "//chrome/browser/lens:java_resources",
      "//chrome/browser/magic_stack/android:java_resources",
      "//chrome/browser/mandatory_reauth/android/internal:java_resources",
      "//chrome/browser/password_check/android:java_resources",
      "//chrome/browser/password_manager/android:java_resources",
      "//chrome/browser/quick_delete:java_resources",
      "//chrome/browser/search_resumption:java_resources",
      "//chrome/browser/signin/services/android:java_resources",
      "//chrome/browser/single_tab/android:java_resources",
      "//chrome/browser/tab:java_resources",
      "//chrome/browser/tab_resumption:java_resources",
      "//chrome/browser/tab_ui/android:java_resources",
      "//chrome/browser/ui/android/appmenu:java_resources",
      "//chrome/browser/ui/android/device_lock:java_resources",
      "//chrome/browser/ui/android/favicon:java_resources",
      "//chrome/browser/ui/android/google_bottom_bar:java_resources",
      "//chrome/browser/ui/android/logo:java_resources",
      "//chrome/browser/ui/android/management:java_resources",
      "//chrome/browser/ui/android/omnibox:java_resources",
      "//chrome/browser/ui/android/quickactionsearchwidget:java_resources",
      "//chrome/browser/ui/android/signin:java_resources",
      "//chrome/browser/ui/android/strings:ui_strings_grd",
      "//chrome/browser/ui/android/theme:java_resources",
      "//chrome/browser/ui/android/toolbar:java_resources",
      "//chrome/browser/ui/android/webid/internal:java_resources",
      "//chrome/browser/ui/messages/android:java_resources",
      "//components/autofill/android:autofill_java_resources",
      "//components/autofill/android:autofill_payments_java_resources",
      "//components/blocked_content/android:java_resources",
      "//components/browser_ui/bottomsheet/android:java_resources",
      "//components/browser_ui/contacts_picker/android:java_resources",
      "//components/browser_ui/http_auth/android:java_resources",
      "//components/browser_ui/modaldialog/android:java_resources",
      "//components/browser_ui/settings/android:java_resources",
      "//components/browser_ui/strings/android:browser_ui_strings_grd",
      "//components/browser_ui/styles/android:java_resources",
      "//components/browser_ui/theme/android:java_resources",
      "//components/browser_ui/util/android:java_resources",
      "//components/browser_ui/widget/android:java_resources",
      "//components/embedder_support/android:web_contents_delegate_java_resources",
      "//components/find_in_page/android:java_resources",
      "//components/javascript_dialogs/android:java_resources",
      "//components/media_router/browser/android:java_resources",
      "//components/messages/android:java_resources",
      "//components/messages/android/internal:java_resources",
      "//components/omnibox/browser:java_resources",
      "//components/page_info/android:java_resources",
      "//components/payments/content/android:java_resources",
      "//components/permissions/android:java_resources",
      "//components/policy:app_restrictions_resources",
      "//components/strings:components_locale_settings_grd",
      "//components/strings:components_strings_grd",
      "//components/strings:privacy_sandbox_strings_grd",
      "//components/subresource_filter/android:java_resources",
      "//components/translate/content/android:java_resources",
      "//components/webapps/browser/android:java_resources",
      "//content/public/android:content_java_resources",
      "//third_party/android_deps:material_design_java",
      "//third_party/androidx:androidx_gridlayout_gridlayout_java",
      "//third_party/androidx:androidx_preference_preference_java",
    ]

    if (plus_addresses_use_internal_android_resources) {
      deps += [ "//clank/components/plus_addresses:java_resources" ]
    } else {
      deps += [ "//components/plus_addresses/android:java_resources" ]
    }
  }

  android_resources("java_overlay_resources") {
    # Target for overrides of //ui/android:ui_java_resources
    resource_overlay = true
    sources = [ "java/res_overlay/values-v33/styles.xml" ]
    deps = [ "//ui/android:ui_java_resources" ]
  }

  android_library("app_hooks_java") {
    sources = [ app_hooks_impl ]
    deps = [ ":chrome_java" ]
    jacoco_never_instrument = true
  }

  java_group("delegate_public_impl_java") {
    deps = [
      ":app_hooks_java",
      "//chrome/android/modules/readaloud/public:provider_public_java",
      "//chrome/browser/accessibility/hierarchysnapshotter/android:delegate_public_impl_java",
      "//chrome/browser/android/metrics:delegate_public_impl_java",
      "//chrome/browser/auxiliary_search:delegate_public_impl_java",
      "//chrome/browser/feedback/android:delegate_public_impl_java",
      "//chrome/browser/lens:delegate_public_impl_java",
      "//chrome/browser/locale:delegate_public_impl_java",
      "//chrome/browser/model_execution/android:delegate_public_impl_java",
      "//chrome/browser/partnerbookmarks:delegate_public_impl_java",
      "//chrome/browser/partnercustomizations:delegate_public_impl_java",
      "//chrome/browser/password_manager/android:public_impl_java",
      "//chrome/browser/policy/android:delegate_public_impl_java",
      "//chrome/browser/readaloud/android:hooks_public_impl_java",
      "//chrome/browser/supervised_user:parent_auth_delegate_impl_java",
      "//chrome/browser/touch_to_fill/password_manager/android/internal:resource_provider_public_impl_java",
      "//chrome/browser/ui/android/cars:delegate_public_impl_java",
      "//chrome/browser/ui/android/hats/internal:provider_public_impl_java",
      "//chrome/browser/webauthn/android:recommender_public_java",
      "//chrome/browser/xsurface_provider:hooks_public_impl_java",
      "//components/externalauth/android:google_delegate_public_impl_java",
      "//components/language/android:ulp_delegate_public_java",
      "//components/search_engines/android:delegate_public_impl_java",
      "//components/signin/public/android:account_email_domain_displayability_java",
      "//components/sync/android:explicit_passphrase_platform_client_stub_java",
      "//content/public/android:identity_credentials_public_impl_java",
    ]
    if (defined(enable_data_sharing_internal) && enable_data_sharing_internal) {
      deps += [ "//chrome/browser/data_sharing:delegate_public_impl_java" ]
    }
    if (defined(enable_tinker_tank_internal) && enable_tinker_tank_internal) {
      deps +=
          [ "//chrome/browser/android/tinker_tank:delegate_public_impl_java" ]
    }
  }

  android_library("google_api_keys_java") {
    srcjar_deps = [ ":chrome_android_java_google_api_keys_srcjar" ]
  }

  android_library("chrome_java") {
    deps = [
      ":base_module_java",
      ":chrome_app_java_resources",
      ":chrome_public_apk_template_resources",
      ":google_api_keys_java",
      ":java_overlay_resources",
      ":usage_stats_proto_java",
      "$google_play_services_package:google_play_services_auth_base_java",
      "$google_play_services_package:google_play_services_base_java",
      "$google_play_services_package:google_play_services_basement_java",
      "$google_play_services_package:google_play_services_cast_framework_java",
      "$google_play_services_package:google_play_services_cast_java",
      "$google_play_services_package:google_play_services_gcm_java",
      "$google_play_services_package:google_play_services_iid_java",
      "$google_play_services_package:google_play_services_tasks_java",
      "$google_play_services_package:google_play_services_vision_common_java",
      "$google_play_services_package:google_play_services_vision_java",
      "//base:content_uri_utils_java",
      "//base/version_info/android:version_constants_java",
      "//cc:cc_java",
      "//cc/mojom:mojom_java",
      "//chrome/android/features/jank_tracker:jank_tracker_java",
      "//chrome/android/features/keyboard_accessory:public_java",
      "//chrome/android/features/tab_ui:java_resources",
      "//chrome/android/features/tab_ui/public:java",
      "//chrome/android/features/tab_ui/public:ui_java_resources",
      "//chrome/android/modules/cablev2_authenticator/public:java",
      "//chrome/android/modules/stack_unwinder/provider:java",
      "//chrome/android/webapk/libs/client:client_java",
      "//chrome/android/webapk/libs/common:common_java",
      "//chrome/android/webapk/libs/common:splash_java",
      "//chrome/android/webapk/libs/runtime_library:webapk_service_aidl_java",
      "//chrome/browser/accessibility/hierarchysnapshotter/android:java",
      "//chrome/browser/android/auxiliary_search/proto:proto_java",
      "//chrome/browser/android/browserservices/intents:java",
      "//chrome/browser/android/browserservices/metrics:java",
      "//chrome/browser/android/browserservices/verification:java",
      "//chrome/browser/android/common:java",
      "//chrome/browser/android/content:java",
      "//chrome/browser/android/crypto:java",
      "//chrome/browser/android/customtabs/branding:java",
      "//chrome/browser/android/intents:java",
      "//chrome/browser/android/lifecycle:java",
      "//chrome/browser/android/messages:java",
      "//chrome/browser/android/metrics:java",
      "//chrome/browser/android/tinker_tank:delegate_java",
      "//chrome/browser/autofill/android:java",
      "//chrome/browser/auxiliary_search:java",
      "//chrome/browser/back_press/android:java",
      "//chrome/browser/battery/android:java",
      "//chrome/browser/bluetooth/android:java",
      "//chrome/browser/browser_controls/android:java",
      "//chrome/browser/browsing_data/android:java",
      "//chrome/browser/commerce/android:java",
      "//chrome/browser/commerce/merchant_viewer/android:java",
      "//chrome/browser/commerce/price_change/android:java",
      "//chrome/browser/commerce/price_insights/android:java",
      "//chrome/browser/commerce/price_tracking/android:java",
      "//chrome/browser/commerce/price_tracking/proto:proto_java",
      "//chrome/browser/commerce/subscriptions/android:subscriptions_java",
      "//chrome/browser/consent_auditor/android:java",
      "//chrome/browser/content_extraction/android:java",
      "//chrome/browser/contextmenu:java",
      "//chrome/browser/creator/android:java",
      "//chrome/browser/data_sharing:factory_java",
      "//chrome/browser/data_sharing:invitation_dialog_java",
      "//chrome/browser/data_sharing:java",
      "//chrome/browser/data_sharing:shared_image_tiles_java",
      "//chrome/browser/data_sharing:tab_group_ui_java",
      "//chrome/browser/dependency_injection:java",
      "//chrome/browser/device:java",
      "//chrome/browser/device_reauth/android:java",
      "//chrome/browser/download/android:factory_java",
      "//chrome/browser/download/android:file_provider_java",
      "//chrome/browser/download/android:java",
      "//chrome/browser/download/android:java_resources",
      "//chrome/browser/educational_tip:java",
      "//chrome/browser/enterprise/util:java",
      "//chrome/browser/feature_engagement:java",
      "//chrome/browser/feed/android:java",
      "//chrome/browser/feedback/android:factory_java",
      "//chrome/browser/feedback/android:java",
      "//chrome/browser/first_run/android:java",
      "//chrome/browser/flags:java",
      "//chrome/browser/fullscreen/android:java",
      "//chrome/browser/gesturenav/android:java",
      "//chrome/browser/gsa:java",
      "//chrome/browser/history:java",
      "//chrome/browser/history_clusters:java",
      "//chrome/browser/hub:factory_java",
      "//chrome/browser/hub:java",
      "//chrome/browser/image_descriptions:java",
      "//chrome/browser/incognito:java",
      "//chrome/browser/language/android:base_module_java",
      "//chrome/browser/language/android:java",
      "//chrome/browser/lens:java",
      "//chrome/browser/lifetime/android:java",
      "//chrome/browser/locale:java",
      "//chrome/browser/magic_stack/android:java",
      "//chrome/browser/model_execution/android:java",
      "//chrome/browser/notifications/chime/android:java",
      "//chrome/browser/omaha/android:java",
      "//chrome/browser/optimization_guide/android:java",
      "//chrome/browser/page_image_service/android:java",
      "//chrome/browser/page_load_metrics:java",
      "//chrome/browser/paint_preview/android:java",
      "//chrome/browser/partnerbookmarks:delegate_java",
      "//chrome/browser/partnercustomizations:delegate_java",
      "//chrome/browser/partnercustomizations:helper_java",
      "//chrome/browser/partnercustomizations:java",
      "//chrome/browser/password_check:public_java",
      "//chrome/browser/password_entry_edit:public_java",
      "//chrome/browser/password_manager/android:java",
      "//chrome/browser/password_manager/android:settings_interface_java",
      "//chrome/browser/password_manager/android/access_loss:java",
      "//chrome/browser/password_manager/android/account_storage_toggle:java",
      "//chrome/browser/password_manager/android/bottom_sheet:java",
      "//chrome/browser/password_manager/android/pwd_migration:java",
      "//chrome/browser/password_manager/android/pwd_migration:java_resources",
      "//chrome/browser/policy/android:java",
      "//chrome/browser/preferences:java",
      "//chrome/browser/prefetch/android:java",
      "//chrome/browser/privacy:java",
      "//chrome/browser/privacy_guide/android:java",
      "//chrome/browser/privacy_sandbox/android:java",
      "//chrome/browser/profiles/android:java",
      "//chrome/browser/quick_delete:java",
      "//chrome/browser/readaloud/android:features_java",
      "//chrome/browser/readaloud/android:java",
      "//chrome/browser/readaloud/android:metrics_java",
      "//chrome/browser/recent_tabs:factory_java",
      "//chrome/browser/recent_tabs:helper_java",
      "//chrome/browser/recent_tabs:java",
      "//chrome/browser/safe_browsing/android:java",
      "//chrome/browser/safety_check/android:java",
      "//chrome/browser/safety_hub/android:java",
      "//chrome/browser/screenshot_monitor:java",
      "//chrome/browser/search_engines/android:java",
      "//chrome/browser/search_resumption:java",
      "//chrome/browser/segmentation_platform:factory_java",
      "//chrome/browser/selection/android:java",
      "//chrome/browser/settings:factory_java",
      "//chrome/browser/settings:java",
      "//chrome/browser/share:java",
      "//chrome/browser/share/android:java_resources",
      "//chrome/browser/signin/services/android:java",
      "//chrome/browser/single_tab/android:java",
      "//chrome/browser/supervised_user:supervised_user_service_platform_delegate_java",
      "//chrome/browser/supervised_user:website_parent_approval_java",
      "//chrome/browser/sync/android:java",
      "//chrome/browser/tab:java",
      "//chrome/browser/tab_group:java",
      "//chrome/browser/tab_group_sync:factory_java",
      "//chrome/browser/tab_group_sync:features_java",
      "//chrome/browser/tab_group_sync:java",
      "//chrome/browser/tab_resumption:java",
      "//chrome/browser/tab_ui/android:java",
      "//chrome/browser/tabmodel:factory_java",
      "//chrome/browser/tabmodel:java",
      "//chrome/browser/tabpersistence:java",
      "//chrome/browser/thumbnail:java",
      "//chrome/browser/translate/android:java",
      "//chrome/browser/ui/android/appmenu:factory_java",
      "//chrome/browser/ui/android/appmenu:java",
      "//chrome/browser/ui/android/cars:java",
      "//chrome/browser/ui/android/default_browser_promo:java",
      "//chrome/browser/ui/android/desktop_windowing:java",
      "//chrome/browser/ui/android/device_lock:java",
      "//chrome/browser/ui/android/digital_credentials:java",
      "//chrome/browser/ui/android/edge_to_edge:factory_java",
      "//chrome/browser/ui/android/edge_to_edge:java",
      "//chrome/browser/ui/android/ephemeraltab:java",
      "//chrome/browser/ui/android/fast_checkout:java",
      "//chrome/browser/ui/android/favicon:java",
      "//chrome/browser/ui/android/google_bottom_bar:java",
      "//chrome/browser/ui/android/google_bottom_bar:proto_java",
      "//chrome/browser/ui/android/hats:factory_java",
      "//chrome/browser/ui/android/hats:java",
      "//chrome/browser/ui/android/hats:message_ui_delegate_java",
      "//chrome/browser/ui/android/layouts:java",
      "//chrome/browser/ui/android/layouts/glue:java",
      "//chrome/browser/ui/android/logo:java",
      "//chrome/browser/ui/android/management:java",
      "//chrome/browser/ui/android/multiwindow:java",
      "//chrome/browser/ui/android/native_page:java",
      "//chrome/browser/ui/android/night_mode:java",
      "//chrome/browser/ui/android/omnibox:java",
      "//chrome/browser/ui/android/page_info:java",
      "//chrome/browser/ui/android/pdf:java",
      "//chrome/browser/ui/android/pdf:pdf_provider_java",
      "//chrome/browser/ui/android/plus_addresses:java",
      "//chrome/browser/ui/android/preloading:java",
      "//chrome/browser/ui/android/quickactionsearchwidget:java",
      "//chrome/browser/ui/android/searchactivityutils:java",
      "//chrome/browser/ui/android/signin:java",
      "//chrome/browser/ui/android/signin:java",
      "//chrome/browser/ui/android/theme:java",
      "//chrome/browser/ui/android/toolbar:java",
      "//chrome/browser/ui/messages/android:java",
      "//chrome/browser/uid/android:java",
      "//chrome/browser/usb/android:java",
      "//chrome/browser/user_education:java",
      "//chrome/browser/util:java",
      "//chrome/browser/version:java",
      "//chrome/browser/wallet/android:java",
      "//chrome/browser/webauthn/android:java",
      "//chrome/browser/webid:java",
      "//chrome/browser/xsurface:java",
      "//chrome/browser/xsurface_provider:dependency_provider_impl_java",
      "//chrome/browser/xsurface_provider:java",
      "//components/android_autofill/browser:java",
      "//components/autofill/android:autofill_features_java",
      "//components/autofill/android:autofill_java",
      "//components/background_task_scheduler:background_task_scheduler_java",
      "//components/background_task_scheduler:background_task_scheduler_task_ids_java",
      "//components/bookmarks/common/android:bookmarks_java",
      "//components/browser_ui/accessibility/android:lib_java",
      "//components/browser_ui/accessibility/android:page_zoom_utils_java",
      "//components/browser_ui/banners/android:java",
      "//components/browser_ui/bottomsheet/android:factory_java",
      "//components/browser_ui/bottomsheet/android:java",
      "//components/browser_ui/bottomsheet/android:manager_java",
      "//components/browser_ui/client_certificate/android:java",
      "//components/browser_ui/contacts_picker/android:java",
      "//components/browser_ui/device_lock/android:java",
      "//components/browser_ui/display_cutout/android:java",
      "//components/browser_ui/http_auth/android:java",
      "//components/browser_ui/media/android:java",
      "//components/browser_ui/modaldialog/android:java",
      "//components/browser_ui/notifications/android:java",
      "//components/browser_ui/photo_picker/android:java",
      "//components/browser_ui/settings/android:java",
      "//components/browser_ui/share/android:java",
      "//components/browser_ui/site_settings/android:constants_java",
      "//components/browser_ui/site_settings/android:java",
      "//components/browser_ui/sms/android:java",
      "//components/browser_ui/styles/android:java",
      "//components/browser_ui/util/android:java",
      "//components/browser_ui/webshare/android:java",
      "//components/browser_ui/widget/android:java",
      "//components/browsing_data/content/android:java",
      "//components/browsing_data/core:java",
      "//components/commerce/core:proto_java",
      "//components/commerce/core/android:core_java",
      "//components/component_updater/android:background_task_update_scheduler_java",
      "//components/content_capture/android:java",
      "//components/content_relationship_verification/android:java",
      "//components/content_settings/android:content_settings_enums_java",
      "//components/content_settings/android:java",
      "//components/crash/android:anr_collector_java",
      "//components/crash/android:java",
      "//components/data_sharing/public:public_java",
      "//components/device_reauth:device_reauth_java_enums",
      "//components/digital_goods/mojom:mojom_java",
      "//components/dom_distiller/content/browser/android:dom_distiller_content_java",
      "//components/dom_distiller/core/android:dom_distiller_core_java",
      "//components/dom_distiller/core/mojom:mojom_java",
      "//components/download/internal/background_service:internal_java",
      "//components/download/internal/common:internal_java",
      "//components/download/network:network_java",
      "//components/download/public/common:public_java",
      "//components/download/public/task:public_java",
      "//components/embedder_support/android:application_java",
      "//components/embedder_support/android:browser_context_java",
      "//components/embedder_support/android:content_view_java",
      "//components/embedder_support/android:context_menu_java",
      "//components/embedder_support/android:simple_factory_key_java",
      "//components/embedder_support/android:util_java",
      "//components/embedder_support/android:web_contents_delegate_java",
      "//components/external_intents/android:java",
      "//components/externalauth/android:java",
      "//components/facilitated_payments/android/java",
      "//components/favicon/android:java",
      "//components/feature_engagement:feature_engagement_java",
      "//components/feed/core/proto:proto_java_v2",
      "//components/feed/core/v2:feedv2_core_java",
      "//components/find_in_page/android:java",
      "//components/gcm_driver/android:gcm_driver_java",
      "//components/gcm_driver/instance_id/android:instance_id_driver_java",
      "//components/image_fetcher:java",
      "//components/infobars/android:infobar_android_enums_java",
      "//components/infobars/android:java",
      "//components/infobars/core:infobar_enums_java",
      "//components/installedapp/android:java",
      "//components/ip_protection/android/android_auth_client_lib/client:ip_protection_auth_client_java",
      "//components/javascript_dialogs/android:java",
      "//components/language/android:java",
      "//components/location/android:location_java",
      "//components/location/android:settings_java",
      "//components/media_router/browser/android:java",
      "//components/messages/android:factory_java",
      "//components/messages/android:java",
      "//components/messages/android:manager_java",
      "//components/metrics:metrics_java",
      "//components/minidump_uploader:minidump_uploader_java",
      "//components/module_installer/android:module_installer_java",
      "//components/module_installer/android:module_interface_java",
      "//components/navigation_interception/android:navigation_interception_java",
      "//components/offline_items_collection/core:core_java",
      "//components/omnibox/browser:browser_java",
      "//components/omnibox/common:features_java",
      "//components/optimization_guide/proto:optimization_guide_proto_java",
      "//components/page_image_service/mojom:mojo_bindings_java",
      "//components/page_info/android:java",
      "//components/page_info/android:page_info_action_enum_java",
      "//components/page_info/core:proto_java",
      "//components/paint_preview/browser/android:java",
      "//components/paint_preview/player/android:java",
      "//components/password_manager/core/browser:password_manager_java_enums",
      "//components/payments/content/android:java",
      "//components/payments/content/android:service_java",
      "//components/payments/mojom:mojom_java",
      "//components/permissions/android:core_java",
      "//components/permissions/android:java",
      "//components/policy/android:policy_java",
      "//components/power_bookmarks/core:proto_java",
      "//components/prefs/android:java",
      "//components/privacy_sandbox/android:java",
      "//components/profile_metrics:browser_profile_type_enum_java",
      "//components/safe_browsing/android:safe_browsing_java",
      "//components/saved_tab_groups:java",
      "//components/schema_org/common:mojom_java",
      "//components/search_engines/android:java",
      "//components/security_interstitials/content/android:java",
      "//components/security_state/content/android:java",
      "//components/security_state/core:security_state_enums_java",
      "//components/segmentation_platform/public:public_java",
      "//components/send_tab_to_self:send_tab_to_self_java",
      "//components/signin/core/browser:signin_enums_java",
      "//components/signin/public/android:java",
      "//components/site_engagement/content/android:java",
      "//components/spellcheck/browser/android:java",
      "//components/strictmode/android:java",
      "//components/stylus_handwriting/android:java",
      "//components/subresource_filter/android:java",
      "//components/sync/android:sync_java",
      "//components/sync/protocol:protocol_java",
      "//components/sync_device_info:sync_device_info_java",
      "//components/tab_groups:tab_groups_java",
      "//components/thin_webview:factory_java",
      "//components/thin_webview:java",
      "//components/translate/content/android:java",
      "//components/translate/content/android:translate_android_enums_java",
      "//components/translate/core/common:translate_infobar_event_enum_java",
      "//components/ukm/android:java",
      "//components/url_formatter/android:url_formatter_java",
      "//components/user_prefs/android:java",
      "//components/variations:variations_java",
      "//components/variations/android:variations_java",
      "//components/viz/service:service_java",
      "//components/webapk/android/libs/client:java",
      "//components/webapk/android/libs/common:java",
      "//components/webapps/browser/android:java",
      "//components/webauthn/android:java",
      "//components/webrtc/android:java",
      "//components/webxr/android:features_java",
      "//components/webxr/android:xr_java",
      "//components/zoom/android:java",
      "//content/public/android:content_java",
      "//content/public/common:common_java",
      "//device/gamepad:java",
      "//media/base/android:media_java",
      "//media/capture/video/android:capture_java",
      "//media/midi:midi_java",
      "//mojo/public/java:bindings_java",
      "//mojo/public/java:system_java",
      "//mojo/public/java/system:system_impl_java",
      "//mojo/public/mojom/base:base_java",
      "//net/android:net_java",
      "//services/data_decoder/public/cpp/android:safe_json_java",
      "//services/device/public/java:device_feature_list_java",
      "//services/device/public/mojom:mojom_java",
      "//services/media_session/public/cpp/android:media_session_java",
      "//services/media_session/public/mojom:mojom_java",
      "//services/network/public/mojom:mojom_java",
      "//services/network/public/mojom:mojom_proxy_config_java",
      "//services/network/public/mojom:url_loader_base_java",
      "//services/service_manager/public/java:service_manager_java",
      "//services/service_manager/public/mojom:mojom_java",
      "//services/shape_detection:shape_detection_java",
      "//services/shape_detection/public/mojom:mojom_java",
      "//skia/public/mojom:mojom_java",
      "//third_party/android_deps:chromium_play_services_availability_java",
      "//third_party/android_deps:com_google_code_findbugs_jsr305_java",
      "//third_party/android_deps:dagger_java",
      "//third_party/android_deps:guava_android_java",
      "//third_party/android_deps:javax_inject_javax_inject_java",
      "//third_party/android_deps:material_design_java",
      "//third_party/android_deps:playcore_java",
      "//third_party/android_deps:protobuf_lite_runtime_java",
      "//third_party/android_media:android_media_java",
      "//third_party/android_swipe_refresh:android_swipe_refresh_java",
      "//third_party/androidx:androidx_activity_activity_java",
      "//third_party/androidx:androidx_annotation_annotation_experimental_java",
      "//third_party/androidx:androidx_asynclayoutinflater_asynclayoutinflater_appcompat_java",
      "//third_party/androidx:androidx_browser_browser_java",
      "//third_party/androidx:androidx_collection_collection_java",
      "//third_party/androidx:androidx_constraintlayout_constraintlayout_java",
      "//third_party/androidx:androidx_coordinatorlayout_coordinatorlayout_java",
      "//third_party/androidx:androidx_customview_customview_java",
      "//third_party/androidx:androidx_gridlayout_gridlayout_java",
      "//third_party/androidx:androidx_interpolator_interpolator_java",
      "//third_party/androidx:androidx_lifecycle_lifecycle_common_java8_java",
      "//third_party/androidx:androidx_lifecycle_lifecycle_runtime_java",
      "//third_party/androidx:androidx_localbroadcastmanager_localbroadcastmanager_java",
      "//third_party/androidx:androidx_mediarouter_mediarouter_java",
      "//third_party/androidx:androidx_preference_preference_java",
      "//third_party/androidx:androidx_vectordrawable_vectordrawable_animated_java",
      "//third_party/androidx:androidx_viewpager2_viewpager2_java",
      "//third_party/androidx:androidx_viewpager_viewpager_java",
      "//third_party/blink/public:blink_headers_java",
      "//third_party/blink/public/mojom:android_mojo_bindings_java",
      "//third_party/blink/public/mojom:mojom_platform_java",
      "//third_party/gif_player:gif_player_java",
      "//third_party/jni_zero:jni_zero_java",
      "//third_party/kotlin_stdlib:kotlin_stdlib_java",
      "//third_party/metrics_proto:metrics_proto_java",
      "//ui/accessibility:ax_base_java",
      "//ui/android:ui_java",
      "//ui/android:ui_no_recycler_view_java",
      "//ui/base/ime/mojom:mojom_java",
      "//ui/base/mojom:mojom_java",
      "//ui/gfx/geometry/mojom:mojom_java",
      "//url:gurl_java",
      "//url/mojom:url_mojom_gurl_java",
    ]

    deps += feed_deps

    srcjar_deps = [
      ":chrome_android_java_enums_srcjar",
      ":chrome_strict_mode_switch",
      ":resource_id_javagen",
      "//chrome:offline_pages_enum_javagen",
      "//chrome:partner_bookmarks_javagen",
      "//chrome/browser:screenshot_mode_enum",
      "//chrome/browser/notifications/scheduler/public:jni_enums",
      "//components/contextual_search/core/browser:quick_action_category_enum_javagen",
      "//components/dom_distiller/core:distiller_type_java",
      "//components/ntp_tiles:ntp_tiles_enums_java",
      "//components/offline_pages/core:offline_page_model_enums_java",
      "//components/sharing_message:sharing_dialog_type_generated_enum",
      "//components/sharing_message:sharing_send_message_result_generated_enum",
      "//components/supervised_user/core/browser:supervised_user_utils_enum_javagen",
    ]

    # From java_sources.gni.
    sources = chrome_java_sources + [ app_hooks_impl ]

    # Include sources from feed_java_sources.gni.
    sources += feed_java_sources
    srcjar_deps += feed_srcjar_deps

    # Include sources from tab_management_java_sources.gni.
    sources += public_tab_management_java_sources

    # TODO(crbug.com/40259582): Make tab_ui/ a module so that these sources can be included in "chrome_all_java".
    sources += internal_tab_management_java_sources

    srcjar_deps += [ ":chrome_jni_headers" ]

    # Add the actual implementation where necessary so that downstream targets
    # can provide their own implementations.
    jar_excluded_patterns = [ "*/AppHooksImpl.class" ]

    annotation_processor_deps = [
      # Dagger must come first so that when enable_chrome_android_internal=true,
      # the bundled version of Guava is not shadowed by the one in android_deps.
      # https://crbug.com/325425527
      "//third_party/android_deps:dagger_processor",
    ]
    annotation_processor_deps += [
      # Adding non-dagger annotation_processor_deps here prevents auto-sorting
      "//components/module_installer/android:module_interface_processor",
    ]

    processor_args_javac = [ "dagger.fastInit=enabled" ]

    resources_package = "org.chromium.chrome"

    # TODO(crbug.com/40106499): Instead of adding source files, add it as a separate
    # dependency when circular deps is resolved.
    sources += share_java_sources
    deps += share_java_deps

    # TODO(crbug.com/40172295): Instead of adding source files, add it as a separate
    # dependency when circular deps is resolved.
    sources += price_tracking_java_sources
    deps += price_tracking_java_deps

    # TODO(crbug.com/40182305): Instead of adding source files, add it as a separate
    # dependency when circular deps is resolved.
    sources += commerce_subscriptions_java_sources
    deps += commerce_subscriptions_java_deps

    if (enable_printing) {
      sources +=
          [ "java/src/org/chromium/chrome/browser/printing/TabPrinter.java" ]
      deps += [ "//printing:printing_java" ]
    }

    # TODO(crbug.com/40167648): This is temporary to not break downstream targets.
    public_deps = [ "//chrome/browser/notifications:java" ]

    if (password_manager_use_internal_android_resources) {
      deps += [ "//clank/components/password_manager:java_resources" ]
    }

    if (page_info_use_internal_android_resources) {
      deps += [ "//clank/components/page_info:java_resources" ]
    }
  }

  # Template for strict mode detection enabling/disabling so that proguard strips out
  # strict mode code when detection is disabled.
  java_cpp_template("chrome_strict_mode_switch") {
    sources = [
      "java/src/org/chromium/chrome/browser/ChromeStrictModeSwitch.template",
    ]

    # Strict mode detection is disabled for canary channel in order to catch bugs
    # related to strict mode detection being turned off early (before beta
    # channel). Strict mode detection is enabled for dev channel because dev
    # channel has more users than canary channel.
    if (is_java_debug || android_channel == "default" ||
        android_channel == "dev") {
      defines = [ "STRICT_MODE_CHECKING" ]
    }
  }

  generate_product_config_srcjar("chrome_product_config") {
    java_package = "org.chromium.chrome.browser"
  }

  # This is a list of all chrome module java dependencies. New features should be
  # added to this list.
  java_group("chrome_all_java") {
    deps = [
      ":chrome_java",
      "//chrome/android/features/keyboard_accessory:internal_java",
      "//chrome/browser/android/content:java",
      "//chrome/browser/android/httpclient:java",
      "//chrome/browser/commerce/merchant_viewer/android:java",
      "//chrome/browser/data_sharing:java",
      "//chrome/browser/download/internal/android:java",
      "//chrome/browser/facilitated_payments/ui/android/internal:java",
      "//chrome/browser/feedback/android:internal_java",
      "//chrome/browser/hub/internal:java",
      "//chrome/browser/mandatory_reauth/android/internal:java",
      "//chrome/browser/password_check:internal_java",
      "//chrome/browser/password_edit_dialog/android:java",
      "//chrome/browser/password_entry_edit/android/internal:java",
      "//chrome/browser/password_manager/android/add_username_dialog:java",
      "//chrome/browser/recent_tabs/internal:java",
      "//chrome/browser/settings:internal_java",
      "//chrome/browser/tabmodel/internal:java",
      "//chrome/browser/touch_to_fill/autofill/android/internal:java",
      "//chrome/browser/touch_to_fill/common/android:java",
      "//chrome/browser/touch_to_fill/password_manager/android/internal:java",
      "//chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android:java",
      "//chrome/browser/touch_to_fill/password_manager/password_generation/android/internal:java",
      "//chrome/browser/ui/android/appmenu/internal:java",
      "//chrome/browser/ui/android/autofill/internal:java",
      "//chrome/browser/ui/android/edge_to_edge/internal:java",
      "//chrome/browser/ui/android/fast_checkout/internal:java",
      "//chrome/browser/ui/android/hats/internal:java",
      "//chrome/browser/ui/android/plus_addresses:plus_addresses_helper_java",
      "//chrome/browser/ui/android/webid/internal:java",
      "//components/android_autofill/browser:java",
      "//components/autofill/android:payments_autofill_java",
      "//components/browser_ui/bottomsheet/android/internal:java",
      "//components/data_sharing/internal:internal_java",
      "//components/gwp_asan/client/android:gwp_asan_java",
      "//components/messages/android/internal:java",
      "//components/saved_tab_groups:java",
      "//components/segmentation_platform/internal:internal_java",
    ]
  }

  action_with_pydeps("chrome_android_java_google_api_keys_srcjar") {
    script = "//build/android/gyp/java_google_api_keys.py"
    outputs = [ "$target_gen_dir/$target_name.srcjar" ]
    args = [
      "--srcjar",
      rebase_path(outputs[0], root_build_dir),
    ]
  }

  java_cpp_enum("chrome_android_java_enums_srcjar") {
    sources = [
      "//chrome/browser/android/customtabs/detached_resource_request.h",
      "//chrome/browser/android/feedback/connectivity_checker.cc",
      "//chrome/browser/android/policy/policy_auditor.cc",
      "//chrome/browser/android/webapk/webapk_installer.h",
      "//chrome/browser/long_screenshots/long_screenshots_tab_service.h",
      "//chrome/browser/metrics/metrics_reporting_state.h",
      "//chrome/browser/notifications/notification_handler.h",
      "//chrome/browser/notifications/notification_platform_bridge_android.cc",
    ]
  }

  java_cpp_enum("chrome_vr_android_java_enums_srcjar") {
    sources = [ "//chrome/browser/vr/ui_test_input.h" ]
  }

  proto_java_library("usage_stats_proto_java") {
    proto_path = "../browser/android/usage_stats"
    sources = [ "$proto_path/website_event.proto" ]
  }

  java_cpp_template("resource_id_javagen") {
    sources = [ "java/ResourceId.template" ]
    inputs = [
      "../browser/android/resource_id.h",
      "//components/resources/android/autofill_resource_id.h",
      "//components/resources/android/blocked_content_resource_id.h",
      "//components/resources/android/page_info_resource_id.h",
      "//components/resources/android/permissions_resource_id.h",
      "//components/resources/android/sms_resource_id.h",
      "//components/resources/android/webxr_resource_id.h",
      "$root_gen_dir/device/vr/buildflags/buildflags.h",
    ]

    deps = [
      "//chrome/browser/page_info:page_info_buildflags",
      "//components/password_manager/core/browser:password_manager_buildflags",
      "//device/vr/buildflags",
    ]
  }

  robolectric_binary("chrome_junit_tests") {
    # Needed by androidx.test.core.app.ActivityScenario
    android_manifest = "//chrome/android/junit/AndroidManifest.xml"
    package_name = chrome_public_manifest_package

    # From java_sources.gni.
    sources = chrome_junit_test_java_sources

    shared_libraries = [
      "//chrome/android/junit:libchrome_junit_tests($robolectric_toolchain)",
    ]

    # Should not have any deps native targets since junit tests are java-only.
    assert_no_deps = [
      "//content",
      "//mojo/public/mojom/base",
    ]

    deps = [
      ":base_module_java",
      ":chrome_app_java_resources",
      ":chrome_java",
      ":chrome_jni_headers",
      ":chrome_unit_test_util_java",
      ":delegate_public_impl_java",
      "$google_play_services_package:google_play_services_base_java",
      "$google_play_services_package:google_play_services_basement_java",
      "$google_play_services_package:google_play_services_cast_framework_java",
      "$google_play_services_package:google_play_services_cast_java",
      "$google_play_services_package:google_play_services_gcm_java",
      "$google_play_services_package:google_play_services_tasks_java",
      "//base:base_java_test_support",
      "//base:base_java_test_support_uncommon",
      "//base:base_junit_test_support",
      "//base/test:test_support_java",
      "//base/version_info/android:version_constants_java",
      "//cc:cc_java",
      "//cc/mojom:mojom_java",
      "//chrome/android:usage_stats_proto_java",
      "//chrome/android/features/android_library_factory:junit_tests",
      "//chrome/android/features/keyboard_accessory:internal_java",
      "//chrome/android/features/keyboard_accessory/public:public_java",
      "//chrome/android/features/tab_ui/public:java",
      "//chrome/android/webapk/libs/client:client_java",
      "//chrome/android/webapk/libs/common:common_java",
      "//chrome/android/webapk/libs/common:splash_java",
      "//chrome/android/webapk/test:junit_test_support",
      "//chrome/browser/android/auxiliary_search/proto:proto_java",
      "//chrome/browser/android/browserservices/intents:java",
      "//chrome/browser/android/browserservices/intents:junit",
      "//chrome/browser/android/browserservices/metrics:java",
      "//chrome/browser/android/browserservices/verification:java",
      "//chrome/browser/android/browserservices/verification:junit_test_support",
      "//chrome/browser/android/common:java",
      "//chrome/browser/android/content:java",
      "//chrome/browser/android/crypto:java",
      "//chrome/browser/android/customtabs/branding:junit",
      "//chrome/browser/android/httpclient:junit_tests",
      "//chrome/browser/android/intents:java",
      "//chrome/browser/android/lifecycle:java",
      "//chrome/browser/android/metrics:java",
      "//chrome/browser/autofill/android:java",
      "//chrome/browser/autofill/android:junit",
      "//chrome/browser/back_press/android:java",
      "//chrome/browser/back_press/android:junit",
      "//chrome/browser/bluetooth/android:junit",
      "//chrome/browser/browser_controls/android:java",
      "//chrome/browser/browser_controls/android:junit",
      "//chrome/browser/commerce/android:java",
      "//chrome/browser/commerce/merchant_viewer/android:junit",
      "//chrome/browser/commerce/price_change/android:junit",
      "//chrome/browser/commerce/price_insights/android:junit",
      "//chrome/browser/commerce/price_tracking/android:java",
      "//chrome/browser/commerce/price_tracking/proto:proto_java",
      "//chrome/browser/commerce/subscriptions/android:subscriptions_java",
      "//chrome/browser/content_extraction/android:java",
      "//chrome/browser/contextmenu:java",
      "//chrome/browser/creator/android:java",
      "//chrome/browser/creator/android:junit",
      "//chrome/browser/data_sharing:factory_java",
      "//chrome/browser/data_sharing:java",
      "//chrome/browser/data_sharing:junit",
      "//chrome/browser/data_sharing:shared_image_tiles_java",
      "//chrome/browser/data_sharing:tab_group_ui_java",
      "//chrome/browser/dependency_injection:java",
      "//chrome/browser/device:java",
      "//chrome/browser/device:junit",
      "//chrome/browser/device_reauth/android:java",
      "//chrome/browser/download/android:java",
      "//chrome/browser/download/android:junit_tests",
      "//chrome/browser/download/internal/android:junit",
      "//chrome/browser/educational_tip:junit",
      "//chrome/browser/enterprise/util:java",
      "//chrome/browser/enterprise/util:junit",
      "//chrome/browser/facilitated_payments/ui/android/internal:junit",
      "//chrome/browser/feature_engagement:java",
      "//chrome/browser/feed/android:java",
      "//chrome/browser/feed/android:junit",
      "//chrome/browser/feedback/android:factory_java",
      "//chrome/browser/feedback/android:java",
      "//chrome/browser/first_run/android:java",
      "//chrome/browser/flags:flags_junit_tests",
      "//chrome/browser/flags:java",
      "//chrome/browser/fullscreen/android:java",
      "//chrome/browser/gsa:java",
      "//chrome/browser/history:java",
      "//chrome/browser/history_clusters:java",
      "//chrome/browser/hub:factory_java",
      "//chrome/browser/hub:java",
      "//chrome/browser/hub:junit",
      "//chrome/browser/hub/internal:java",
      "//chrome/browser/hub/internal:junit",
      "//chrome/browser/image_descriptions:java",
      "//chrome/browser/incognito:incognito_junit_tests",
      "//chrome/browser/incognito:java",
      "//chrome/browser/language/android:java",
      "//chrome/browser/language/android:junit",
      "//chrome/browser/lens:delegate_public_impl_java",
      "//chrome/browser/lens:java",
      "//chrome/browser/loading_modal/android:junit",
      "//chrome/browser/locale:java",
      "//chrome/browser/magic_stack/android:java",
      "//chrome/browser/magic_stack/android:junit",
      "//chrome/browser/mandatory_reauth/android/internal:junit",
      "//chrome/browser/model_execution/android:delegate_java",
      "//chrome/browser/notifications:java",
      "//chrome/browser/notifications:junit_tests",
      "//chrome/browser/omaha/android:java",
      "//chrome/browser/omaha/android:update_proto_java",
      "//chrome/browser/optimization_guide/android:java",
      "//chrome/browser/page_image_service/android:java",
      "//chrome/browser/page_image_service/android:junit",
      "//chrome/browser/page_load_metrics:java",
      "//chrome/browser/partnercustomizations:java",
      "//chrome/browser/partnercustomizations:junit",
      "//chrome/browser/password_edit_dialog/android:junit",
      "//chrome/browser/password_entry_edit/android/internal:junit",
      "//chrome/browser/password_manager/android:java",
      "//chrome/browser/password_manager/android:settings_interface_java",
      "//chrome/browser/password_manager/android:test_support_java",
      "//chrome/browser/password_manager/android/pwd_check_wrapper:junit",
      "//chrome/browser/password_manager/android/pwd_migration:java",
      "//chrome/browser/payments/android:junit",
      "//chrome/browser/policy/android:java",
      "//chrome/browser/policy/android:junit",
      "//chrome/browser/preferences:java",
      "//chrome/browser/preferences:preferences_junit_tests",
      "//chrome/browser/privacy_guide/android:java",
      "//chrome/browser/privacy_guide/android:junit",
      "//chrome/browser/privacy_sandbox/android:java",
      "//chrome/browser/profiles/android:java",
      "//chrome/browser/profiles/android:junit",
      "//chrome/browser/quick_delete:java",
      "//chrome/browser/quick_delete:junit",
      "//chrome/browser/readaloud/android:java",
      "//chrome/browser/readaloud/android:junit",
      "//chrome/browser/recent_tabs:java",
      "//chrome/browser/recent_tabs:junit",
      "//chrome/browser/recent_tabs/internal:junit",
      "//chrome/browser/safety_check/android:java",
      "//chrome/browser/safety_check/android:junit",
      "//chrome/browser/safety_hub/android:java",
      "//chrome/browser/safety_hub/android:junit",
      "//chrome/browser/screenshot_monitor:java",
      "//chrome/browser/search_engines/android:java",
      "//chrome/browser/search_engines/android:junit",
      "//chrome/browser/search_resumption:junit",
      "//chrome/browser/segmentation_platform:factory_java",
      "//chrome/browser/settings:factory_java",
      "//chrome/browser/settings:junit_test_support",
      "//chrome/browser/share:java",
      "//chrome/browser/signin/services/android:java",
      "//chrome/browser/signin/services/android:junit",
      "//chrome/browser/single_tab/android:java",
      "//chrome/browser/single_tab/android:junit",
      "//chrome/browser/supervised_user:junit",
      "//chrome/browser/sync/android:java",
      "//chrome/browser/tab:java",
      "//chrome/browser/tab:junit",
      "//chrome/browser/tab_group:java",
      "//chrome/browser/tab_group:junit",
      "//chrome/browser/tab_group_sync:factory_java",
      "//chrome/browser/tab_group_sync:features_java",
      "//chrome/browser/tab_group_sync:java",
      "//chrome/browser/tab_group_sync:junit",
      "//chrome/browser/tab_resumption:junit",
      "//chrome/browser/tab_ui/android:java",
      "//chrome/browser/tab_ui/android:junit",
      "//chrome/browser/tabmodel:factory_java",
      "//chrome/browser/tabmodel:java",
      "//chrome/browser/tabmodel:junit",
      "//chrome/browser/tabmodel/internal:java",
      "//chrome/browser/tabpersistence:junit",
      "//chrome/browser/thumbnail:java",
      "//chrome/browser/touch_to_fill/autofill/android/internal:junit",
      "//chrome/browser/touch_to_fill/common/android:junit",
      "//chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android:junit",
      "//chrome/browser/touch_to_fill/password_manager/password_generation/android/internal:junit",
      "//chrome/browser/translate/android:junit",
      "//chrome/browser/ui/android/appmenu:java",
      "//chrome/browser/ui/android/appmenu:java",
      "//chrome/browser/ui/android/appmenu/internal:junit",
      "//chrome/browser/ui/android/autofill/internal:junit",
      "//chrome/browser/ui/android/cars:junit",
      "//chrome/browser/ui/android/default_browser_promo:java",
      "//chrome/browser/ui/android/default_browser_promo:junit",
      "//chrome/browser/ui/android/desktop_windowing:java",
      "//chrome/browser/ui/android/desktop_windowing:junit",
      "//chrome/browser/ui/android/device_lock:junit",
      "//chrome/browser/ui/android/edge_to_edge:java",
      "//chrome/browser/ui/android/edge_to_edge/internal:junit",
      "//chrome/browser/ui/android/ephemeraltab:java",
      "//chrome/browser/ui/android/fast_checkout/internal:junit",
      "//chrome/browser/ui/android/favicon:java",
      "//chrome/browser/ui/android/google_bottom_bar:java",
      "//chrome/browser/ui/android/google_bottom_bar:junit",
      "//chrome/browser/ui/android/google_bottom_bar:proto_java",
      "//chrome/browser/ui/android/hats:factory_java",
      "//chrome/browser/ui/android/hats:junit",
      "//chrome/browser/ui/android/hats/internal:junit",
      "//chrome/browser/ui/android/hats/test:test_support_java",
      "//chrome/browser/ui/android/layouts:java",
      "//chrome/browser/ui/android/layouts:junit",
      "//chrome/browser/ui/android/layouts/glue:java",
      "//chrome/browser/ui/android/logo:java",
      "//chrome/browser/ui/android/logo:junit",
      "//chrome/browser/ui/android/management:java",
      "//chrome/browser/ui/android/management:junit",
      "//chrome/browser/ui/android/multiwindow:java",
      "//chrome/browser/ui/android/multiwindow:junit",
      "//chrome/browser/ui/android/native_page:java",
      "//chrome/browser/ui/android/native_page:junit",
      "//chrome/browser/ui/android/night_mode:java",
      "//chrome/browser/ui/android/night_mode:junit",
      "//chrome/browser/ui/android/omnibox:java",
      "//chrome/browser/ui/android/omnibox:junit",
      "//chrome/browser/ui/android/pdf:java",
      "//chrome/browser/ui/android/pdf:junit",
      "//chrome/browser/ui/android/plus_addresses:junit",
      "//chrome/browser/ui/android/preloading:java",
      "//chrome/browser/ui/android/quickactionsearchwidget:java",
      "//chrome/browser/ui/android/searchactivityutils:java",
      "//chrome/browser/ui/android/searchactivityutils:junit",
      "//chrome/browser/ui/android/signin:java",
      "//chrome/browser/ui/android/signin:junit",
      "//chrome/browser/ui/android/theme:java",
      "//chrome/browser/ui/android/theme:junit",
      "//chrome/browser/ui/android/toolbar:java",
      "//chrome/browser/ui/android/toolbar:junit",
      "//chrome/browser/ui/android/webid/internal:junit",
      "//chrome/browser/ui/messages/android:java",
      "//chrome/browser/ui/messages/android:junit",
      "//chrome/browser/uid/android:java",
      "//chrome/browser/uid/android:junit",
      "//chrome/browser/usb/android:junit",
      "//chrome/browser/user_education:java",
      "//chrome/browser/user_education:junit",
      "//chrome/browser/util:java",
      "//chrome/browser/util:junit_tests",
      "//chrome/browser/version:java",
      "//chrome/browser/wallet/android:junit",
      "//chrome/browser/webauthn/android:java",
      "//chrome/browser/webid:junit",
      "//chrome/browser/xsurface:java",
      "//chrome/browser/xsurface_provider:junit",
      "//chrome/test:sync_integration_test_support_java",
      "//chrome/test/android:chrome_java_unit_test_support",
      "//components/android_autofill/browser:java",
      "//components/autofill/android:autofill_features_java",
      "//components/autofill/android:main_autofill_java",
      "//components/autofill/android:payments_autofill_java",
      "//components/background_task_scheduler:background_task_scheduler_java",
      "//components/background_task_scheduler:background_task_scheduler_task_ids_java",
      "//components/bookmarks/common/android:bookmarks_java",
      "//components/browser_ui/accessibility/android:junit",
      "//components/browser_ui/accessibility/android:lib_java",
      "//components/browser_ui/bottomsheet/android:factory_java",
      "//components/browser_ui/bottomsheet/android:java",
      "//components/browser_ui/bottomsheet/android:manager_java",
      "//components/browser_ui/device_lock/android:java",
      "//components/browser_ui/display_cutout/android:java",
      "//components/browser_ui/media/android:java",
      "//components/browser_ui/media/android:java_resources",
      "//components/browser_ui/notifications/android:java",
      "//components/browser_ui/settings/android:java",
      "//components/browser_ui/share/android:java",
      "//components/browser_ui/site_settings/android:constants_java",
      "//components/browser_ui/site_settings/android:java",
      "//components/browser_ui/site_settings/android:junit",
      "//components/browser_ui/styles/android:java",
      "//components/browser_ui/test/android:test_support_java",
      "//components/browser_ui/util/android:java",
      "//components/browser_ui/widget/android:java",
      "//components/browser_ui/widget/android:test_support_java",
      "//components/browsing_data/core:java",
      "//components/commerce/core:proto_java",
      "//components/commerce/core/android:core_java",
      "//components/content_capture/android:java",
      "//components/content_relationship_verification/android:java",
      "//components/content_relationship_verification/android:junit_test_support",
      "//components/content_settings/android:content_settings_enums_java",
      "//components/content_settings/android:java",
      "//components/data_sharing/public:public_java",
      "//components/digital_goods/mojom:mojom_java",
      "//components/dom_distiller/core/android:dom_distiller_core_java",
      "//components/download/public/task:public_java",
      "//components/embedder_support/android:content_view_java",
      "//components/embedder_support/android:context_menu_java",
      "//components/embedder_support/android:junit_test_support",
      "//components/embedder_support/android:util_java",
      "//components/external_intents/android:java",
      "//components/externalauth/android:java",
      "//components/externalauth/android:junit",
      "//components/favicon/android:java",
      "//components/feature_engagement/public:public_java",
      "//components/feed/core/proto:proto_java_v2",
      "//components/feed/core/v2:feedv2_core_java",
      "//components/image_fetcher:java",
      "//components/image_fetcher:test_support_java",
      "//components/infobars/android:java",
      "//components/messages/android:java",
      "//components/messages/android:manager_java",
      "//components/minidump_uploader:minidump_uploader_java",
      "//components/minidump_uploader:minidump_uploader_java_test_support",
      "//components/minidump_uploader:minidump_uploader_javatests",
      "//components/module_installer/android:module_installer_java",
      "//components/offline_items_collection/core:core_java",
      "//components/omnibox/browser:browser_java",
      "//components/omnibox/browser:junit",
      "//components/optimization_guide/proto:optimization_guide_proto_java",
      "//components/page_info/android:java",
      "//components/page_info/core:proto_java",
      "//components/paint_preview/browser/android:java",
      "//components/paint_preview/player/android:java",
      "//components/payments/content/android:java",
      "//components/payments/content/android:service_java",
      "//components/payments/mojom:mojom_java",
      "//components/policy/android:policy_java",
      "//components/power_bookmarks/core:proto_java",
      "//components/prefs/android:java",
      "//components/profile_metrics:browser_profile_type_enum_java",
      "//components/saved_tab_groups:java",
      "//components/schema_org/common:mojom_java",
      "//components/search_engines/android:java",
      "//components/search_engines/android:junit",
      "//components/search_engines/android:test_utils_java",
      "//components/security_state/content/android:java",
      "//components/security_state/core:security_state_enums_java",
      "//components/segmentation_platform/public:junit",
      "//components/segmentation_platform/public:public_java",
      "//components/signin/core/browser:signin_enums_java",
      "//components/signin/public/android:java",
      "//components/signin/public/android:signin_java_test_support",
      "//components/sync/android:sync_java",
      "//components/sync/protocol:protocol_java",
      "//components/sync_device_info:sync_device_info_java",
      "//components/tab_groups:tab_groups_java",
      "//components/translate/content/android:junit",
      "//components/ukm/android:java",
      "//components/url_formatter/android:url_formatter_java",
      "//components/user_prefs/android:java",
      "//components/variations/android:variations_java",
      "//components/webapk/android/libs/client:java",
      "//components/webapk/android/libs/common:java",
      "//components/webapps/browser/android:java",
      "//components/webapps/browser/android:webapps_jni_headers_java",
      "//content/public/android:content_java",
      "//content/public/android:content_main_dex_jni_java",
      "//content/public/android:public_common_jni_java",
      "//content/public/common:common_java",
      "//content/public/test/android:content_java_test_support",
      "//mojo/public/java:bindings_java",
      "//mojo/public/java:system_java",
      "//mojo/public/mojom/base:base_java",
      "//net/android:net_java",
      "//services/device/public/mojom:mojom_java",
      "//services/media_session/public/cpp/android:media_session_java",
      "//services/media_session/public/mojom:mojom_java",
      "//services/service_manager/public/java:service_manager_java",
      "//third_party/android_deps:chromium_play_services_availability_shadows_java",
      "//third_party/android_deps:com_googlecode_java_diff_utils_diffutils_java",
      "//third_party/android_deps:dagger_java",
      "//third_party/android_deps:espresso_java",
      "//third_party/android_deps:guava_android_java",
      "//third_party/android_deps:material_design_java",
      "//third_party/android_deps:protobuf_lite_runtime_java",
      "//third_party/androidx:androidx_activity_activity_java",
      "//third_party/androidx:androidx_appcompat_appcompat_java",
      "//third_party/androidx:androidx_browser_browser_java",
      "//third_party/androidx:androidx_collection_collection_java",
      "//third_party/androidx:androidx_constraintlayout_constraintlayout_java",
      "//third_party/androidx:androidx_coordinatorlayout_coordinatorlayout_java",
      "//third_party/androidx:androidx_lifecycle_lifecycle_runtime_java",
      "//third_party/androidx:androidx_mediarouter_mediarouter_java",
      "//third_party/androidx:androidx_preference_preference_java",
      "//third_party/androidx:androidx_swiperefreshlayout_swiperefreshlayout_java",
      "//third_party/androidx:androidx_test_core_java",
      "//third_party/androidx:androidx_test_ext_junit_java",
      "//third_party/blink/public:blink_headers_java",
      "//third_party/blink/public/mojom:android_mojo_bindings_java",
      "//third_party/blink/public/mojom:mojom_core_java",
      "//third_party/blink/public/mojom:mojom_platform_java",
      "//third_party/gif_player:gif_player_java",
      "//third_party/google-truth:google_truth_java",
      "//third_party/hamcrest:hamcrest_java",
      "//third_party/metrics_proto:metrics_proto_java",
      "//ui/accessibility:ax_base_java",
      "//ui/android:ui_java",
      "//ui/android:ui_java_test_support",
      "//ui/android:ui_junit_test_support",
      "//ui/base/ime/mojom:mojom_java",
      "//ui/base/mojom:mojom_java",
      "//url:gurl_java",
      "//url:gurl_junit_test_support",
      "//url/mojom:url_mojom_gurl_java",
    ]

    deps += chrome_junit_test_java_deps
  }

  # Files used by chrome integration and unit javatests.
  android_library("chrome_unit_test_util_java") {
    testonly = true
    resources_package = "org.chromium.chrome"

    sources = [
      "javatests/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelManagerWrapper.java",
      "javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsIntentTestUtils.java",
      "javatests/src/org/chromium/chrome/browser/download/MockDownloadNotificationService.java",
      "javatests/src/org/chromium/chrome/browser/download/TestDownloadDirectoryProvider.java",
      "javatests/src/org/chromium/chrome/browser/tabmodel/TestTabModelDirectory.java",
    ]

    deps = [
      "//base:base_java",
      "//base:base_java_test_support",
      "//chrome/android:chrome_java",
      "//chrome/browser/download/android:file_provider_java",
      "//chrome/browser/preferences:java",
      "//chrome/browser/profiles/android:java",
      "//components/offline_items_collection/core:core_java",
      "//content/public/android:content_main_dex_java",
      "//content/public/test/android:content_java_test_support",
      "//third_party/androidx:androidx_annotation_annotation_java",
      "//third_party/androidx:androidx_browser_browser_java",
      "//third_party/androidx:androidx_test_core_java",
      "//third_party/androidx:androidx_test_monitor_java",
      "//third_party/junit:junit",
      "//url:gurl_java",
    ]
  }

  generate_jni("chrome_test_util_jni") {
    testonly = true
    sources = [
      "javatests/src/org/chromium/chrome/browser/FederatedIdentityTestUtils.java",
      "javatests/src/org/chromium/chrome/browser/PwaRestoreBottomSheetTestUtils.java",
      "javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsTestUtils.java",
    ]
  }

  # Files used for both chrome tests and VR/AR tests
  android_library("chrome_test_util_java") {
    testonly = true
    resources_package = "org.chromium.chrome"

    srcjar_deps = [ ":chrome_test_util_jni" ]
    sources = [
      "javatests/src/org/chromium/chrome/browser/FederatedIdentityTestUtils.java",
      "javatests/src/org/chromium/chrome/browser/PwaRestoreBottomSheetTestUtils.java",
      "javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTestRule.java",
      "javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsTestUtils.java",
      "javatests/src/org/chromium/chrome/browser/modaldialog/ChromeModalDialogTestUtils.java",
      "javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestRule.java",
      "javatests/src/org/chromium/chrome/browser/webapps/TestFetchStorageCallback.java",
      "javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestRule.java",
    ]

    public_deps = [ ":chrome_unit_test_util_java" ]

    deps = [
      ":browser_java_test_support",
      ":chrome_app_java_resources",
      "//base:base_java",
      "//base:base_java_test_support",
      "//build/android:build_java",
      "//cc:cc_java",
      "//chrome/android:chrome_java",
      "//chrome/browser/android/browserservices/intents:java",
      "//chrome/browser/android/intents:java",
      "//chrome/browser/autofill/android:java",
      "//chrome/browser/feature_engagement:java",
      "//chrome/browser/flags:java",
      "//chrome/browser/profiles/android:java",
      "//chrome/browser/tab:java",
      "//chrome/browser/ui/android/appmenu:java",
      "//chrome/test/android:chrome_java_integration_test_support",
      "//components/feature_engagement/public:public_java",
      "//components/payments/content/android:java",
      "//components/payments/content/android:java_resources",
      "//components/payments/content/android:payments_java_test_support",
      "//components/payments/content/android:service_java",
      "//components/payments/mojom:mojom_java",
      "//content/public/android:content_java",
      "//content/public/test/android:content_java_test_support",
      "//net/android:net_java_test_support",
      "//third_party/android_deps:espresso_java",
      "//third_party/android_media:android_media_resources",
      "//third_party/androidx:androidx_annotation_annotation_java",
      "//third_party/androidx:androidx_browser_browser_java",
      "//third_party/androidx:androidx_test_core_java",
      "//third_party/androidx:androidx_test_monitor_java",
      "//third_party/blink/public/mojom:android_mojo_bindings_java",
      "//third_party/hamcrest:hamcrest_java",
      "//third_party/jni_zero:jni_zero_java",
      "//third_party/junit:junit",
      "//third_party/mockito:mockito_java",
      "//ui/android:ui_no_recycler_view_java",
      "//url:gurl_java",
    ]
  }

  android_resources("chrome_unit_test_java_resources") {
    testonly = true
    sources = [ "//chrome/android/javatests/res/layout/bottombar_stub.xml" ]
  }

  android_library("chrome_unit_test_java") {
    testonly = true
    resources_package = "org.chromium.chrome"
    sources = [
      "javatests/src/org/chromium/chrome/browser/IntentFilterUnitTest.java",
      "javatests/src/org/chromium/chrome/browser/IntentHandlerNativeTest.java",
      "javatests/src/org/chromium/chrome/browser/autofill/AutofillUnitTest.java",
      "javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbarTest.java",
      "javatests/src/org/chromium/chrome/browser/bookmarks/PowerBookmarkUtilsTest.java",
      "javatests/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelBaseTest.java",
      "javatests/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelEventFilterTest.java",
      "javatests/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelManagerTest.java",
      "javatests/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulatorTest.java",
      "javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuChipControllerTest.java",
      "javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuHeaderViewTest.java",
      "javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuItemViewTest.java",
      "javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuRenderTest.java",
      "javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuUtilsTest.java",
      "javatests/src/org/chromium/chrome/browser/crash/LogcatExtractionRunnableTest.java",
      "javatests/src/org/chromium/chrome/browser/crash/MinidumpUploadServiceTest.java",
      "javatests/src/org/chromium/chrome/browser/crypto/CipherFactoryTest.java",
      "javatests/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarViewUnitTest.java",
      "javatests/src/org/chromium/chrome/browser/customtabs/CustomTabLaunchCauseMetricsTest.java",
      "javatests/src/org/chromium/chrome/browser/customtabs/features/minimizedcustomtab/MinimizedCardCoordinatorTest.java",
      "javatests/src/org/chromium/chrome/browser/customtabs/features/minimizedcustomtab/MinimizedCardViewBinderTest.java",
      "javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManagerTest.java",
      "javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceTest.java",
      "javatests/src/org/chromium/chrome/browser/download/DownloadNotificationServiceTest.java",
      "javatests/src/org/chromium/chrome/browser/download/DownloadUserInitiatedTaskManagerTest.java",
      "javatests/src/org/chromium/chrome/browser/download/SystemDownloadNotifierTest.java",
      "javatests/src/org/chromium/chrome/browser/download/dialogs/DownloadLocationDialogTest.java",
      "javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImplTest.java",
      "javatests/src/org/chromium/chrome/browser/externalnav/IntentWithRequestMetadataHandlerTest.java",
      "javatests/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeUnitTest.java",
      "javatests/src/org/chromium/chrome/browser/ntp/IncognitoDescriptionViewRenderTest.java",
      "javatests/src/org/chromium/chrome/browser/ntp/TitleUtilTest.java",
      "javatests/src/org/chromium/chrome/browser/payments/CurrencyFormatterTest.java",
      "javatests/src/org/chromium/chrome/browser/screenshot_monitor/ScreenshotMonitorTest.java",
      "javatests/src/org/chromium/chrome/browser/search_engines/settings/SearchEngineSettingsRenderTest.java",
      "javatests/src/org/chromium/chrome/browser/share/ShareUrlTest.java",
      "javatests/src/org/chromium/chrome/browser/status_indicator/StatusIndicatorViewBinderTest.java",
      "javatests/src/org/chromium/chrome/browser/tab/WebContentsStateBridgeTest.java",
      "javatests/src/org/chromium/chrome/browser/tab/state/PersistedTabDataTest.java",
      "javatests/src/org/chromium/chrome/browser/tabmodel/AsyncTabCreationParamsManagerTest.java",
      "javatests/src/org/chromium/chrome/browser/tabmodel/RestoreMigrateTest.java",
      "javatests/src/org/chromium/chrome/browser/toolbar/HomeButtonTest.java",
      "javatests/src/org/chromium/chrome/browser/toolbar/ToolbarSecurityIconTest.java",
      "javatests/src/org/chromium/chrome/browser/webapps/WebappLaunchCauseMetricsTest.java",
    ]
    deps = [
      ":chrome_app_java_resources",
      ":chrome_unit_test_java_resources",
      ":chrome_unit_test_util_java",
      "//base:base_java",
      "//base:base_java_test_support",
      "//chrome/android:base_module_java",
      "//chrome/android:chrome_java",
      "//chrome/browser/android/browserservices/intents:java",
      "//chrome/browser/android/browserservices/verification:java",
      "//chrome/browser/android/crypto:java",
      "//chrome/browser/android/intents:java",
      "//chrome/browser/browser_controls/android:java",
      "//chrome/browser/commerce/android:java",
      "//chrome/browser/commerce/price_tracking/android:java",
      "//chrome/browser/commerce/subscriptions/android:subscriptions_java",
      "//chrome/browser/contextmenu:java",
      "//chrome/browser/download/android:download_java_tests",
      "//chrome/browser/download/android:file_provider_java",
      "//chrome/browser/download/android:java",
      "//chrome/browser/feature_engagement:java",
      "//chrome/browser/first_run/android:java",
      "//chrome/browser/flags:java",
      "//chrome/browser/incognito:java",
      "//chrome/browser/lens:java",
      "//chrome/browser/preferences:java",
      "//chrome/browser/profiles/android:java",
      "//chrome/browser/screenshot_monitor:java",
      "//chrome/browser/search_engines/android:java",
      "//chrome/browser/settings:factory_java",
      "//chrome/browser/settings:test_support_java",
      "//chrome/browser/tab:java",
      "//chrome/browser/tab_group:java",
      "//chrome/browser/tabmodel:java",
      "//chrome/browser/tabpersistence:java",
      "//chrome/browser/ui/android/ephemeraltab:java",
      "//chrome/browser/ui/android/omnibox:java",
      "//chrome/browser/ui/android/pdf:java",
      "//chrome/browser/ui/android/theme:java",
      "//chrome/browser/ui/android/toolbar:java",
      "//chrome/browser/ui/messages/android:java",
      "//chrome/browser/user_education:java",
      "//chrome/test/android:chrome_java_integration_test_support",
      "//chrome/test/android:chrome_java_unit_test_support",
      "//components/autofill/android:main_autofill_java",
      "//components/background_task_scheduler:background_task_scheduler_task_ids_java",
      "//components/background_task_scheduler:public_java",
      "//components/bookmarks/common/android:bookmarks_java",
      "//components/browser_ui/modaldialog/android:java",
      "//components/browser_ui/notifications/android:java",
      "//components/browser_ui/settings/android:java",
      "//components/browser_ui/styles/android:java",
      "//components/browser_ui/util/android:java",
      "//components/browser_ui/widget/android:java",
      "//components/commerce/core/android:core_java",
      "//components/crash/android:java",
      "//components/dom_distiller/core/android:dom_distiller_core_java",
      "//components/embedder_support/android:context_menu_java",
      "//components/embedder_support/android:util_java",
      "//components/external_intents/android:java",
      "//components/externalauth/android:java",
      "//components/favicon/android:java",
      "//components/image_fetcher:java",
      "//components/minidump_uploader:minidump_uploader_java",
      "//components/minidump_uploader:minidump_uploader_java_test_support",
      "//components/offline_items_collection/core:core_java",
      "//components/payments/content/android:full_java",
      "//components/power_bookmarks/core:proto_java",
      "//components/prefs/android:java",
      "//components/search_engines/android:java",
      "//components/search_engines/android:test_utils_java",
      "//components/security_state/content/android:java",
      "//components/security_state/core:security_state_enums_java",
      "//components/signin/public/android:java",
      "//components/signin/public/android:signin_java_test_support",
      "//components/user_prefs/android:java",
      "//components/webapps/browser/android:java",
      "//content/public/android:content_full_java",
      "//content/public/android:content_java",
      "//content/public/android:content_main_dex_java",
      "//content/public/common:common_java",
      "//content/public/test/android:content_java_test_support",
      "//net/android:net_java",
      "//third_party/android_deps:espresso_java",
      "//third_party/android_deps:guava_android_java",
      "//third_party/android_deps:material_design_java",
      "//third_party/android_deps:protobuf_lite_runtime_java",
      "//third_party/android_sdk:android_test_mock_java",
      "//third_party/androidx:androidx_annotation_annotation_java",
      "//third_party/androidx:androidx_appcompat_appcompat_java",
      "//third_party/androidx:androidx_browser_browser_java",
      "//third_party/androidx:androidx_coordinatorlayout_coordinatorlayout_java",
      "//third_party/androidx:androidx_core_core_java",
      "//third_party/androidx:androidx_fragment_fragment_java",
      "//third_party/androidx:androidx_test_core_java",
      "//third_party/androidx:androidx_test_monitor_java",
      "//third_party/androidx:androidx_test_rules_java",
      "//third_party/androidx:androidx_test_runner_java",
      "//third_party/androidx:androidx_viewpager_viewpager_java",
      "//third_party/blink/public:blink_headers_java",
      "//third_party/hamcrest:hamcrest_core_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_full_java",
      "//ui/android:ui_java_test_support",
      "//url:android_test_helper_java",
      "//url:gurl_java",
      "//url:gurl_junit_test_support",
      "//url:url_java_unit_tests",
    ]

    sources += share_unit_device_javatest_java_sources
    deps += share_unit_device_javatest_java_deps

    data = [ "//chrome/test/data/android/" ]
  }

  android_library("chrome_test_java") {
    testonly = true
    resources_package = "org.chromium.chrome.test"

    # From java_sources.gni.
    sources = chrome_test_java_sources

    mergeable_android_manifests =
        [ "javatests/AndroidManifest_ChromeTests.xml" ]

    deps = [
      ":base_module_java",
      ":browser_java_test_support",
      ":chrome_app_java_resources",
      ":chrome_test_util_java",
      ":delegate_public_impl_java",
      "$google_play_services_package:google_play_services_base_java",
      "$google_play_services_package:google_play_services_basement_java",
      "$google_play_services_package:google_play_services_cast_framework_java",
      "$google_play_services_package:google_play_services_cast_java",
      "$google_play_services_package:google_play_services_gcm_java",
      "$google_play_services_package:google_play_services_iid_java",
      "$google_play_services_package:google_play_services_tasks_java",
      "//base:base_java",
      "//base:base_java_test_support",
      "//base:base_java_test_support_uncommon",
      "//base:content_uri_utils_java",
      "//base/test:public_transit_java",
      "//base/test:test_support_java",
      "//base/version_info/android:version_constants_java",
      "//build/android:build_java",
      "//cc:cc_java",
      "//chrome/android:chrome_java",
      "//chrome/android/features/keyboard_accessory/public:public_java",
      "//chrome/android/features/tab_ui:java_resources",
      "//chrome/android/features/tab_ui:test_support_javalib",
      "//chrome/android/features/tab_ui/public:java",
      "//chrome/android/webapk/libs/client:client_java",
      "//chrome/android/webapk/libs/common:common_java",
      "//chrome/android/webapk/libs/runtime_library:webapk_service_aidl_java",
      "//chrome/browser/android/browserservices/intents:java",
      "//chrome/browser/android/browserservices/verification:java",
      "//chrome/browser/android/browserservices/verification:javatests",
      "//chrome/browser/android/common:java",
      "//chrome/browser/android/content:java",
      "//chrome/browser/android/crypto:java",
      "//chrome/browser/android/customtabs/branding:java",
      "//chrome/browser/android/httpclient:javatests",
      "//chrome/browser/android/intents:java",
      "//chrome/browser/android/lifecycle:java",
      "//chrome/browser/android/metrics:java",
      "//chrome/browser/android/metrics:ukm_java_test_support",
      "//chrome/browser/android/metrics:ukm_javatests",
      "//chrome/browser/autofill/android:java_resources",
      "//chrome/browser/autofill/test:test_support_java",
      "//chrome/browser/back_press/android:java",
      "//chrome/browser/browser_controls/android:java",
      "//chrome/browser/browsing_data/android:java",
      "//chrome/browser/commerce/android:java",
      "//chrome/browser/commerce/android:javatests",
      "//chrome/browser/commerce/merchant_viewer/android:java",
      "//chrome/browser/commerce/merchant_viewer/android:javatests",
      "//chrome/browser/commerce/price_insights/android:java",
      "//chrome/browser/commerce/price_insights/android:javatests",
      "//chrome/browser/commerce/price_tracking/android:java",
      "//chrome/browser/commerce/subscriptions/android:subscriptions_java",
      "//chrome/browser/contextmenu:java",
      "//chrome/browser/data_sharing:javatests",
      "//chrome/browser/dependency_injection:java",
      "//chrome/browser/device:java",
      "//chrome/browser/device_reauth/android:java",
      "//chrome/browser/download/android:file_provider_java",
      "//chrome/browser/download/android:java",
      "//chrome/browser/enterprise/util:java",
      "//chrome/browser/enterprise/util:test_support_java",
      "//chrome/browser/feature_engagement:java",
      "//chrome/browser/feed/android:java",
      "//chrome/browser/feed/android:javatests",
      "//chrome/browser/feedback/android:factory_java",
      "//chrome/browser/feedback/android:java",
      "//chrome/browser/first_run/android:java",
      "//chrome/browser/flags:java",
      "//chrome/browser/fullscreen/android:java",
      "//chrome/browser/history_clusters:java",
      "//chrome/browser/hub:factory_java",
      "//chrome/browser/hub:java",
      "//chrome/browser/image_descriptions:javatests",
      "//chrome/browser/incognito:incognito_java_tests",
      "//chrome/browser/incognito:java",
      "//chrome/browser/language/android:base_module_java",
      "//chrome/browser/language/android:java",
      "//chrome/browser/language/android:javatests",
      "//chrome/browser/lens:java",
      "//chrome/browser/locale:java",
      "//chrome/browser/magic_stack/android:java",
      "//chrome/browser/notifications:java",
      "//chrome/browser/notifications:javatests",
      "//chrome/browser/omaha/android:java",
      "//chrome/browser/optimization_guide/android:java",
      "//chrome/browser/optimization_guide/android:javatests",
      "//chrome/browser/page_load_metrics:java",
      "//chrome/browser/paint_preview/android:java",
      "//chrome/browser/paint_preview/android:javatests",
      "//chrome/browser/partnercustomizations:delegate_java",
      "//chrome/browser/partnercustomizations:java",
      "//chrome/browser/partnercustomizations:test_support_java",
      "//chrome/browser/password_check:public_java",
      "//chrome/browser/password_entry_edit/android/internal:javatests",
      "//chrome/browser/password_manager/android:java",
      "//chrome/browser/password_manager/android:settings_interface_java",
      "//chrome/browser/password_manager/android:test_support_java",
      "//chrome/browser/password_manager/android/access_loss:helper_java",
      "//chrome/browser/password_manager/android/account_storage_toggle:java",
      "//chrome/browser/password_manager/android/pwd_check_wrapper:test_support_java",
      "//chrome/browser/password_manager/android/pwd_migration:java",
      "//chrome/browser/policy/android:java",
      "//chrome/browser/preferences:java",
      "//chrome/browser/prefetch/android:java",
      "//chrome/browser/prefetch/android:javatests",
      "//chrome/browser/privacy_guide/android:java",
      "//chrome/browser/privacy_guide/android:javatests",
      "//chrome/browser/privacy_sandbox/android:java",
      "//chrome/browser/privacy_sandbox/android:java_resources",
      "//chrome/browser/privacy_sandbox/android:javatests",
      "//chrome/browser/profiles/android:java",
      "//chrome/browser/quick_delete:java",
      "//chrome/browser/quick_delete:javatests",
      "//chrome/browser/readaloud/android:java",
      "//chrome/browser/safe_browsing/android:java",
      "//chrome/browser/safe_browsing/android:javatests",
      "//chrome/browser/safety_check/android:java",
      "//chrome/browser/safety_check/android:javatests",
      "//chrome/browser/safety_hub/android:java",
      "//chrome/browser/safety_hub/android:javatests",
      "//chrome/browser/screenshot_monitor:java",
      "//chrome/browser/search_engines/android:java",
      "//chrome/browser/segmentation_platform:javatests",
      "//chrome/browser/selection/android:javatests",
      "//chrome/browser/settings:java",
      "//chrome/browser/settings:test_support_java",
      "//chrome/browser/share:java",
      "//chrome/browser/share/android:java_resources",
      "//chrome/browser/signin/services/android:java",
      "//chrome/browser/single_tab/android:java",
      "//chrome/browser/supervised_user:javatests",
      "//chrome/browser/supervised_user:test_support_java",
      "//chrome/browser/sync/android:java",
      "//chrome/browser/sync/test/android:test_support_java",
      "//chrome/browser/tab:critical_persisted_tab_data_proto_java",
      "//chrome/browser/tab:java",
      "//chrome/browser/tab_group:java",
      "//chrome/browser/tab_group_sync:features_java",
      "//chrome/browser/tab_group_sync:javatests",
      "//chrome/browser/tab_ui/android:java",
      "//chrome/browser/tabmodel:java",
      "//chrome/browser/tabmodel/internal:java",
      "//chrome/browser/tabpersistence:flatbuffer_java",
      "//chrome/browser/tabpersistence:java",
      "//chrome/browser/thumbnail:java",
      "//chrome/browser/thumbnail:javatests",
      "//chrome/browser/touch_to_fill/autofill/android/internal:java_resources",
      "//chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android:java_resources",
      "//chrome/browser/translate/android:java",
      "//chrome/browser/translate/android:javatests",
      "//chrome/browser/ui/android/appmenu:java",
      "//chrome/browser/ui/android/appmenu/test:test_support_java",
      "//chrome/browser/ui/android/desktop_windowing:java",
      "//chrome/browser/ui/android/device_lock:java",
      "//chrome/browser/ui/android/device_lock:java_resources",
      "//chrome/browser/ui/android/device_lock:javatests",
      "//chrome/browser/ui/android/edge_to_edge:java",
      "//chrome/browser/ui/android/edge_to_edge/internal:java",
      "//chrome/browser/ui/android/ephemeraltab:java",
      "//chrome/browser/ui/android/favicon:java",
      "//chrome/browser/ui/android/hats:java",
      "//chrome/browser/ui/android/hats/test:test_support_java",
      "//chrome/browser/ui/android/layouts:java",
      "//chrome/browser/ui/android/layouts/test:java",
      "//chrome/browser/ui/android/logo:java",
      "//chrome/browser/ui/android/multiwindow:javatests",
      "//chrome/browser/ui/android/native_page:java",
      "//chrome/browser/ui/android/night_mode:java",
      "//chrome/browser/ui/android/night_mode:night_mode_java_test_support",
      "//chrome/browser/ui/android/omnibox:java",
      "//chrome/browser/ui/android/page_info:java",
      "//chrome/browser/ui/android/pdf:java",
      "//chrome/browser/ui/android/quickactionsearchwidget:java",
      "//chrome/browser/ui/android/quickactionsearchwidget:javatests",
      "//chrome/browser/ui/android/searchactivityutils:java",
      "//chrome/browser/ui/android/signin:java",
      "//chrome/browser/ui/android/signin:javatests",
      "//chrome/browser/ui/android/theme:java",
      "//chrome/browser/ui/android/toolbar:java",
      "//chrome/browser/ui/messages/android:java",
      "//chrome/browser/uid/android:java",
      "//chrome/browser/util:java",
      "//chrome/test:sync_integration_test_support_java",
      "//chrome/test:test_support_java",
      "//chrome/test/android:chrome_java_integration_test_support",
      "//chrome/test/android:chrome_java_test_pagecontroller",
      "//chrome/test/android:chrome_java_transit",
      "//chrome/test/android:live_signin_test_util_public_impl_java",
      "//chrome/test/android/test_trusted_web_activity:test_trusted_web_activity_java",
      "//components/autofill/android:autofill_features_java",
      "//components/autofill/android:autofill_java",
      "//components/background_task_scheduler:background_task_scheduler_java",
      "//components/background_task_scheduler:background_task_scheduler_task_ids_java",
      "//components/bookmarks/common/android:bookmarks_java",
      "//components/browser_ui/accessibility/android:lib_java",
      "//components/browser_ui/accessibility/android:page_zoom_utils_java",
      "//components/browser_ui/bottomsheet/android:factory_java",
      "//components/browser_ui/bottomsheet/android:java",
      "//components/browser_ui/bottomsheet/android:manager_java",
      "//components/browser_ui/bottomsheet/android/test:java",
      "//components/browser_ui/device_lock/android:java",
      "//components/browser_ui/display_cutout/android:java",
      "//components/browser_ui/media/android:java",
      "//components/browser_ui/modaldialog/android:java",
      "//components/browser_ui/modaldialog/android:java_resources",
      "//components/browser_ui/modaldialog/android:java_test_resources",
      "//components/browser_ui/modaldialog/android:test_support_java",
      "//components/browser_ui/notifications/android:java",
      "//components/browser_ui/notifications/android:test_support_java",
      "//components/browser_ui/settings/android:java",
      "//components/browser_ui/settings/android:test_support_java",
      "//components/browser_ui/share/android:java",
      "//components/browser_ui/share/android:javatests",
      "//components/browser_ui/site_settings/android:constants_java",
      "//components/browser_ui/site_settings/android:java",
      "//components/browser_ui/site_settings/android:java_resources",
      "//components/browser_ui/site_settings/android:javatests",
      "//components/browser_ui/sms/android:java",
      "//components/browser_ui/styles/android:java",
      "//components/browser_ui/util/android:java",
      "//components/browser_ui/widget/android:java",
      "//components/browser_ui/widget/android:test_support_java",
      "//components/browsing_data/content/android:java",
      "//components/browsing_data/core:java",
      "//components/commerce/core:proto_java",
      "//components/commerce/core/android:core_java",
      "//components/content_settings/android:content_settings_enums_java",
      "//components/content_settings/android:java",
      "//components/crash/android:java",
      "//components/digital_goods/mojom:mojom_java",
      "//components/dom_distiller/core/android:dom_distiller_core_java",
      "//components/dom_distiller/core/mojom:mojom_java",
      "//components/download/internal/background_service:internal_java",
      "//components/download/internal/common:internal_java",
      "//components/download/network:network_java",
      "//components/download/public/common:public_java",
      "//components/embedder_support/android:content_view_java",
      "//components/embedder_support/android:context_menu_java",
      "//components/embedder_support/android:simple_factory_key_java",
      "//components/embedder_support/android:util_java",
      "//components/embedder_support/android:web_contents_delegate_java",
      "//components/external_intents/android:java",
      "//components/external_intents/android:test_support_java",
      "//components/externalauth/android:java",
      "//components/favicon/android:java",
      "//components/feature_engagement:feature_engagement_java",
      "//components/feed/core/v2:feedv2_core_java",
      "//components/find_in_page/android:java",
      "//components/gcm_driver/android:gcm_driver_java",
      "//components/gcm_driver/instance_id/android:instance_id_driver_java",
      "//components/gcm_driver/instance_id/android:instance_id_driver_test_support_java",
      "//components/image_fetcher:java",
      "//components/image_fetcher:test_support_java",
      "//components/infobars/android:java",
      "//components/infobars/core:infobar_enums_java",
      "//components/javascript_dialogs/android:java",
      "//components/language/android:java",
      "//components/language/android:javatests",
      "//components/location/android:location_java",
      "//components/media_router/browser/android:java",
      "//components/media_router/browser/android:test_support_java",
      "//components/messages/android:java",
      "//components/messages/android/internal:java",
      "//components/messages/android/internal:java_resources",
      "//components/messages/android/test:test_support_java",
      "//components/metrics:metrics_java",
      "//components/minidump_uploader:minidump_uploader_java",
      "//components/minidump_uploader:minidump_uploader_java_test_support",
      "//components/navigation_interception/android:navigation_interception_java",
      "//components/offline_items_collection/core:core_java",
      "//components/omnibox/browser:browser_java",
      "//components/omnibox/browser:junit_test_support",
      "//components/omnibox/common:features_java",
      "//components/optimization_guide/proto:optimization_guide_proto_java",
      "//components/page_info/android:java",
      "//components/page_info/android:javatests",
      "//components/page_info/android:page_info_action_enum_java",
      "//components/page_info/core:proto_java",
      "//components/paint_preview/player/android:java",
      "//components/paint_preview/player/android:javatests",
      "//components/password_manager/core/browser:password_manager_java_enums",
      "//components/payments/content/android:java",
      "//components/payments/content/android:payments_java_test_support",
      "//components/payments/content/android:service_java",
      "//components/payments/mojom:mojom_java",
      "//components/permissions/android:content_settings_enums_java",
      "//components/permissions/android:core_java",
      "//components/permissions/android:java",
      "//components/policy/android:policy_java",
      "//components/policy/android:policy_java_test_support",
      "//components/power_bookmarks/core:proto_java",
      "//components/prefs/android:java",
      "//components/privacy_sandbox/android:javatests",
      "//components/profile_metrics:browser_profile_type_enum_java",
      "//components/safe_browsing/android:safe_browsing_java",
      "//components/schema_org/common:mojom_java",
      "//components/search_engines/android:java",
      "//components/search_engines/android:test_utils_java",
      "//components/security_interstitials/content/android:java",
      "//components/security_state/content/android:java",
      "//components/security_state/core:security_state_enums_java",
      "//components/send_tab_to_self:send_tab_to_self_java",
      "//components/signin/core/browser:signin_enums_java",
      "//components/signin/public/android:java",
      "//components/signin/public/android:signin_java_test_support",
      "//components/signin/public/android:signin_test_resources",
      "//components/site_engagement/content/android:java",
      "//components/sync/android:sync_java",
      "//components/sync/protocol:protocol_java",
      "//components/sync_device_info:sync_device_info_java",
      "//components/tab_groups:tab_groups_java",
      "//components/url_formatter/android:url_formatter_java",
      "//components/user_prefs/android:java",
      "//components/webapk:proto_java",
      "//components/webapk/android/libs/client:java",
      "//components/webapk/android/libs/common:java",
      "//components/webapps/browser/android:java",
      "//components/webauthn/android:java",
      "//components/webauthn/android:test_support_java",
      "//content/public/android:content_java",
      "//content/public/common:common_java",
      "//content/public/test/android:content_java_test_support",
      "//content/public/test/android:content_transit_java",
      "//media/base/android:java_switches",
      "//media/base/android:media_java",
      "//mojo/public/java:bindings_java",
      "//mojo/public/java:system_java",
      "//mojo/public/mojom/base:base_java",
      "//net/android:net_java",
      "//net/android:net_java_test_support",
      "//services:services_javatests",
      "//services/device/public/java:device_feature_list_java",
      "//services/device/public/java:geolocation_java",
      "//services/device/public/java:geolocation_java_test_support",
      "//services/device/public/mojom:mojom_java",
      "//services/media_session/public/mojom:mojom_java",
      "//services/network/public/mojom:mojom_java",
      "//services/network/public/mojom:mojom_proxy_config_java",
      "//services/network/public/mojom:url_loader_base_java",
      "//services/service_manager/public/java:service_manager_java",
      "//third_party/android_deps:com_google_code_findbugs_jsr305_java",
      "//third_party/android_deps:espresso_java",
      "//third_party/android_deps:material_design_java",
      "//third_party/android_deps:protobuf_lite_runtime_java",
      "//third_party/android_deps/local_modifications/preconditions/javatests",
      "//third_party/android_sdk:android_test_mock_java",
      "//third_party/androidx:androidx_activity_activity_java",
      "//third_party/androidx:androidx_browser_browser_java",
      "//third_party/androidx:androidx_collection_collection_java",
      "//third_party/androidx:androidx_preference_preference_java",
      "//third_party/androidx:androidx_test_core_java",
      "//third_party/androidx:androidx_test_monitor_java",
      "//third_party/androidx:androidx_test_rules_java",
      "//third_party/androidx:androidx_test_runner_java",
      "//third_party/androidx:androidx_test_uiautomator_uiautomator_java",
      "//third_party/androidx:androidx_viewpager2_viewpager2_java",
      "//third_party/androidx:androidx_viewpager_viewpager_java",
      "//third_party/blink/public:blink_headers_java",
      "//third_party/blink/public/common:common_java",
      "//third_party/blink/public/mojom:android_mojo_bindings_java",
      "//third_party/blink/public/mojom:mojom_core_java",
      "//third_party/blink/public/mojom:mojom_mhtml_load_result_java",
      "//third_party/blink/public/mojom:mojom_platform_java",
      "//third_party/blink/public/mojom:web_feature_mojo_bindings_java",
      "//third_party/flatbuffers:flatbuffers_java",
      "//third_party/hamcrest:hamcrest_java",
      "//third_party/jni_zero:jni_zero_java",
      "//third_party/junit",
      "//third_party/metrics_proto:metrics_proto_java",
      "//third_party/mockito:mockito_java",
      "//ui/accessibility:ax_base_java",
      "//ui/android:clipboard_java_test_support",
      "//ui/android:ui_android_features_java",
      "//ui/android:ui_java",
      "//ui/android:ui_java_test_support",
      "//ui/base/ime/mojom:mojom_java",
      "//ui/base/mojom:mojom_java",
      "//url:android_test_helper_java",
      "//url:gurl_java",
      "//url:gurl_junit_test_support",
      "//url/mojom:url_mojom_gurl_java",
      "//url/mojom:url_mojom_origin_java",
    ]

    deps += feed_test_deps

    if (enable_printing) {
      deps += [ "//printing:printing_java" ]
    }

    srcjar_deps = [ "//chrome/browser:tos_dialog_behavior_generated_enum" ]

    data = [
      "//chrome/test/data/android/",
      "//chrome/test/data/autofill/",
      "//chrome/test/data/background_sync/",
      "//chrome/test/data/banners/",
      "//chrome/test/data/dom_distiller/",
      "//chrome/test/data/browsing_data/",
      "//chrome/test/data/encoding_tests/auto_detect/Big5_with_no_encoding_specified.html",
      "//chrome/test/data/geolocation/",
      "//chrome/test/data/google/",
      "//chrome/test/data/image_search/valid.png",
      "//chrome/test/data/media/",
      "//chrome/test/data/navigation_interception/",
      "//chrome/test/data/notifications/",
      "//chrome/test/data/offline_pages/",
      "//chrome/test/data/password/",
      "//chrome/test/data/popup_blocker/",
      "//chrome/test/data/push_messaging/",
      "//chrome/test/data/translate/",
      "//chrome/test/data/webauthn/",
      "//chrome/test/media_router/resources/",
      "//components/test/data/autofill/",
      "//components/test/data/payments/",
      "//content/test/data/browsing_data/",
      "//content/test/data/android/authenticator.html",
      "//content/test/data/android/auto_downloads_permissions.html",
      "//content/test/data/android/eme_permissions.html",
      "//content/test/data/android/geolocation.html",
      "//content/test/data/android/installedapp.html",
      "//content/test/data/android/media_permissions.html",
      "//content/test/data/android/midi_permissions.html",
      "//content/test/data/android/permission_navigation.html",
      "//content/test/data/android/webshare.html",
      "//content/test/data/android/webshare-apk.html",
      "//content/test/data/android/webshare-bmp.html",
      "//content/test/data/android/webshare-csv.html",
      "//content/test/data/android/webshare-dex.html",
      "//content/test/data/android/webshare-ogg.html",
      "//content/test/data/android/webshare-many.html",
      "//content/test/data/android/webshare-large.html",
      "//content/test/data/android/webshare-long.html",
      "//content/test/data/android/webshare-separator.html",
      "//content/test/data/media/bear.webm",
      "//content/test/data/media/getusermedia.html",
      "//content/test/data/media/session/",
      "//content/test/data/media/video-player.html",
      "//content/test/data/media/webrtc_test_utilities.js",
      "//media/test/data/bear-av1.mp4",
      "//media/test/data/bear-hevc-frag.mp4",
      "//media/test/data/bear-vp8-webvtt.webm",
      "//media/test/data/bear-vp8a.webm",
      "//media/test/data/bear-vp9.webm",
      "//media/test/data/bear.mp4",
      "//media/test/data/sfx.mp3",
    ]

    data_deps = [ "//ui/base:goldctl" ]
  }

  if (enable_vr || enable_arcore) {
    chrome_test_xr_java_deps = [
      ":chrome_test_util_java",
      "//base:base_java",
      "//base:base_java_test_support",
      "//chrome/android:chrome_java",
      "//chrome/android:delegate_public_impl_java",
      "//chrome/browser/flags:java",
      "//chrome/browser/tab:java",
      "//chrome/browser/tabmodel:java",
      "//chrome/browser/ui/messages/android:java",
      "//chrome/browser/util:java",
      "//chrome/test/android:chrome_java_integration_test_support",
      "//components/embedder_support/android:content_view_java",
      "//components/embedder_support/android:util_java",
      "//components/permissions/android:java",
      "//components/policy/android:policy_java",
      "//components/webxr/android:xr_java",
      "//content/public/android:content_java",
      "//content/public/test/android:content_java_test_support",
      "//net/android:net_java_test_support",
      "//third_party/androidx:androidx_annotation_annotation_java",
      "//third_party/androidx:androidx_browser_browser_java",
      "//third_party/androidx:androidx_test_core_java",
      "//third_party/androidx:androidx_test_monitor_java",
      "//third_party/androidx:androidx_test_rules_java",
      "//third_party/androidx:androidx_test_runner_java",
      "//third_party/androidx:androidx_test_uiautomator_uiautomator_java",
      "//third_party/junit",
      "//ui/android:ui_java",
    ]

    # Files used for both VR and AR testing
    android_library("chrome_test_xr_java") {
      testonly = true

      sources = [
        "javatests/src/org/chromium/chrome/browser/vr/WebXrTestFramework.java",
        "javatests/src/org/chromium/chrome/browser/vr/XrTestFramework.java",
        "javatests/src/org/chromium/chrome/browser/vr/rules/ChromeTabbedActivityXrTestRule.java",
        "javatests/src/org/chromium/chrome/browser/vr/rules/CustomTabActivityXrTestRule.java",
        "javatests/src/org/chromium/chrome/browser/vr/rules/WebappActivityXrTestRule.java",
        "javatests/src/org/chromium/chrome/browser/vr/rules/XrActivityRestriction.java",
        "javatests/src/org/chromium/chrome/browser/vr/rules/XrActivityRestrictionRule.java",
        "javatests/src/org/chromium/chrome/browser/vr/rules/XrTestRule.java",
        "javatests/src/org/chromium/chrome/browser/vr/util/PermissionUtils.java",
        "javatests/src/org/chromium/chrome/browser/vr/util/XrTestRuleUtils.java",
      ]

      deps = chrome_test_xr_java_deps

      data = [
        "//chrome/test/data/android/feed/",
        "//chrome/test/data/xr/e2e_test_files/",
        "//third_party/blink/web_tests/resources/testharness.js",
      ]

      data_deps = [ "//ui/base:goldctl" ]
    }

    if (enable_vr) {
      # All files necessary for VR instrumentation tests
      android_library("chrome_test_vr_java") {
        testonly = true
        resources_package = "org.chromium.chrome.vr"

        sources = [
          "javatests/src/org/chromium/chrome/browser/vr/WebXrVrPermissionTestFramework.java",
          "javatests/src/org/chromium/chrome/browser/vr/WebXrVrTestFramework.java",
          "javatests/src/org/chromium/chrome/browser/vr/rules/VrTestRule.java",
        ]

        deps = chrome_test_xr_java_deps + [
                 ":chrome_test_util_java",
                 "//base:base_java_test_support_uncommon",
                 "//chrome/android:chrome_test_xr_java",
                 "//chrome/browser/profiles/android:java",
                 "//chrome/browser/settings:java",
                 "//chrome/browser/tabmodel:java",
                 "//components/browser_ui/site_settings/android:java",
                 "//components/content_settings/android:content_settings_enums_java",
                 "//components/infobars/android:java",
                 "//components/messages/android:java",
                 "//components/messages/android/internal:java",
                 "//components/messages/android/test:test_support_java",
                 "//components/module_installer/android:module_installer_java",
                 "//third_party/androidx:androidx_test_core_java",
                 "//third_party/androidx:androidx_test_core_java",
                 "//ui/android:ui_java_test_support",
               ]

        if (enable_cardboard) {
          sources += [
            "javatests/src/org/chromium/chrome/browser/vr/WebXrVrCardboardDeviceTest.java",
            "javatests/src/org/chromium/chrome/browser/vr/WebXrVrCardboardInputTest.java",
            "javatests/src/org/chromium/chrome/browser/vr/WebXrVrCardboardPermissionTest.java",
            "javatests/src/org/chromium/chrome/browser/vr/WebXrVrCardboardQrCodeTest.java",
            "javatests/src/org/chromium/chrome/browser/vr/WebXrVrCardboardTabTest.java",
            "javatests/src/org/chromium/chrome/browser/vr/WebXrVrCardboardTransitionTest.java",
            "javatests/src/org/chromium/chrome/browser/vr/rules/ChromeTabbedActivityVrCardboardTestRule.java",
            "javatests/src/org/chromium/chrome/browser/vr/rules/CustomTabActivityVrCardboardTestRule.java",
            "javatests/src/org/chromium/chrome/browser/vr/rules/WebappActivityVrCardboardTestRule.java",
            "javatests/src/org/chromium/chrome/browser/vr/util/VrCardboardTestRuleUtils.java",
          ]
        }
      }
    }

    if (enable_arcore) {
      # All files necessary for AR instrumentation tests
      android_library("chrome_test_ar_java") {
        testonly = true

        sources = [
          "javatests/src/org/chromium/chrome/browser/vr/WebXrArAnchorsTest.java",
          "javatests/src/org/chromium/chrome/browser/vr/WebXrArCameraAccessTest.java",
          "javatests/src/org/chromium/chrome/browser/vr/WebXrArDepthSensingTest.java",
          "javatests/src/org/chromium/chrome/browser/vr/WebXrArHitTestTest.java",
          "javatests/src/org/chromium/chrome/browser/vr/WebXrArLightEstimationTest.java",
          "javatests/src/org/chromium/chrome/browser/vr/WebXrArSanityTest.java",
          "javatests/src/org/chromium/chrome/browser/vr/WebXrArSessionTest.java",
          "javatests/src/org/chromium/chrome/browser/vr/WebXrArTestFramework.java",
          "javatests/src/org/chromium/chrome/browser/vr/WebXrArViewportScaleTest.java",
          "javatests/src/org/chromium/chrome/browser/vr/rules/ArPlaybackFile.java",
          "javatests/src/org/chromium/chrome/browser/vr/rules/ArTestRule.java",
          "javatests/src/org/chromium/chrome/browser/vr/rules/ChromeTabbedActivityArTestRule.java",
          "javatests/src/org/chromium/chrome/browser/vr/rules/CustomTabActivityArTestRule.java",
          "javatests/src/org/chromium/chrome/browser/vr/rules/WebappActivityArTestRule.java",
          "javatests/src/org/chromium/chrome/browser/vr/util/ArTestRuleUtils.java",
        ]

        deps = chrome_test_xr_java_deps +
               [ "//chrome/android:chrome_test_xr_java" ]

        data = [
          "//chrome/test/data/xr/ar_playback_datasets/",
          "//third_party/arcore-android-sdk/test-apks/",
        ]
      }
    }
  }

  # Overrides icon / name defined in chrome_base_module_resources.
  android_resources("chrome_public_apk_base_module_resources") {
    resource_overlay = true
    sources = [
      "java/res_chromium_base/drawable/themed_app_icon.xml",
      "java/res_chromium_base/mipmap-hdpi/app_icon.png",
      "java/res_chromium_base/mipmap-hdpi/layered_app_icon.png",
      "java/res_chromium_base/mipmap-hdpi/layered_app_icon_background.png",
      "java/res_chromium_base/mipmap-mdpi/app_icon.png",
      "java/res_chromium_base/mipmap-mdpi/layered_app_icon.png",
      "java/res_chromium_base/mipmap-mdpi/layered_app_icon_background.png",
      "java/res_chromium_base/mipmap-nodpi/layered_app_icon_foreground.xml",
      "java/res_chromium_base/mipmap-xhdpi/app_icon.png",
      "java/res_chromium_base/mipmap-xhdpi/layered_app_icon.png",
      "java/res_chromium_base/mipmap-xhdpi/layered_app_icon_background.png",
      "java/res_chromium_base/mipmap-xxhdpi/app_icon.png",
      "java/res_chromium_base/mipmap-xxhdpi/layered_app_icon.png",
      "java/res_chromium_base/mipmap-xxhdpi/layered_app_icon_background.png",
      "java/res_chromium_base/mipmap-xxxhdpi/app_icon.png",
      "java/res_chromium_base/mipmap-xxxhdpi/layered_app_icon.png",
      "java/res_chromium_base/mipmap-xxxhdpi/layered_app_icon_background.png",
      "java/res_chromium_base/values/channel_constants.xml",
    ]

    # Dep needed to ensure override works properly.
    deps = [ ":chrome_base_module_resources" ]
  }

  version_resource_dir = "$target_gen_dir/templates/chrome_version_xml/res"
  version_resource_file = "$version_resource_dir/values/strings.xml"
  process_version("version_xml") {
    process_only = true
    template_file = "java/version_strings.xml.template"
    sources = [ "//chrome/VERSION" ]
    output = version_resource_file
  }

  android_resources("product_version_resources") {
    sources = [ version_resource_file ]
    deps = [ ":version_xml" ]
  }

  java_group("chrome_public_non_pak_assets") {
    deps = [
      "//chrome/android/webapk/libs/runtime_library:runtime_library_assets",
    ]
  }

  jinja_template_resources("chrome_public_apk_template_resources") {
    resources = [
      "java/res_template/xml/file_paths.xml",
      "java/res_template/xml/launchershortcuts.xml",
      "java/res_template/xml/searchable.xml",
    ]
    res_dir = "java/res_template"
    variables = [ "manifest_package=$chrome_public_manifest_package" ]
  }

  jinja_template_resources("chrome_test_apk_template_resources") {
    resource_overlay = true
    resources = [
      "java/res_template/xml/file_paths.xml",
      "java/res_template/xml/launchershortcuts.xml",
      "java/res_template/xml/searchable.xml",
    ]
    res_dir = "java/res_template"

    # Add dep to ensure these override the ones in
    # chrome_public_apk_template_resources.
    deps = [ ":chrome_public_apk_template_resources" ]
    variables = [ "manifest_package=$chrome_public_test_manifest_package" ]
  }

  # This template instantiates targets responsible for generating pak
  # resources. The generated target names are derived from input variables.
  #
  # Variables:
  #    is_monochrome: If true, generate Monochrome targets rather than Chrome.
  #    is_trichrome: (Optional) Generate Trichrome targets that use monochrome
  #      library targets but don't include webview resources.
  #    is_bundle_module: (Optional) If true, generate targets for base bundle
  #      module.
  template("resource_packaging") {
    _is_monochrome = invoker.is_monochrome
    _is_trichrome = defined(invoker.is_trichrome) && invoker.is_trichrome
    _is_bundle_module =
        defined(invoker.is_bundle_module) && invoker.is_bundle_module

    if (_is_trichrome) {
      _variant = "trichrome_chrome"
    } else if (_is_monochrome) {
      _variant = "monochrome"
    } else {
      _variant = "chrome"
    }
    if (_is_bundle_module) {
      _variant += "_bundle_module"
    } else {
      _variant += "_apk"
    }

    if (enable_resource_allowlist_generation) {
      if (_is_trichrome || _is_monochrome) {
        _lib = "libmonochrome_inputs"
      } else {
        _lib = "libchrome_inputs"
      }
      _resource_allowlist_target = "${_variant}_resource_allowlist"
      _resource_allowlist_file =
          "$target_gen_dir/${_variant}_resource_allowlist.txt"
      _lib_path = "/lib.unstripped/" + _lib + shlib_extension

      generate_resource_allowlist(_resource_allowlist_target) {
        _fat_lib_toolchain = current_toolchain
        if (_is_monochrome || _is_trichrome) {
          # TODO(agrieve): For 64-bit primary, using libmonochrome_64 would be
          #     more efficient.
          _fat_lib_toolchain = _monochrome_browser_toolchain
        }
        deps = [ ":${_lib}($_fat_lib_toolchain)" ]

        inputs = [ get_label_info(deps[0], "root_out_dir") + _lib_path ]
        output = _resource_allowlist_file
      }

      # Use custom resource ID list instead of android_webview's compiler
      # resource allowlist because //android_webview:generate_webui_resources
      # and //android_webview:generate_components_resources use hand-written
      # resource allowlists.
      if (_is_monochrome) {
        _locale_allowlist_target = "${_variant}_locale_allowlist"
        _locale_allowlist_file =
            "$target_gen_dir/${_variant}_locale_allowlist.txt"
        _system_webview_locale_allowlist_target =
            "${_variant}_system_webview_locale_resource_allowlist"
        _system_webview_locale_allowlist_file =
            "$target_gen_dir/" +
            "${_variant}_system_webview_locale_resource_id_list.txt"

        action(_system_webview_locale_allowlist_target) {
          script = "//tools/grit/pak_util.py"

          _system_webview_en_US_locale_pak =
              "$root_out_dir/android_webview/locales/en-US.pak"

          inputs = [ _system_webview_en_US_locale_pak ]

          outputs = [ _system_webview_locale_allowlist_file ]

          deps = [ "//android_webview:repack_locales" ]

          args = [
            "list-id",
            "--output",
            rebase_path(_system_webview_locale_allowlist_file, root_build_dir),
            rebase_path(_system_webview_en_US_locale_pak, root_build_dir),
          ]
        }

        action(_locale_allowlist_target) {
          script = "//tools/resources/filter_resource_allowlist.py"

          inputs = [
            _resource_allowlist_file,
            _system_webview_locale_allowlist_file,
          ]

          outputs = [ _locale_allowlist_file ]

          deps = [
            ":$_resource_allowlist_target",
            ":$_system_webview_locale_allowlist_target",
            "//android_webview:system_webview_pak_allowlist",
          ]

          args = [
            "--input",
            rebase_path(_resource_allowlist_file, root_build_dir),
            "--filter",
            rebase_path(_system_webview_locale_allowlist_file, root_build_dir),
            "--output",
            rebase_path(_locale_allowlist_file, root_build_dir),
          ]
        }
      }
    }

    chrome_paks("${_variant}_paks") {
      output_dir = "$target_gen_dir/${_variant}_paks"
      deps = []

      additional_extra_paks = []
      if (!dfmify_dev_ui || !_is_bundle_module) {
        additional_extra_paks += [ "$root_gen_dir/chrome/dev_ui_resources.pak" ]
        deps += [ "//chrome/browser/resources:dev_ui_paks" ]
      }

      if (enable_resource_allowlist_generation) {
        repack_allowlist = _resource_allowlist_file
        deps += [ ":${_resource_allowlist_target}" ]
        if (_is_monochrome) {
          locale_allowlist = _locale_allowlist_file
          deps += [ ":$_locale_allowlist_target" ]
        }
      }
    }

    android_assets("${_variant}_locale_pak_assets") {
      disable_compression = true
      renaming_sources = []
      renaming_destinations = []

      foreach(_locale, platform_pak_locales) {
        renaming_sources +=
            [ "$target_gen_dir/${_variant}_paks/locales/$_locale.pak" ]
        renaming_destinations += [ "locales/$_locale.pak" ]
      }
      treat_as_locale_paks = true

      deps = [ ":${_variant}_paks" ]
    }

    # This target explicitly includes locale paks via deps.
    android_assets(target_name) {
      assert("${_variant}_pak_assets" == target_name)
      sources = [
        "$target_gen_dir/${_variant}_paks/chrome_100_percent.pak",
        "$target_gen_dir/${_variant}_paks/resources.pak",
      ]
      disable_compression = true

      deps = [
        ":${_variant}_locale_pak_assets",
        ":${_variant}_paks",
      ]
      if (_is_monochrome) {
        deps += [ "//android_webview:locale_pak_assets" ]
      }
    }
  }

  # Resource packaging varies with Monochrome and bundles because the pak
  # resource allowlist is derived from the native library.
  resource_packaging("chrome_apk_pak_assets") {
    is_monochrome = false
  }
  resource_packaging("chrome_bundle_module_pak_assets") {
    is_monochrome = false
    is_bundle_module = true
  }
  resource_packaging("monochrome_apk_pak_assets") {
    is_monochrome = true
  }
  resource_packaging("monochrome_bundle_module_pak_assets") {
    is_monochrome = true
    is_bundle_module = true
  }
  resource_packaging("trichrome_chrome_bundle_module_pak_assets") {
    is_monochrome = false
    is_trichrome = true
    is_bundle_module = true
  }

  # Exists separately from chrome_public_base_module_java_for_test to allow
  # downstream to depend on test support packages without needing to depend on
  # delegate_public_impl_java.
  java_group("chrome_public_base_module_java_test_support") {
    testonly = true
    deps = [
      ":browser_java_test_support",
      ":chrome_test_util_java",
      "//chrome/browser/android/metrics:ukm_java_test_support",
      "//chrome/browser/password_manager/android:test_support_java",
      "//chrome/browser/subresource_filter:subresource_filter_java_test_support",
      "//chrome/browser/supervised_user:test_support_java",
      "//chrome/browser/thumbnail:thumbnail_java_test_support",
      "//components/external_intents/android:test_support_java",
      "//components/minidump_uploader:minidump_uploader_java",
      "//components/paint_preview/player/android:player_java_test_support",
      "//components/variations/android:test_support_java",
      "//content/public/test/android:content_java_test_support",
      "//ui/android:clipboard_java_test_support",
    ]
  }

  java_group("chrome_public_base_module_java_for_test") {
    testonly = true
    deps = [
      ":chrome_all_java",
      ":chrome_public_base_module_java_test_support",
      ":delegate_public_impl_java",
    ]
  }

  generate_jni("test_support_jni_headers") {
    testonly = true
    sources = [
      "javatests/src/org/chromium/chrome/browser/ServicificationBackgroundService.java",
      "javatests/src/org/chromium/chrome/browser/gesturenav/ScreenshotCaptureTestHelper.java",
      "javatests/src/org/chromium/chrome/browser/offlinepages/OfflineTestUtil.java",
      "javatests/src/org/chromium/chrome/browser/sync/FakeServerHelper.java",
      "javatests/src/org/chromium/chrome/browser/test/MockCertVerifierRuleAndroid.java",
    ]
  }

  # Test support code that needs access to the browser.
  android_library("browser_java_test_support") {
    testonly = true
    srcjar_deps = [ ":test_support_jni_headers" ]
    sources = [
      "javatests/src/org/chromium/chrome/browser/ServicificationBackgroundService.java",
      "javatests/src/org/chromium/chrome/browser/gesturenav/ScreenshotCaptureTestHelper.java",
      "javatests/src/org/chromium/chrome/browser/offlinepages/OfflineTestUtil.java",
      "javatests/src/org/chromium/chrome/browser/sync/FakeServerHelper.java",
      "javatests/src/org/chromium/chrome/browser/test/MockCertVerifierRuleAndroid.java",
    ]
    deps = [
      ":chrome_java",
      "$google_play_services_package:google_play_services_gcm_java",
      "//base:base_java",
      "//base:base_java_test_support",
      "//build/android:build_java",
      "//chrome/browser/download/android:java",
      "//chrome/browser/prefetch/android:java",
      "//chrome/browser/profiles/android:java",
      "//chrome/browser/sync/android:java",
      "//chrome/browser/tab:java",
      "//components/offline_items_collection/core:core_java",
      "//components/sync/protocol:protocol_java",
      "//content/public/android:content_java",
      "//content/public/test/android:content_java_test_support",
      "//third_party/android_deps:protobuf_lite_runtime_java",
      "//third_party/androidx:androidx_annotation_annotation_java",
      "//third_party/jni_zero:jni_zero_java",
      "//third_party/junit",
      "//url:android_test_helper_java",
      "//url:gurl_java",
    ]
  }

  static_library("browser_test_support") {
    testonly = true
    sources = [
      "../browser/android/servicification_background_service_jni.cc",
      "../browser/android/ssl/mock_cert_verifier_rule_android.cc",
      "../browser/android/ssl/mock_cert_verifier_rule_android.h",
      "../browser/gesturenav/android/screenshot_capture_test_helper.cc",
      "../browser/offline_pages/android/offline_test_util_jni.cc",
      "../browser/sync/android/fake_server_helper_android.cc",
    ]
    deps = [
      ":test_support_jni_headers",
      "//chrome/browser",
      "//chrome/browser:browser_process",
      "//chrome/browser/sync",
      "//chrome/browser/thumbnail:test_support",
      "//components/offline_pages/core/background:test_support",
      "//components/sync:test_support",
      "//content/test:test_support",
      "//net:test_support",
      "//url",
      "//url:android_test_helper",
    ]
  }

  chrome_public_apk_or_module_tmpl("chrome_public_apk") {
    target_type = "android_apk"
    apk_name = "ChromePublic"
    art_profile_path = "//chrome/android/baseline_profiles/profile.txt"
    if (android_64bit_target_cpu) {
      # Ensure 64-bit chrome does not depend on 32-bit things.
      assert_no_deps =
          [ "//build/config:toolchain_marker_" +
            get_label_info(android_secondary_abi_toolchain, "name") ]
    }
  }

  chrome_public_bundle("chrome_public_bundle") {
    bundle_name = "ChromePublic"
  }

  android_library("monochrome_java") {
    deps = [
      ":base_module_java",
      ":base_monochrome_module_java",
      "//android_webview:android_webview_java",
      "//base:base_java",
      "//base/version_info/android:version_constants_java",
      "//chrome/android:chrome_java",
      "//content/public/android:content_java",
    ]
    sources = [
      "java/src/org/chromium/chrome/browser/MonochromeApplicationImpl.java",
    ]
  }

  # Monochrome equivalent of :base_module_java.
  android_library("base_monochrome_module_java") {
    sources = [ "java/src/org/chromium/chrome/browser/base/SplitMonochromeApplication.java" ]
    deps = [
      ":base_module_java",
      "//android_webview:android_webview_no_weblayer_java",
      "//base:base_java",
      "//base/version_info/android:version_constants_java",
      "//base/version_info/android:version_constants_java",
      "//build/android:build_java",
      "//content/public/android:content_java",
    ]
  }

  generate_jni("base_module_jni") {
    sources = [ "java/src/org/chromium/chrome/browser/metrics/UmaUtils.java" ]
  }

  # Target for classes which should be in the base module, even when //chrome code
  # is in a DFM.
  android_library("base_module_java") {
    sources = [
      "java/src/com/google/ipc/invalidation/ticl/android2/channel/GcmRegistrationTaskService.java",
      "java/src/org/chromium/chrome/app/TrichromeZygotePreload.java",
      "java/src/org/chromium/chrome/browser/ChromeBackgroundService.java",
      "java/src/org/chromium/chrome/browser/ChromeBackupAgent.java",
      "java/src/org/chromium/chrome/browser/DeferredStartupHandler.java",
      "java/src/org/chromium/chrome/browser/app/bluetooth/BluetoothNotificationService.java",
      "java/src/org/chromium/chrome/browser/app/usb/UsbNotificationService.java",
      "java/src/org/chromium/chrome/browser/base/ColdStartTracker.java",
      "java/src/org/chromium/chrome/browser/base/DexFixer.java",
      "java/src/org/chromium/chrome/browser/base/DexFixerReason.java",
      "java/src/org/chromium/chrome/browser/base/ServiceTracingProxyProvider.java",
      "java/src/org/chromium/chrome/browser/base/SplitChromeApplication.java",
      "java/src/org/chromium/chrome/browser/base/SplitCompatAppComponentFactory.java",
      "java/src/org/chromium/chrome/browser/base/SplitCompatApplication.java",
      "java/src/org/chromium/chrome/browser/base/SplitCompatBackupAgent.java",
      "java/src/org/chromium/chrome/browser/base/SplitCompatContentProvider.java",
      "java/src/org/chromium/chrome/browser/base/SplitCompatCustomTabsService.java",
      "java/src/org/chromium/chrome/browser/base/SplitCompatGcmListenerService.java",
      "java/src/org/chromium/chrome/browser/base/SplitCompatGcmTaskService.java",
      "java/src/org/chromium/chrome/browser/base/SplitCompatIntentService.java",
      "java/src/org/chromium/chrome/browser/base/SplitCompatJobService.java",
      "java/src/org/chromium/chrome/browser/base/SplitCompatMinidumpUploadJobService.java",
      "java/src/org/chromium/chrome/browser/base/SplitCompatRemoteViewsService.java",
      "java/src/org/chromium/chrome/browser/base/SplitCompatService.java",
      "java/src/org/chromium/chrome/browser/base/SplitPreloader.java",
      "java/src/org/chromium/chrome/browser/bookmarkswidget/BookmarkWidgetService.java",
      "java/src/org/chromium/chrome/browser/crash/ApplicationStatusTracker.java",
      "java/src/org/chromium/chrome/browser/crash/ChromeMinidumpUploadJobService.java",
      "java/src/org/chromium/chrome/browser/crash/MinidumpUploadService.java",
      "java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionService.java",
      "java/src/org/chromium/chrome/browser/download/DownloadBroadcastManager.java",
      "java/src/org/chromium/chrome/browser/download/DownloadForegroundService.java",
      "java/src/org/chromium/chrome/browser/incognito/IncognitoNotificationService.java",
      "java/src/org/chromium/chrome/browser/media/MediaCaptureNotificationService.java",
      "java/src/org/chromium/chrome/browser/media/ui/ChromeMediaNotificationControllerServices.java",
      "java/src/org/chromium/chrome/browser/metrics/SimpleStartupForegroundSessionDetector.java",
      "java/src/org/chromium/chrome/browser/metrics/UmaUtils.java",
      "java/src/org/chromium/chrome/browser/notifications/NotificationIntentInterceptorService.java",
      "java/src/org/chromium/chrome/browser/notifications/NotificationJobService.java",
      "java/src/org/chromium/chrome/browser/notifications/NotificationService.java",
      "java/src/org/chromium/chrome/browser/photo_picker/DecoderService.java",
      "java/src/org/chromium/chrome/browser/provider/ChromeBrowserProvider.java",
      "java/src/org/chromium/chrome/browser/services/gcm/ChromeGcmListenerService.java",
      "java/src/org/chromium/chrome/browser/services/gcm/GCMBackgroundService.java",
      "java/src/org/chromium/chrome/browser/services/gcm/InvalidationGcmUpstreamSender.java",
      "java/src/org/chromium/chrome/browser/tracing/TracingNotificationService.java",
    ]
    deps = [
      ":chrome_base_module_resources",
      "$google_play_services_package:google_firebase_firebase_iid_java",
      "$google_play_services_package:google_firebase_firebase_messaging_java",
      "$google_play_services_package:google_play_services_gcm_java",
      "//base:base_java",
      "//chrome/browser/download/android:file_provider_java",
      "//chrome/browser/flags:java",
      "//chrome/browser/language/android:base_module_java",
      "//chrome/browser/preferences:java",
      "//chrome/browser/ui/android/pdf:pdf_provider_java",
      "//chrome/browser/util:java",
      "//chrome/browser/version:java",
      "//components/crash/android:java",
      "//components/embedder_support/android:application_java",
      "//components/media_router/browser/android:cast_options_provider_java",
      "//components/minidump_uploader:minidump_uploader_java",
      "//components/module_installer/android:module_installer_java",
      "//third_party/android_deps:playcore_java",
      "//third_party/androidx:androidx_annotation_annotation_java",
      "//third_party/androidx:androidx_collection_collection_java",
      "//third_party/jni_zero:jni_zero_java",
      "//ui/android:ui_no_recycler_view_java",

      # Deps needed for child processes.
      "//base/version_info/android:version_constants_java",
      "//components/viz/service:service_java",
      "//content/public/android:content_main_dex_java",
      "//media/base/android:media_java",
      "//services/shape_detection:shape_detection_java",

      # Deps for DFMs.
      "//chrome/android/modules/stack_unwinder/provider:java",
      "//chrome/browser/test_dummy/internal:base_module_java",

      # Deps to pull services into base module.
      # TODO(crbug.com/40148088): Consider moving these to the chrome module to
      # reduce base dex size.
      "$google_play_services_package:google_play_services_cast_framework_java",
      "//components/background_task_scheduler:background_task_scheduler_java",
      "//components/payments/content/android:service_java",
      "//third_party/androidx:androidx_browser_browser_java",
    ]

    # More deps for DFMs.
    if (dfmify_dev_ui) {
      deps += [ "//chrome/android/modules/dev_ui/provider:java" ]
    }

    srcjar_deps = [
      ":base_module_jni",
      ":chrome_product_config",
    ]

    # If this throws an error, try depending on
    # //content/public/android:content_main_dex_java instead.
    assert_no_deps = [ "//content/public/android:content_full_java" ]

    # Add the actual implementation where necessary so that downstream targets
    # can provide their own implementations.
    jar_excluded_patterns = [ "*/ProductConfig.class" ]

    resources_package = "org.chromium.chrome.base"
  }

  if (android_64bit_target_cpu && skip_secondary_abi_for_cq) {
    group("trichrome_library_apk") {
      deps = [ ":trichrome_library_64_apk" ]
    }
    group("monochrome_public_apk") {
      deps = [ ":monochrome_64_public_apk" ]
    }
  } else {
    if (android_64bit_target_cpu) {
      alias_with_wrapper_script("trichrome_library_apk") {
        alias_target = ":trichrome_library_64_32_apk"
      }
      alias_with_wrapper_script("monochrome_public_apk") {
        alias_target = ":monochrome_64_32_public_apk"
      }
    }
    chrome_public_apk_or_module_tmpl(_main_monochrome_public_apk_target) {
      is_monochrome = true
      apk_name = "MonochromePublic"
      target_type = "android_apk"
      if (android_64bit_target_cpu) {
        is_64_bit_browser = true
        include_32_bit_webview = true
      }
    }

    trichrome_library_apk_tmpl(_main_trichrome_library_apk_target) {
      apk_name = "TrichromeLibrary"

      if (android_64bit_target_cpu) {
        is_64_bit_browser = false
        include_64_bit_webview = true
      }

      if (enable_manifest_verification) {
        expected_android_manifest = "expectations/$_main_trichrome_library_apk_target.AndroidManifest.expected"
      }
      if (enable_libs_and_assets_verification) {
        expected_libs_and_assets = "expectations/$_main_trichrome_library_apk_target.$target_cpu.libs_and_assets.expected"
      }
    }

    # Can be used to install compressed apks on system images.
    system_image_stub_apk("trichrome_library_system_stub_apk") {
      package_name = trichrome_library_package
      version_code = trichrome_version_code
      version_name = chrome_version_name
      stub_output = "$root_out_dir/apks/TrichromeLibrary-Stub.apk"
      static_library_name = trichrome_library_package
      static_library_version = trichrome_version_code
    }
  }

  if (android_64bit_target_cpu) {
    chrome_public_apk_or_module_tmpl("monochrome_64_public_apk") {
      is_monochrome = true
      apk_name = "MonochromePublic64"
      target_type = "android_apk"
      is_64_bit_browser = true
      include_32_bit_webview = false
    }

    trichrome_library_apk_tmpl("trichrome_library_64_apk") {
      apk_name = "TrichromeLibrary64"
      is_64_bit_browser = true
      include_32_bit_webview = false
      if (enable_manifest_verification) {
        expected_android_manifest =
            "expectations/$target_name.AndroidManifest.expected"
      }
      if (enable_libs_and_assets_verification) {
        expected_libs_and_assets =
            "expectations/$target_name.$target_cpu.libs_and_assets.expected"
      }
    }

    if (!skip_secondary_abi_for_cq) {
      trichrome_library_apk_tmpl("trichrome_library_32_apk") {
        apk_name = "TrichromeLibrary32"
        is_64_bit_browser = false
        include_64_bit_webview = false
        if (enable_libs_and_assets_verification) {
          expected_libs_and_assets =
              "expectations/$target_name.$target_cpu.libs_and_assets.expected"
        }
        if (enable_manifest_verification) {
          expected_android_manifest =
              "expectations/$target_name.AndroidManifest.expected"
        }
      }

      trichrome_library_apk_tmpl("trichrome_library_64_32_apk") {
        apk_name = "TrichromeLibrary6432"
        is_64_bit_browser = true
        include_32_bit_webview = true
        if (enable_manifest_verification) {
          expected_android_manifest =
              "expectations/$target_name.AndroidManifest.expected"
        }
        if (enable_libs_and_assets_verification) {
          expected_libs_and_assets =
              "expectations/$target_name.$target_cpu.libs_and_assets.expected"
        }
      }
    }
  }

  # As compared to chrome_public_test_apk, this target contains only unit tests
  # that require on device capabilities. These tests are smaller, more tightly
  # scoped, and do not leave lingering state after execution.
  # TODO(crbug.com/40193330): Set clear rules for what tests can be added here.
  chrome_public_test_apk_tmpl("chrome_public_unit_test_apk") {
    apk_name = "ChromePublicUnitTest"
    deps = [
      ":chrome_unit_test_java",
      "//build/config/android/test/resource_overlay:unit_device_javatests",
      "//chrome/android/features/tab_ui:unit_device_javatests",
      "//chrome/browser/android/customtabs/branding:unit_device_javatests",
      "//chrome/browser/android/intents:unit_device_javatests",
      "//chrome/browser/back_press/android:unit_device_javatests",
      "//chrome/browser/download/internal/android:unit_device_javatests",
      "//chrome/browser/history:unit_device_javatests",
      "//chrome/browser/hub:unit_device_javatests",
      "//chrome/browser/hub/internal:unit_device_javatests",
      "//chrome/browser/image_descriptions:unit_device_javatests",
      "//chrome/browser/loading_modal/android:unit_device_javatests",
      "//chrome/browser/optimization_guide/android:unit_device_javatests",
      "//chrome/browser/partnercustomizations:unit_device_javatests",
      "//chrome/browser/password_edit_dialog/android:unit_device_javatests",
      "//chrome/browser/recent_tabs/internal:unit_device_javatests",
      "//chrome/browser/search_engines/android:unit_device_javatests",
      "//chrome/browser/signin/services/android:unit_device_javatests",
      "//chrome/browser/thumbnail/generator:unit_device_javatests",
      "//chrome/browser/ui/android/appmenu/internal:unit_device_javatests",
      "//chrome/browser/ui/android/hats:unit_device_javatests",
      "//chrome/browser/ui/android/night_mode:unit_device_javatests",
      "//chrome/browser/ui/android/omnibox:unit_device_javatests",
      "//chrome/browser/ui/android/signin:unit_device_javatests",
      "//chrome/browser/ui/messages/android:unit_device_javatests",
      "//components/browser_ui/accessibility/android:unit_device_javatests",
      "//components/browser_ui/bottomsheet/android/internal:unit_device_javatests",
      "//components/browser_ui/contacts_picker/android:unit_device_javatests",
      "//components/browser_ui/modaldialog/android:unit_device_javatests",
      "//components/browser_ui/photo_picker/android:unit_device_javatests",
      "//components/browser_ui/settings/android:unit_device_javatests",
      "//components/browser_ui/util/android:unit_device_javatests",
      "//components/browser_ui/widget/android:unit_device_javatests",
      "//components/embedder_support/android:embedder_support_javatests",
      "//components/external_intents/android:unit_device_javatests",
      "//components/infobars/android:unit_device_javatests",
      "//components/installedapp/android:unit_device_javatests",
      "//components/messages/android:unit_device_javatests",
      "//components/messages/android/internal:unit_device_javatests",
      "//components/payments/content/android:unit_device_javatests",
      "//components/signin/public/android:unit_device_javatests",
      "//components/strictmode/android:unit_device_javatests",
      "//components/translate/content/android:unit_device_javatests",
      "//components/url_formatter/android:unit_device_javatests",
      "//components/variations/android:unit_device_javatests",
      "//components/webapps/browser/android:unit_device_javatests",
      "//ui/android:ui_unit_device_javatests",
    ]

    data_deps = [
      "//testing/buildbot/filters:chrome_public_unit_test_apk_filters",
      "//ui/base:goldctl",
    ]

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

    # Required by //build/config/android/test/resource_overlay:javatests
    enforce_resource_overlays_in_tests = true

    # Causes tests that try to start the browser process to fail
    is_unit_test = true
  }

  # TODO(crbug.com/40193330): Rename to chrome_public_integration_test_apk
  chrome_public_test_apk_tmpl("chrome_public_test_apk") {
    # TODO(wnwen): Re-enable when new lint failures are disabled for test targets.
    #enable_lint = true

    apk_name = "ChromePublicTest"
    deps = [
      ":chrome_test_apk_template_resources",
      ":chrome_test_java",
      "//chrome/android/features/keyboard_accessory:test_java",
      "//chrome/browser/autofill/android:test_java",
      "//chrome/browser/autofill/test:test_java",
      "//chrome/browser/banners/android:javatests",
      "//chrome/browser/download/internal/android:javatests",
      "//chrome/browser/engagement/android:javatests",
      "//chrome/browser/facilitated_payments/ui/android/internal:javatests",
      "//chrome/browser/flags:javatests",
      "//chrome/browser/gesturenav/android:javatests",
      "//chrome/browser/password_check/android:test_java",
      "//chrome/browser/password_manager/android:javatests",
      "//chrome/browser/password_manager/android/access_loss:javatests",
      "//chrome/browser/password_manager/android/bottom_sheet:javatests",
      "//chrome/browser/recent_tabs/internal:recent_tabs_javatests",
      "//chrome/browser/subresource_filter:subresource_filter_javatests",
      "//chrome/browser/touch_to_fill/autofill/android/internal:javatests",
      "//chrome/browser/touch_to_fill/password_manager/android:test_java",
      "//chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android:javatests",
      "//chrome/browser/touch_to_fill/password_manager/password_generation/android/internal:javatests",
      "//chrome/browser/ui/android/digital_credentials:javatests",
      "//chrome/browser/ui/android/fast_checkout/internal:javatests",
      "//chrome/browser/ui/android/plus_addresses:javatests",
      "//chrome/browser/ui/android/webid/internal:javatests",
      "//components/ip_protection/android/android_auth_client_lib/javatests:ip_protection_auth_javatests",
    ]

    data_deps = [ "//testing/buildbot/filters:chrome_public_test_apk_filters" ]

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

    additional_apks = [
      "//chrome/android/webapk/shell_apk:javatests_webapk",
      "//chrome/test/android/chrome_public_test_support:chrome_public_test_support_apk",
      "//components/ip_protection/android/android_auth_client_lib/testing/mock_service:ip_protection_auth_test_service_apk",
      "//components/media_router/test/android/media_router_test_support:media_router_test_support_apk",
    ]

    # TrustedWebActivityClientTest relies on sending a browsable Intent to an
    # ActivityWithDeepLink. On Android S+, for an app to receive a browsable
    # Intent it must have Digital Asset Link verification set up. This command
    # will associate the given package with the given website.
    extra_args = [
      "--approve-app-links",
      "org.chromium.chrome.tests.support:www.example.com",
    ]
  }

  if (enable_vr) {
    # //chrome/android/javatests/src/org/chromium/chrome/browser/vr/README.md
    chrome_public_test_apk_tmpl("chrome_public_test_vr_apk") {
      apk_name = "ChromePublicTestVr"
      manifest_package = chrome_public_manifest_package

      deps = [
        ":chrome_test_vr_java",
        ":vr_test_module_desc_java",
        "//third_party/android_sdk:android_test_mock_java",
      ]
    }

    # This is necessary since vr tests simulate a bundle build.
    module_desc_java("vr_test_module_desc_java") {
      module_name = "vr"
      load_native_on_get_impl = false
    }
  }

  if (enable_arcore) {
    # In order to run this test, first run:
    #   DOWNLOAD_XR_TEST_APKS=1 third_party/arcore-android-sdk/test-apks/update.py
    # See also: //chrome/android/javatests/src/org/chromium/chrome/browser/vr/README.md
    chrome_public_test_apk_tmpl("monochrome_public_test_ar_apk") {
      apk_name = "MonochromePublicTestAr"
      deps = [ ":chrome_test_ar_java" ]

      if (target_cpu == "arm64") {
        arcore_current_path = "//third_party/arcore-android-sdk/test-apks/arcore/arcore_current_arm64.apk"
      } else {
        arcore_current_path = "//third_party/arcore-android-sdk/test-apks/arcore/arcore_current_arm32.apk"
      }

      extra_args = [
        "--additional-apk",
        rebase_path(arcore_current_path, root_build_dir),
        "--remove-system-package=com.google.ar.core",
      ]
    }
  }

  # Chrome smoke test is a minimal test to ensure Chrome is not DOA.  It is
  # designed to be runnable against uninstrumented Chrome apks.
  android_test_apk("chrome_smoke_test_apk") {
    apk_name = "ChromeSmokeTest"
    android_manifest =
        "javatests/src/org/chromium/chrome/test/smoke/AndroidManifest.xml"
    target_sdk_version = android_sdk_version
    testonly = true
    sources = [
      "javatests/src/org/chromium/chrome/test/smoke/ChromeTabSwitcherTest.java",
      "javatests/src/org/chromium/chrome/test/smoke/utilities/FirstRunNavigator.java",
    ]
    data = [ "javatests/src/org/chromium/chrome/test/smoke/test.html" ]
    deps = [
      "//base:base_java",
      "//base:base_java_test_support",
      "//chrome/browser/hub/internal:java",
      "//chrome/browser/hub/internal:java_resources",
      "//chrome/test/android:chrome_java_test_pagecontroller",
      "//content/public/test/android:content_java_test_support",
      "//net/android:net_java_test_support",
      "//third_party/androidx:androidx_test_core_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_library_java",
      "//third_party/junit",
    ]
  }

  _common_smoke_test_args = [
    "--enable-breakpad-dump",
    "--use-apk-under-test-flags-file",

    # FRE is too flakey on some old devices https://crbug.com/1289733
    "--disable-fre",
  ]

  instrumentation_test_runner("chrome_public_smoke_test") {
    apk_under_test = ":chrome_public_apk"
    android_test_apk = ":chrome_smoke_test_apk"
    additional_apks = [ "//net/android:net_test_support_apk" ]
    if (!is_java_debug) {
      proguard_mapping_path = "$root_build_dir/apks/ChromePublic.apk.mapping"
    }

    extra_args = _common_smoke_test_args
  }

  # Public webview targets don't work with non-public sdks.
  # https://crbug.com/1000763
  instrumentation_test_runner("monochrome_public_smoke_test") {
    if (android_64bit_target_cpu && skip_secondary_abi_for_cq) {
      apk_under_test = ":monochrome_64_public_apk"
      if (!is_java_debug) {
        proguard_mapping_path =
            "$root_build_dir/apks/MonochromePublic64.apk.mapping"
      }
    } else {
      apk_under_test = ":$_main_monochrome_public_apk_target"
      if (!is_java_debug) {
        proguard_mapping_path =
            "$root_build_dir/apks/MonochromePublic.apk.mapping"
      }
    }
    android_test_apk = ":chrome_smoke_test_apk"
    additional_apks = [ "//net/android:net_test_support_apk" ]
    never_incremental = true
    extra_args = _common_smoke_test_args
  }

  android_test_apk("chrome_bundle_smoke_test_apk") {
    apk_name = "ChromeBundleSmokeTest"
    android_manifest = "javatests/src/org/chromium/chrome/test/smoke/AndroidManifest_bundle.xml"
    target_sdk_version = android_sdk_version
    testonly = true
    sources = [
      "javatests/src/org/chromium/chrome/test/smoke/ChromeBundleSmokeTest.java",
    ]

    # Used as test_apk for bundle smoke tests, which are also never_incremental.
    # The test_runner_script target does not support incremental test_apk when
    # the parent target is never_incremental.
    never_incremental = true
    deps = [
      "//base:base_java_test_support",
      "//chrome/test/android:chrome_java_test_pagecontroller",
      "//content/public/test/android:content_java_test_support",
      "//third_party/androidx:androidx_test_core_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/junit",
    ]
  }

  _bundle_smoke_test_extra_args = [
    # Make extra args be passed through to the bundle under test (see below).
    "--use-apk-under-test-flags-file",

    # Enable breakpad dumps in order to detect Chrome crashes (because the
    # test intentionally does not set <instrumentation android:targetPackage> to
    # the bundle under test.)
    "--enable-breakpad-dump",

    # Chrome crashes at startup if strict mode is turned on.
    "--strict-mode=off",

    # These args are passed through to the bundle under test.
    "--enable-test-dummy-module",
    "--disable-fre",
  ]

  instrumentation_test_runner("monochrome_public_bundle_smoke_test") {
    if (android_64bit_target_cpu) {
      if (skip_secondary_abi_for_cq) {
        apk_under_test = "//chrome/android:monochrome_64_public_bundle_apks"
        if (!is_java_debug) {
          proguard_mapping_path =
              "$root_build_dir/apks/MonochromePublic64.aab.mapping"
        }
      } else {
        apk_under_test = "//chrome/android:monochrome_64_32_public_bundle_apks"
        if (!is_java_debug) {
          proguard_mapping_path =
              "$root_build_dir/apks/MonochromePublic6432.aab.mapping"
        }
      }
    } else {
      apk_under_test = "//chrome/android:monochrome_public_bundle_apks"
      if (!is_java_debug) {
        proguard_mapping_path =
            "$root_build_dir/apks/MonochromePublic.aab.mapping"
      }
    }
    android_test_apk = ":chrome_bundle_smoke_test_apk"
    never_incremental = true
    modules = [ "test_dummy" ]
    extra_args = _bundle_smoke_test_extra_args
  }

  _verify_32bit_static_initializers =
      defined(expected_static_initializer_32bit_count) &&
      !skip_secondary_abi_for_cq
  _verify_64bit_static_initializers =
      defined(expected_static_initializer_64bit_count) &&
      android_64bit_target_cpu
  if (_verify_32bit_static_initializers || _verify_64bit_static_initializers) {
    # Old name alias to be removed after migration is done.
    group("monochrome_static_initializers") {
      deps = [ ":check_chrome_static_initializers" ]
    }
    group("check_chrome_static_initializers") {
      deps = []
      if (_verify_32bit_static_initializers) {
        deps += [ ":check_chrome_32_static_initializers" ]
      }
      if (_verify_64bit_static_initializers) {
        deps += [ ":check_chrome_64_static_initializers" ]
      }
    }
    if (_verify_32bit_static_initializers) {
      action_with_pydeps("check_chrome_32_static_initializers") {
        script = "//build/android/gyp/assert_static_initializers.py"
        if (android_64bit_target_cpu) {
          _lib_abi_toolchain = "($android_secondary_abi_toolchain)"
        } else {
          _lib_abi_toolchain = ""
        }
        _lib_out_dir =
            get_label_info(":libmonochrome$_lib_abi_toolchain", "root_out_dir")
        deps = [ ":libmonochrome$_lib_abi_toolchain" ]
        inputs = [ "$_lib_out_dir/lib.unstripped/libmonochrome.so" ]
        outputs = [ "$target_gen_dir/$target_name.stamp" ]
        args = [
          "--expected-count=$expected_static_initializer_32bit_count",
          "--tool-prefix",
          rebase_path(android_tool_prefix, root_build_dir),
          "--touch",
          rebase_path(outputs[0], root_build_dir),
          rebase_path(inputs[0], root_build_dir),
        ]
      }
    }
    if (_verify_64bit_static_initializers) {
      action_with_pydeps("check_chrome_64_static_initializers") {
        script = "//build/android/gyp/assert_static_initializers.py"
        deps = [ ":libmonochrome_64" ]
        inputs = [ "$root_build_dir/lib.unstripped/libmonochrome_64.so" ]
        outputs = [ "$target_gen_dir/$target_name.stamp" ]
        args = [
          "--expected-count=$expected_static_initializer_64bit_count",
          "--tool-prefix",
          rebase_path(android_tool_prefix, root_build_dir),
          "--touch",
          rebase_path(outputs[0], root_build_dir),
          rebase_path(inputs[0], root_build_dir),
        ]
      }
    }
  }

  instrumentation_test_runner("trichrome_chrome_bundle_smoke_test") {
    android_test_apk = ":chrome_bundle_smoke_test_apk"
    never_incremental = true
    modules = [ "test_dummy" ]
    extra_args = _bundle_smoke_test_extra_args
    if (android_64bit_target_cpu) {
      if (skip_secondary_abi_for_cq) {
        apk_under_test = "//chrome/android:trichrome_chrome_64_bundle_apks"
        additional_apks = [ "//chrome/android:trichrome_library_64_apk" ]
        if (!is_java_debug) {
          proguard_mapping_path =
              "$root_build_dir/apks/TrichromeChrome64.aab.mapping"
        }
      } else {
        apk_under_test = "//chrome/android:trichrome_chrome_64_32_bundle_apks"
        additional_apks = [ "//chrome/android:trichrome_library_64_32_apk" ]
        if (!is_java_debug) {
          proguard_mapping_path =
              "$root_build_dir/apks/TrichromeChrome6432.aab.mapping"
        }
      }
    } else {
      apk_under_test = "//chrome/android:trichrome_chrome_bundle_apks"
      additional_apks =
          [ "//chrome/android:$_main_trichrome_library_apk_target" ]
      if (!is_java_debug) {
        proguard_mapping_path =
            "$root_build_dir/apks/TrichromeChrome.aab.mapping"
      }
    }
  }

  group("chrome_nocompile_tests") {
    # Tests which check that build errors are thrown when expected and that build
    # validation tools (ex: lint) do not get silently disabled.
    testonly = true

    # No-compile tests use an output directory dedicated to no-compile tests.
    # Put new test suites in //build/android/test/nocompile_gn if possible in
    # order to share the target output directory and avoid running 'gn gen'
    # for each android_nocompile_test_suite().
    deps = [
      "features/android_library_factory/test:android_lookup_dep_tests",
      "//build/android/test:android_nocompile_tests",
      "//tools/android/errorprone_plugin/test:errorprone_plugin_tests",
    ]
  }

  script_test("chrome_public_wpt") {
    script = "//third_party/blink/tools/run_wpt_tests.py"
    args = [
      "--product",
      "chrome_android",
      "--test-type",
      "testharness",
      "reftest",
      "crashtest",
      "print-reftest",
      "--zero-tests-executed-ok",
      "--browser-apk",
      "@WrappedPath(apks/ChromePublic.apk)",
    ]
    data = [
      "//third_party/blink/web_tests/platform/android/",
      "//third_party/blink/web_tests/MobileTestExpectations",
    ]
    data_deps = [
      ":chrome_public_apk",
      "//chrome/test/chromedriver:chromedriver_server($host_toolchain)",
      "//third_party/blink/tools:wpt_tests_android_isolate",
    ]
  }

  group("android_lint") {
    if (!disable_android_lint) {
      deps = [ ":${_android_lint_target_name}__lint" ]
      if (defined(additional_chrome_lint_targets)) {
        deps += additional_chrome_lint_targets
      }
    }
  }

  if (android_64bit_target_cpu && skip_secondary_abi_for_cq) {
    group("monochrome_public_bundle") {
      deps = [ ":monochrome_64_public_bundle" ]
    }
    group("trichrome_chrome_bundle") {
      deps = [ ":trichrome_chrome_64_bundle" ]
    }
  } else {
    if (android_64bit_target_cpu) {
      alias_with_wrapper_script("monochrome_public_bundle") {
        alias_target = ":monochrome_64_32_public_bundle"
      }
      alias_with_wrapper_script("trichrome_chrome_bundle") {
        alias_target = ":trichrome_chrome_64_32_bundle"
      }
    }

    # Public webview targets don't work with non-public sdks.
    # https://crbug.com/1000763
    chrome_public_bundle(_main_monochrome_public_bundle_target) {
      is_monochrome = true
      bundle_name = "MonochromePublic"
      add_view_trace_events = true

      if (android_64bit_target_cpu) {
        is_64_bit_browser = false
        include_64_bit_webview = true
      }
      if (enable_manifest_verification) {
        expected_android_manifest = "expectations/${_main_monochrome_public_bundle_target}__base.AndroidManifest.expected"
      }
      if (enable_libs_and_assets_verification) {
        expected_libs_and_assets = "expectations/${_main_monochrome_public_bundle_target}.$target_cpu.libs_and_assets.expected"
      }
    }

    chrome_public_bundle(_main_trichrome_chrome_bundle_target) {
      is_trichrome = true
      bundle_name = "TrichromeChrome"
      static_library_provider = ":$_main_trichrome_library_apk_target"
      add_view_trace_events = true
      art_profile_path = "//chrome/android/baseline_profiles/profile.txt"
      if (android_64bit_target_cpu) {
        is_64_bit_browser = false
        include_64_bit_webview = true
      }

      if (enable_manifest_verification) {
        # Monochrome6432 verifies all bundle modules, so only check base module here.
        expected_android_manifest = "expectations/${_main_trichrome_chrome_bundle_target}__base.AndroidManifest.expected"
      }
      if (enable_libs_and_assets_verification) {
        expected_libs_and_assets = "expectations/$_main_trichrome_chrome_bundle_target.$target_cpu.libs_and_assets.expected"
      }
    }

    # Creates .zip of .apk splits suitable for the Android system image.
    system_image_apks("trichrome_chrome_system_zip") {
      apk_or_bundle_target = ":$_main_trichrome_chrome_bundle_target"
      input_apk_or_bundle = "$root_out_dir/apks/TrichromeChrome.aab"
      output = "$root_out_dir/apks/TrichromeChromeSystem.zip"
      stub_output = "$root_out_dir/apks/TrichromeChrome-Stub.apk"
    }

    # Combines all splits into a single .apk for the Android system image.
    system_image_apks("trichrome_chrome_system_apk") {
      apk_or_bundle_target = ":$_main_trichrome_chrome_bundle_target"
      input_apk_or_bundle = "$root_out_dir/apks/TrichromeChrome.aab"
      output = "$root_out_dir/apks/TrichromeChromeSystem.apk"
      fuse_apk = true
    }

    # Used for binary size monitoring things:
    if (is_official_build && !skip_secondary_abi_for_cq) {
      _trichrome_library_basename = "TrichromeLibrary.apk"
      _trichrome_chrome_basename = "TrichromeChrome.minimal.apks"
      _trichrome_webview_basename = "TrichromeWebView.minimal.apks"
      _ssargs_filename = "Trichrome.ssargs"

      write_ssargs_trichrome("ssargs_trichrome") {
        ssargs_path = "$root_build_dir/apks/${_ssargs_filename}"
        abi_filter = android_app_abi
        trichrome_library_basename = _trichrome_library_basename
        trichrome_chrome_basename = _trichrome_chrome_basename
        trichrome_webview_basename = _trichrome_webview_basename
      }

      if (android_64bit_target_cpu) {
        # Measure _64 rather than _64_32 in order to save on compile time.
        # The secondary ABI can be measured via trichrome_32_minimal_apks.
        write_ssargs_trichrome("ssargs_trichrome_64") {
          ssargs_path = "$root_build_dir/apks/Trichrome64.ssargs"
          abi_filter = android_app_abi
          trichrome_library_basename = "TrichromeLibrary64.apk"
          trichrome_chrome_basename = "TrichromeChrome64.minimal.apks"
          trichrome_webview_basename = "TrichromeWebView64.minimal.apks"
        }
        create_app_bundle_minimal_apks("trichrome_chrome_64_minimal_apks") {
          deps = [ ":trichrome_chrome_64_bundle" ]
          bundle_path = "$root_build_dir/apks/TrichromeChrome64.aab"
        }
        group("trichrome_64_minimal_apks") {
          deps = [
            ":trichrome_chrome_64_minimal_apks",
            ":trichrome_library_64_apk",
            "//android_webview:trichrome_webview_64_minimal_apks",
          ]
        }

        _trichrome_library_32_basename = "TrichromeLibrary32.apk"
        _trichrome_chrome_32_basename = "TrichromeChrome32.minimal.apks"
        _trichrome_webview_32_basename = "TrichromeWebView32.minimal.apks"
        _ssargs_32_filename = "Trichrome32.ssargs"

        write_ssargs_trichrome("ssargs_trichrome_32") {
          ssargs_path = "$root_build_dir/apks/${_ssargs_32_filename}"
          abi_filter = android_app_secondary_abi
          symbols_dir = "android_clang_arm/lib.unstripped"
          trichrome_library_basename = _trichrome_library_32_basename
          trichrome_chrome_basename = _trichrome_chrome_32_basename
          trichrome_webview_basename = _trichrome_webview_32_basename
        }

        create_app_bundle_minimal_apks("trichrome_chrome_32_minimal_apks") {
          deps = [ ":trichrome_chrome_32_bundle" ]
          bundle_path = "$root_build_dir/apks/TrichromeChrome32.aab"
        }
        group("trichrome_32_minimal_apks") {
          deps = [
            ":trichrome_chrome_32_minimal_apks",
            ":trichrome_library_32_apk",
            "//android_webview:trichrome_webview_32_minimal_apks",
          ]
        }
        _trichrome_library_basename_for_size = _trichrome_library_32_basename
        _trichrome_chrome_basename_for_size = _trichrome_chrome_32_basename
        _trichrome_webview_basename_for_size = _trichrome_webview_32_basename
        _symbol_dir_for_size = "android_clang_arm/lib.unstripped"
        _ssargs_filename_for_size = _ssargs_32_filename
      } else {
        create_app_bundle_minimal_apks("trichrome_chrome_minimal_apks") {
          deps = [ ":$_main_trichrome_chrome_bundle_target" ]
          bundle_path = "$root_build_dir/apks/TrichromeChrome.aab"
        }
        group("trichrome_32_minimal_apks") {
          deps = [
            ":$_main_trichrome_library_apk_target",
            ":trichrome_chrome_minimal_apks",
            "//android_webview:trichrome_webview_minimal_apks",
          ]
        }
        _trichrome_library_basename_for_size = _trichrome_library_basename
        _trichrome_chrome_basename_for_size = _trichrome_chrome_basename
        _trichrome_webview_basename_for_size = _trichrome_webview_basename
        _symbol_dir_for_size = "lib.unstripped"
        _ssargs_filename_for_size = _ssargs_filename
      }

      android_resource_sizes_test("resource_sizes_trichrome") {
        apk_name = "Trichrome"
        trichrome_library_path =
            "$root_build_dir/apks/$_trichrome_library_basename_for_size"
        trichrome_chrome_path =
            "$root_build_dir/apks/$_trichrome_chrome_basename_for_size"
        trichrome_webview_path =
            "$root_build_dir/apks/$_trichrome_webview_basename_for_size"
        data_deps = [ ":trichrome_32_minimal_apks" ]
      }

      if (android_64bit_target_cpu && !skip_secondary_abi_for_cq) {
        android_size_bot_config("resource_size_config_trichrome") {
          name = "Trichrome"
          mapping_files = [
            "apks/TrichromeChrome32.aab.mapping",
            "apks/TrichromeWebView32.aab.mapping",
          ]

          # Save mapping files since they are needed by:
          # 1) Checking for ForTesting methods.
          # 2) SuperSize adding disassembly to symbols.
          # Save apk and unstripped library because they are needed for collecting
          # disassembly of large symbols.
          archive_files =
              mapping_files + [
                "apks/$_trichrome_library_basename_for_size",
                "apks/$_trichrome_chrome_basename_for_size",
                "apks/$_trichrome_webview_basename_for_size",
                "${_symbol_dir_for_size}/libmonochrome__combined.so",
              ]
          to_resource_sizes_py = {
            apk_name = "apks/resource_size_config_trichrome"
            trichrome_library = "apks/$_trichrome_library_basename_for_size"
            trichrome_chrome = "apks/$_trichrome_chrome_basename_for_size"
            trichrome_webview = "apks/$_trichrome_webview_basename_for_size"
          }
          to_resource_sizes_py_64 = {
            apk_name = "apks/TrichromeLibrary64.apk"
          }
          supersize_input_file = "apks/$_ssargs_filename_for_size"
        }
      }
    }
  }

  # Convenient target to build all Trichrome APK / bundles for testing.
  group("trichrome") {
    deps = [
      ":trichrome_chrome_bundle",
      ":trichrome_library_apk",
      "//android_webview:trichrome_webview_bundle",
    ]
  }

  if (android_64bit_target_cpu) {
    chrome_public_bundle("monochrome_64_public_bundle") {
      is_monochrome = true
      bundle_name = "MonochromePublic64"
      is_64_bit_browser = true
      include_32_bit_webview = false
      if (enable_manifest_verification) {
        # Monochrome6432 verifies all bundle modules, so only check base module here.
        expected_android_manifest = "expectations/monochrome_64_public_bundle__base.AndroidManifest.expected"
      }
    }

    chrome_public_bundle("trichrome_chrome_64_bundle") {
      is_trichrome = true
      bundle_name = "TrichromeChrome64"
      is_64_bit_browser = true
      include_32_bit_webview = false
      static_library_provider = ":trichrome_library_64_apk"
      if (enable_manifest_verification) {
        # Monochrome6432 verifies all bundle modules, so only check base module here.
        expected_android_manifest = "expectations/trichrome_chrome_64_bundle__base.AndroidManifest.expected"
      }
      if (enable_libs_and_assets_verification) {
        expected_libs_and_assets =
            "expectations/$target_name.$target_cpu.libs_and_assets.expected"
      }
    }

    if (!skip_secondary_abi_for_cq) {
      chrome_public_bundle("monochrome_32_public_bundle") {
        is_monochrome = true
        bundle_name = "MonochromePublic32"
        is_64_bit_browser = false
        include_64_bit_webview = false
        if (enable_manifest_verification) {
          # Monochrome6432 verifies all bundle modules, so only check base module here.
          expected_android_manifest = "expectations/monochrome_32_public_bundle__base.AndroidManifest.expected"
        }
      }

      chrome_public_bundle("monochrome_64_32_public_bundle") {
        is_monochrome = true
        bundle_name = "MonochromePublic6432"
        is_64_bit_browser = true
        include_32_bit_webview = true
        if (enable_manifest_verification) {
          expected_android_manifest_template = "expectations/monochrome_64_32_public_bundle__SPLIT_NAME.AndroidManifest.expected"
          expected_proguard_config = "expectations/monochrome_64_32_public_bundle.proguard_flags.expected"
        }
        if (enable_libs_and_assets_verification) {
          expected_libs_and_assets =
              "expectations/$target_name.$target_cpu.libs_and_assets.expected"
        }
      }

      chrome_public_bundle("trichrome_chrome_64_32_bundle") {
        is_trichrome = true
        bundle_name = "TrichromeChrome6432"
        is_64_bit_browser = true
        include_32_bit_webview = true
        static_library_provider = ":trichrome_library_64_32_apk"
        if (enable_manifest_verification) {
          # Monochrome6432 verifies all bundle modules, so only check base module here.
          expected_android_manifest = "expectations/trichrome_chrome_64_32_bundle__base.AndroidManifest.expected"
        }
        if (enable_libs_and_assets_verification) {
          expected_libs_and_assets =
              "expectations/$target_name.$target_cpu.libs_and_assets.expected"
        }
      }
      chrome_public_bundle("trichrome_chrome_32_bundle") {
        is_trichrome = true
        bundle_name = "TrichromeChrome32"
        is_64_bit_browser = false
        include_64_bit_webview = false
        static_library_provider = ":trichrome_library_32_apk"
        if (enable_manifest_verification) {
          # Monochrome6432 verifies all bundle modules, so only check base module here.
          expected_android_manifest = "expectations/trichrome_chrome_32_bundle__base.AndroidManifest.expected"
        }
        if (enable_libs_and_assets_verification) {
          expected_libs_and_assets =
              "expectations/$target_name.$target_cpu.libs_and_assets.expected"
        }
      }
    }
  }
}

generate_jni("chrome_jni_headers") {
  sources = [
    "../browser/share/android/java/src/org/chromium/chrome/browser/share/BitmapDownloadRequest.java",
    "../browser/share/android/java/src/org/chromium/chrome/browser/share/link_to_text/LinkToTextBridge.java",
    "../browser/share/android/java/src/org/chromium/chrome/browser/share/long_screenshots/bitmap_generation/LongScreenshotsTabService.java",
    "../browser/share/android/java/src/org/chromium/chrome/browser/share/long_screenshots/bitmap_generation/LongScreenshotsTabServiceFactory.java",
    "../browser/share/android/java/src/org/chromium/chrome/browser/share/qrcode/QRCodeGenerator.java",
    "../browser/share/android/java/src/org/chromium/chrome/browser/share/screenshot/EditorScreenshotTask.java",
    "../browser/share/android/java/src/org/chromium/chrome/browser/share/send_tab_to_self/MetricsRecorder.java",
    "../browser/share/android/java/src/org/chromium/chrome/browser/share/send_tab_to_self/NotificationManager.java",
    "../browser/share/android/java/src/org/chromium/chrome/browser/share/send_tab_to_self/SendTabToSelfAndroidBridge.java",
    "../browser/share/android/java/src/org/chromium/chrome/browser/share/send_tab_to_self/TargetDeviceInfo.java",
    "java/src/org/chromium/chrome/browser/ChromeBackupAgentImpl.java",
    "java/src/org/chromium/chrome/browser/ChromeBackupWatcher.java",
    "java/src/org/chromium/chrome/browser/DevToolsServer.java",
    "java/src/org/chromium/chrome/browser/IntentHandler.java",
    "java/src/org/chromium/chrome/browser/NearOomMonitor.java",
    "java/src/org/chromium/chrome/browser/PlayServicesVersionInfo.java",
    "java/src/org/chromium/chrome/browser/ServiceTabLauncher.java",
    "java/src/org/chromium/chrome/browser/ShortcutHelper.java",
    "java/src/org/chromium/chrome/browser/WarmupManager.java",
    "java/src/org/chromium/chrome/browser/about_settings/AboutSettingsBridge.java",
    "java/src/org/chromium/chrome/browser/announcement/AnnouncementNotificationManager.java",
    "java/src/org/chromium/chrome/browser/app/flags/ChromeCachedFlags.java",
    "java/src/org/chromium/chrome/browser/app/send_tab_to_self/SendTabToSelfNotificationReceiver.java",
    "java/src/org/chromium/chrome/browser/app/tab_activity_glue/ReparentingTask.java",
    "java/src/org/chromium/chrome/browser/autofill/AutofillAccessibilityUtils.java",
    "java/src/org/chromium/chrome/browser/autofill/AutofillExpirationDateFixFlowBridge.java",
    "java/src/org/chromium/chrome/browser/autofill/AutofillNameFixFlowBridge.java",
    "java/src/org/chromium/chrome/browser/autofill/AutofillSnackbarController.java",
    "java/src/org/chromium/chrome/browser/autofill/CardUnmaskBridge.java",
    "java/src/org/chromium/chrome/browser/autofill/CreditCardScannerBridge.java",
    "java/src/org/chromium/chrome/browser/autofill/SaveUpdateAddressProfilePrompt.java",
    "java/src/org/chromium/chrome/browser/autofill/SaveUpdateAddressProfilePromptController.java",
    "java/src/org/chromium/chrome/browser/autofill/iban/AutofillSaveIbanBottomSheetBridge.java",
    "java/src/org/chromium/chrome/browser/autofill/save_card/AutofillSaveCardBottomSheetBridge.java",
    "java/src/org/chromium/chrome/browser/autofill/settings/AutofillPaymentMethodsDelegate.java",
    "java/src/org/chromium/chrome/browser/autofill/settings/SettingsLauncherHelper.java",
    "java/src/org/chromium/chrome/browser/autofill/settings/VirtualCardEnrollmentFields.java",
    "java/src/org/chromium/chrome/browser/autofill/vcn/AutofillVcnEnrollBottomSheetBridge.java",
    "java/src/org/chromium/chrome/browser/auxiliary_search/AuxiliarySearchBridge.java",
    "java/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTask.java",
    "java/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskScheduler.java",
    "java/src/org/chromium/chrome/browser/background_sync/GooglePlayServicesChecker.java",
    "java/src/org/chromium/chrome/browser/background_sync/PeriodicBackgroundSyncChromeWakeUpTask.java",
    "java/src/org/chromium/chrome/browser/background_task_scheduler/ChromeBackgroundTaskFactory.java",
    "java/src/org/chromium/chrome/browser/background_task_scheduler/ProxyNativeTask.java",
    "java/src/org/chromium/chrome/browser/bookmarks/BookmarkBridge.java",
    "java/src/org/chromium/chrome/browser/browserservices/digitalgoods/SiteIsolator.java",
    "java/src/org/chromium/chrome/browser/browserservices/permissiondelegation/InstalledWebappBridge.java",
    "java/src/org/chromium/chrome/browser/browserservices/permissiondelegation/InstalledWebappGeolocationBridge.java",
    "java/src/org/chromium/chrome/browser/browsing_data/BrowsingDataBridge.java",
    "java/src/org/chromium/chrome/browser/browsing_data/BrowsingDataCounterBridge.java",
    "java/src/org/chromium/chrome/browser/browsing_data/UrlFilterBridge.java",
    "java/src/org/chromium/chrome/browser/complex_tasks/TaskTabHelper.java",
    "java/src/org/chromium/chrome/browser/compositor/CompositorView.java",
    "java/src/org/chromium/chrome/browser/compositor/LayerTitleCache.java",
    "java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelContent.java",
    "java/src/org/chromium/chrome/browser/compositor/scene_layer/ContextualSearchSceneLayer.java",
    "java/src/org/chromium/chrome/browser/compositor/scene_layer/SolidColorSceneLayer.java",
    "java/src/org/chromium/chrome/browser/compositor/scene_layer/StaticTabSceneLayer.java",
    "java/src/org/chromium/chrome/browser/compositor/scene_layer/TabListSceneLayer.java",
    "java/src/org/chromium/chrome/browser/compositor/scene_layer/TabStripSceneLayer.java",
    "java/src/org/chromium/chrome/browser/compositor/scene_layer/ToolbarSwipeSceneLayer.java",
    "java/src/org/chromium/chrome/browser/contextmenu/ContextMenuHelper.java",
    "java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchContext.java",
    "java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java",
    "java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java",
    "java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTabHelper.java",
    "java/src/org/chromium/chrome/browser/crash/MinidumpUploadServiceImpl.java",
    "java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java",
    "java/src/org/chromium/chrome/browser/customtabs/CustomTabsOpenTimeRecorder.java",
    "java/src/org/chromium/chrome/browser/customtabs/features/TabInteractionRecorder.java",
    "java/src/org/chromium/chrome/browser/datareduction/DataSaverOSSetting.java",
    "java/src/org/chromium/chrome/browser/device_dialog/ChromeBluetoothChooserAndroidDelegate.java",
    "java/src/org/chromium/chrome/browser/device_dialog/ChromeBluetoothScanningPromptAndroidDelegate.java",
    "java/src/org/chromium/chrome/browser/device_dialog/UsbChooserDialog.java",
    "java/src/org/chromium/chrome/browser/dom_distiller/DomDistillerServiceFactory.java",
    "java/src/org/chromium/chrome/browser/dom_distiller/DomDistillerTabUtils.java",
    "java/src/org/chromium/chrome/browser/dom_distiller/DomDistillerUIUtils.java",
    "java/src/org/chromium/chrome/browser/download/DownloadController.java",
    "java/src/org/chromium/chrome/browser/download/DownloadItem.java",
    "java/src/org/chromium/chrome/browser/download/DownloadManagerService.java",
    "java/src/org/chromium/chrome/browser/download/DownloadMessageBridge.java",
    "java/src/org/chromium/chrome/browser/download/DownloadUtils.java",
    "java/src/org/chromium/chrome/browser/download/DuplicateDownloadDialogBridge.java",
    "java/src/org/chromium/chrome/browser/download/OpenDownloadDialogBridge.java",
    "java/src/org/chromium/chrome/browser/download/service/DownloadBackgroundTask.java",
    "java/src/org/chromium/chrome/browser/download/service/DownloadTaskScheduler.java",
    "java/src/org/chromium/chrome/browser/feedback/ConnectivityChecker.java",
    "java/src/org/chromium/chrome/browser/feedback/ScreenshotTask.java",
    "java/src/org/chromium/chrome/browser/firstrun/FirstRunUtils.java",
    "java/src/org/chromium/chrome/browser/flags/BadFlagsSnackbarManager.java",
    "java/src/org/chromium/chrome/browser/history/BrowsingHistoryBridge.java",
    "java/src/org/chromium/chrome/browser/history/HistoryDeletionBridge.java",
    "java/src/org/chromium/chrome/browser/history/HistoryDeletionInfo.java",
    "java/src/org/chromium/chrome/browser/infobar/AutofillSaveCardInfoBar.java",
    "java/src/org/chromium/chrome/browser/infobar/AutofillVirtualCardEnrollmentInfoBar.java",
    "java/src/org/chromium/chrome/browser/infobar/DuplicateDownloadInfoBar.java",
    "java/src/org/chromium/chrome/browser/infobar/FramebustBlockInfoBar.java",
    "java/src/org/chromium/chrome/browser/infobar/InfoBarContainer.java",
    "java/src/org/chromium/chrome/browser/infobar/KnownInterceptionDisclosureInfoBar.java",
    "java/src/org/chromium/chrome/browser/infobar/NearOomInfoBar.java",
    "java/src/org/chromium/chrome/browser/infobar/PermissionInfoBar.java",
    "java/src/org/chromium/chrome/browser/infobar/SafetyTipInfoBar.java",
    "java/src/org/chromium/chrome/browser/infobar/TranslateCompactInfoBar.java",
    "java/src/org/chromium/chrome/browser/init/NativeStartupBridge.java",
    "java/src/org/chromium/chrome/browser/lens/LensDebugBridge.java",
    "java/src/org/chromium/chrome/browser/lens/LensPolicyUtils.java",
    "java/src/org/chromium/chrome/browser/login/ChromeHttpAuthHandler.java",
    "java/src/org/chromium/chrome/browser/media/MediaCaptureDevicesDispatcherAndroid.java",
    "java/src/org/chromium/chrome/browser/media/PictureInPictureActivity.java",
    "java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouterClient.java",
    "java/src/org/chromium/chrome/browser/metrics/LaunchMetrics.java",
    "java/src/org/chromium/chrome/browser/metrics/UmaSessionStats.java",
    "java/src/org/chromium/chrome/browser/metrics/VariationsSession.java",
    "java/src/org/chromium/chrome/browser/mojo/ChromeInterfaceRegistrar.java",
    "java/src/org/chromium/chrome/browser/navigation_predictor/NavigationPredictorBridge.java",
    "java/src/org/chromium/chrome/browser/notifications/ActionInfo.java",
    "java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java",
    "java/src/org/chromium/chrome/browser/notifications/NotificationSuspender.java",
    "java/src/org/chromium/chrome/browser/notifications/NotificationTriggerScheduler.java",
    "java/src/org/chromium/chrome/browser/notifications/PushMessagingServiceBridge.java",
    "java/src/org/chromium/chrome/browser/notifications/scheduler/DisplayAgent.java",
    "java/src/org/chromium/chrome/browser/notifications/scheduler/NotificationSchedulerTask.java",
    "java/src/org/chromium/chrome/browser/ntp/RecentTabsPagePrefs.java",
    "java/src/org/chromium/chrome/browser/ntp/RecentlyClosedBridge.java",
    "java/src/org/chromium/chrome/browser/ntp/RecentlyClosedTab.java",
    "java/src/org/chromium/chrome/browser/offlinepages/AutoFetchNotifier.java",
    "java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java",
    "java/src/org/chromium/chrome/browser/offlinepages/OfflinePageArchivePublisherBridge.java",
    "java/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridge.java",
    "java/src/org/chromium/chrome/browser/offlinepages/PublishPageCallback.java",
    "java/src/org/chromium/chrome/browser/offlinepages/RequestCoordinatorBridge.java",
    "java/src/org/chromium/chrome/browser/offlinepages/SavePageRequest.java",
    "java/src/org/chromium/chrome/browser/offlinepages/downloads/OfflinePageDownloadBridge.java",
    "java/src/org/chromium/chrome/browser/page_info/PageInfoAboutThisSiteController.java",
    "java/src/org/chromium/chrome/browser/partnerbookmarks/PartnerBookmarksReader.java",
    "java/src/org/chromium/chrome/browser/password_manager/AccountChooserDialog.java",
    "java/src/org/chromium/chrome/browser/password_manager/AutoSigninFirstRunDialog.java",
    "java/src/org/chromium/chrome/browser/password_manager/AutoSigninSnackbarController.java",
    "java/src/org/chromium/chrome/browser/password_manager/Credential.java",
    "java/src/org/chromium/chrome/browser/password_manager/CredentialLeakDialogBridge.java",
    "java/src/org/chromium/chrome/browser/password_manager/PasswordCheckupLauncher.java",
    "java/src/org/chromium/chrome/browser/password_manager/PasswordGenerationPopupBridge.java",
    "java/src/org/chromium/chrome/browser/password_manager/PasswordManagerErrorMessageHelperBridge.java",
    "java/src/org/chromium/chrome/browser/password_manager/PasswordManagerLauncher.java",
    "java/src/org/chromium/chrome/browser/password_manager/PasswordMigrationWarningBridge.java",
    "java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentAppBridge.java",
    "java/src/org/chromium/chrome/browser/permissions/PermissionBlockedDialog.java",
    "java/src/org/chromium/chrome/browser/permissions/PermissionSettingsBridge.java",
    "java/src/org/chromium/chrome/browser/permissions/PermissionUpdateRequester.java",
    "java/src/org/chromium/chrome/browser/policy/PolicyAuditor.java",
    "java/src/org/chromium/chrome/browser/policy/PolicyAuditorBridge.java",
    "java/src/org/chromium/chrome/browser/printing/TabPrinter.java",
    "java/src/org/chromium/chrome/browser/privacy/settings/PrivacyPreferencesManagerImpl.java",
    "java/src/org/chromium/chrome/browser/push_messaging/PushMessagingServiceObserver.java",
    "java/src/org/chromium/chrome/browser/renderer_host/ChromeNavigationUIData.java",
    "java/src/org/chromium/chrome/browser/resources/ResourceMapper.java",
    "java/src/org/chromium/chrome/browser/rlz/RevenueStats.java",
    "java/src/org/chromium/chrome/browser/rlz/RlzPingHandler.java",
    "java/src/org/chromium/chrome/browser/safe_browsing/SafeBrowsingPasswordReuseDialogBridge.java",
    "java/src/org/chromium/chrome/browser/safe_browsing/SafeBrowsingReferringAppBridge.java",
    "java/src/org/chromium/chrome/browser/safe_browsing/SafeBrowsingSettingsLauncher.java",
    "java/src/org/chromium/chrome/browser/segmentation_platform/ContextualPageActionController.java",
    "java/src/org/chromium/chrome/browser/sharing/SharingJNIBridge.java",
    "java/src/org/chromium/chrome/browser/sharing/click_to_call/ClickToCallMessageHandler.java",
    "java/src/org/chromium/chrome/browser/sharing/sms_fetcher/SmsFetcherMessageHandler.java",
    "java/src/org/chromium/chrome/browser/signin/SigninBridge.java",
    "java/src/org/chromium/chrome/browser/signin/SigninManagerImpl.java",
    "java/src/org/chromium/chrome/browser/site_settings/CookieControlsServiceBridge.java",
    "java/src/org/chromium/chrome/browser/status_indicator/StatusIndicatorSceneLayer.java",
    "java/src/org/chromium/chrome/browser/suggestions/mostvisited/MostVisitedSites.java",
    "java/src/org/chromium/chrome/browser/suggestions/mostvisited/MostVisitedSitesBridge.java",
    "java/src/org/chromium/chrome/browser/supervised_user/ChildAccountService.java",
    "java/src/org/chromium/chrome/browser/sync/TrustedVaultClient.java",
    "java/src/org/chromium/chrome/browser/tab/TabBrowserControlsConstraintsHelper.java",
    "java/src/org/chromium/chrome/browser/tab/TabFavicon.java",
    "java/src/org/chromium/chrome/browser/tab/TabImpl.java",
    "java/src/org/chromium/chrome/browser/tab/TabWebContentsDelegateAndroidImpl.java",
    "java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabSaverImpl.java",
    "java/src/org/chromium/chrome/browser/tabmodel/TabModelJniBridge.java",
    "java/src/org/chromium/chrome/browser/tabmodel/TabModelObserverJniBridge.java",
    "java/src/org/chromium/chrome/browser/usage_stats/UsageStatsBridge.java",
    "java/src/org/chromium/chrome/browser/webapps/WebApkDataProvider.java",
    "java/src/org/chromium/chrome/browser/webapps/WebApkHandlerDelegate.java",
    "java/src/org/chromium/chrome/browser/webapps/WebApkInstallService.java",
    "java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java",
    "java/src/org/chromium/chrome/browser/webapps/WebApkPostShareTargetNavigator.java",
    "java/src/org/chromium/chrome/browser/webapps/WebApkSyncService.java",
    "java/src/org/chromium/chrome/browser/webapps/WebApkUpdateDataFetcher.java",
    "java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java",
    "java/src/org/chromium/chrome/browser/webapps/WebappRegistry.java",
  ]

  # Used for testing only, should not be shipped to end users.
  if (enable_offline_pages_harness) {
    sources += [ "java/src/org/chromium/chrome/browser/offlinepages/evaluation/OfflinePageEvaluationBridge.java" ]
  }

  public_deps = [
    ":base_module_jni",
    "//chrome/browser/webid:jni_headers",
  ]
}

source_set("chrome_test_util") {
  testonly = true
  sources = [
    "javatests/src/custom_tabs_test_utils.cc",
    "javatests/src/federated_identity_test_utils.cc",
    "javatests/src/pwa_restore_bottom_sheet_test_utils.cc",
  ]
  deps = [
    ":chrome_test_util_jni",
    "//base",
    "//chrome/browser",
    "//chrome/browser/profiles:profile",
    "//components/variations",
    "//url:url",
  ]
}

# This is a list of all base module jni headers. New features should add their
# own jni target to this list.
group("jni_headers") {
  public_deps = [
    ":chrome_jni_headers",
    "//chrome/android/features/keyboard_accessory:jni_headers",
    "//chrome/browser/android/browserservices/metrics:jni_headers",
    "//chrome/browser/android/browserservices/verification:jni_headers",
    "//chrome/browser/android/metrics:jni_headers",
    "//chrome/browser/battery/android:jni_headers",
    "//chrome/browser/commerce/merchant_viewer/android:jni_headers",
    "//chrome/browser/commerce/price_tracking/android:jni_headers",
    "//chrome/browser/contextmenu:jni_headers",
    "//chrome/browser/data_sharing:jni_headers",
    "//chrome/browser/download/android:jni_headers",
    "//chrome/browser/enterprise/util:jni_headers",
    "//chrome/browser/facilitated_payments/ui/android:jni_headers",
    "//chrome/browser/feature_engagement:jni_headers",
    "//chrome/browser/flags:jni_headers",
    "//chrome/browser/history:jni_headers",
    "//chrome/browser/history_clusters:jni_headers",
    "//chrome/browser/image_descriptions:jni_headers",
    "//chrome/browser/incognito:jni_headers",
    "//chrome/browser/locale:jni_headers",
    "//chrome/browser/mandatory_reauth/android:jni_headers",
    "//chrome/browser/page_load_metrics:jni_headers",
    "//chrome/browser/preferences:jni_headers",
    "//chrome/browser/privacy:jni_headers",
    "//chrome/browser/profiles/android:jni_headers",
    "//chrome/browser/quick_delete:jni_headers",
    "//chrome/browser/search_engines/android:jni_headers",
    "//chrome/browser/segmentation_platform:jni_headers",
    "//chrome/browser/tab:jni_headers",
    "//chrome/browser/tab_group_sync:jni_headers",
    "//chrome/browser/tab_ui/android:jni_headers",
    "//chrome/browser/touch_to_fill/autofill/android:jni_headers",
    "//chrome/browser/touch_to_fill/password_manager/android:jni_headers",
    "//chrome/browser/ui/android/digital_credentials:jni_headers",
    "//chrome/browser/ui/android/edge_to_edge:jni_headers",
    "//chrome/browser/ui/android/fast_checkout:jni_headers",
    "//chrome/browser/ui/android/favicon:jni_headers",
    "//chrome/browser/ui/android/hats:jni_headers",
    "//chrome/browser/ui/android/hats/internal:jni_headers",
    "//chrome/browser/ui/android/logo:jni_headers",
    "//chrome/browser/ui/android/omnibox:jni_headers",
    "//chrome/browser/ui/android/plus_addresses:jni_headers",
    "//chrome/browser/ui/android/preloading:jni_headers",
    "//chrome/browser/ui/android/toolbar:jni_headers",
    "//chrome/browser/ui/android/webid:jni_headers",
    "//chrome/browser/ui/messages/android:jni_headers",
    "//chrome/browser/util:jni_headers",
    "//chrome/browser/webauthn/android:jni_headers",
    "//components/browser_ui/device_lock/android:device_lock_bridge_jni_headers",
    "//components/content_relationship_verification/android:jni_headers",
    "//components/image_fetcher:jni_headers",
    "//components/media_router/browser/android:jni_headers",
    "//components/ukm/android:jni_headers",
    "//components/webauthn/android:jni_headers",
  ]
}

# Chrome APK's native library.
template("libchrome_impl") {
  chrome_common_shared_library(target_name) {
    sources = [ "../browser/android/chrome_entry_point.cc" ]
    deps = []
    if (defined(invoker.deps)) {
      deps += invoker.deps
    }

    java_targets = [ "//chrome/android:chrome_public_apk" ]
    forward_variables_from(invoker, "*", [ "deps" ])
  }
}

if (enable_resource_allowlist_generation) {
  libchrome_impl("libchrome_inputs") {
    collect_inputs_only = true
  }
}

libchrome_impl("libchrome") {
  define_unwind_table_target =
      add_unwind_tables_in_chrome_32bit_apk && target_cpu == "arm"
  if (enable_resource_allowlist_generation) {
    # Make sure allowlist_inputs is built first so when concurrent_links == 1
    # it comes before the actual (very slow) link step.
    deps = [ ":libchrome_inputs" ]
  }

  module_descs = chrome_module_descs

  # Java and native targets form two independent compile graphs. Deps from java targets
  # onto native ones (or vice versa) are unnecessary and reduce parallelism.
  # This prevents deps from native -> java.
  assert_no_deps = [ "//build/android:build_java" ]
}

chrome_common_shared_library("libchromefortest") {
  testonly = true
  define_unwind_table_target =
      add_unwind_tables_in_chrome_32bit_apk && target_cpu == "arm"
  sources = [ "../browser/android/chrome_entry_point_for_test.cc" ]
  deps = [
    ":browser_test_support",
    ":chrome_test_util",
    "//base/test:test_support",
    "//chrome:chrome_android_core",
    "//chrome/browser/android/metrics:ukm_utils_for_test",
    "//chrome/browser/password_manager/android:test_support",
    "//chrome/browser/subresource_filter:android_test_support",
    "//chrome/browser/supervised_user:test_support",
    "//components/crash/android:crash_android",
    "//components/external_intents/android:test_support",
    "//components/ip_protection/android/android_auth_client_lib/cpp:ip_protection_auth_test_natives",
    "//components/minidump_uploader",
    "//components/paint_preview/player/android:test_support",
    "//components/sync",
    "//components/variations/android:test_support",
    "//content/public/test/android:content_native_test_support",
    "//content/test:test_support",
    "//ui/base/clipboard:clipboard_test_support",
  ]

  # Make this a partitioned library, since some partitioned code is linked in
  # (otherwise, the library will warn at build time that it contains multiple
  # symbol tables). However, do not create the partitions, as they are not
  # required or packaged into the APK. This can be removed if LLD starts
  # supporting a "no partitions" argument (https://crbug.com/1021108).
  module_descs = []

  java_targets = [
    "//chrome/android:chrome_public_unit_test_apk__test_apk",
    "//chrome/android:chrome_public_test_apk__test_apk",
    "//chrome/test/android:chrome_java_test_wpr_tests__test_apk",
    "//chrome/test/android:chrome_java_test_feed_test__test_apk",
  ]
  if (enable_vr) {
    java_targets += [ "//chrome/android:chrome_public_test_vr_apk__test_apk" ]
  }
}

# Monochrome equivalent of Chrome's APK or bundle library template.
template("libmonochrome_apk_or_bundle_tmpl") {
  chrome_common_shared_library(target_name) {
    sources = [ "../browser/android/monochrome_entry_point.cc" ]
    deps = [
      "//android_webview/lib",
      "//android_webview/nonembedded",
      "//components/crash/android:crashpad_main",
    ]
    if (defined(invoker.deps)) {
      deps += invoker.deps
    }

    defines = []
    if (android_64bit_target_cpu) {
      java_targets = [ "//chrome/android:monochrome_64_public_bundle" ]
      priority_java_targets = [ "//android_webview:system_webview_64_bundle" ]
    } else {
      java_targets = [ "//chrome/android:monochrome_public_bundle" ]
    }

    is_monochrome = true
    module_descs = monochrome_module_descs

    forward_variables_from(invoker, "*", [ "deps" ])
  }
}

libmonochrome_apk_or_bundle_tmpl("libmonochrome") {
  enable_target = current_toolchain == _monochrome_browser_toolchain
  define_unwind_table_target =
      add_unwind_tables_in_chrome_32bit_apk && current_cpu == "arm"
  if (enable_resource_allowlist_generation) {
    # Make sure allowlist_inputs is built first so when concurrent_links == 1
    # it comes before the actual (very slow) link step.
    deps = [ ":libmonochrome_inputs($_monochrome_browser_toolchain)" ]
  }
}

if (current_toolchain == _monochrome_browser_toolchain) {
  # Avoiding a real link for this step allows the actual libmonochrome to
  # run at the same time as R8.
  libmonochrome_apk_or_bundle_tmpl("libmonochrome_inputs") {
    collect_inputs_only = true
  }

  if (android_64bit_target_cpu && !skip_secondary_abi_for_cq) {
    group("monochrome_64_secondary_abi_lib") {
      public_deps = [ ":libmonochrome_64($android_secondary_abi_toolchain)" ]
    }
  }
}

if (android_64bit_target_cpu) {
  # 64-bit browser library targets (APK and bundle).
  libmonochrome_apk_or_bundle_tmpl("libmonochrome_64") {
  }

  # 32-bit browser library alias targets, pulled in by 64-bit WebView builds.
  if (!skip_secondary_abi_for_cq) {
    group("monochrome_secondary_abi_lib") {
      public_deps = [ ":libmonochrome($android_secondary_abi_toolchain)" ]
    }
  }
}

if (add_unwind_tables_in_chrome_32bit_apk) {
  if (defined(android_secondary_abi_toolchain)) {
    _toolchain = android_secondary_abi_toolchain
  } else {
    _toolchain = default_toolchain
  }
  _toolchain_out_dir = get_label_info(":foo($_toolchain)", "target_out_dir")

  template("chrome_unwind_assets") {
    android_assets(target_name) {
      forward_variables_from(invoker, [ "testonly" ])
      _libname = invoker.libname
      deps = [ ":${_libname}_unwind_table_v1($_toolchain)" ]
      sources = [ "$_toolchain_out_dir/${_libname}_unwind_table_v1/$unwind_table_asset_v1_filename" ]
      disable_compression = true
      if (use_android_unwinder_v2) {
        sources += [ "$_toolchain_out_dir/${_libname}_unwind_table_v2/$unwind_table_asset_v2_filename" ]
        deps += [ ":${_libname}_unwind_table_v2($_toolchain)" ]
      }
    }
  }
  chrome_unwind_assets("libmonochrome_unwind_table_assets") {
    libname = "libmonochrome"
  }

  # We create fat apks only with libmonochrome.
  if (target_cpu == "arm") {
    chrome_unwind_assets("libchrome_unwind_table_assets") {
      libname = "libchrome"
    }
    chrome_unwind_assets("libchromefortest_unwind_table_assets") {
      testonly = true
      libname = "libchromefortest"
    }
  }
}

# Used by android-binary-size trybot to validate expectations.
if (current_toolchain == default_toolchain &&
    (enable_libs_and_assets_verification || enable_manifest_verification)) {
  group("validate_expectations") {
    deps = []
    if (enable_libs_and_assets_verification) {
      if (android_64bit_target_cpu) {
        deps += [
          ":monochrome_64_32_public_bundle_validate_libs_and_assets",
          ":trichrome_chrome_32_64_bundle_validate_libs_and_assets",
          ":trichrome_chrome_32_bundle_validate_libs_and_assets",
          ":trichrome_chrome_64_32_bundle_validate_libs_and_assets",
          ":trichrome_chrome_64_bundle_validate_libs_and_assets",
          ":trichrome_library_32_64_apk_validate_libs_and_assets",
          ":trichrome_library_32_apk_validate_libs_and_assets",
          ":trichrome_library_64_32_apk_validate_libs_and_assets",
          ":trichrome_library_64_apk_validate_libs_and_assets",
          "//android_webview:trichrome_webview_32_64_bundle_validate_libs_and_assets",
          "//android_webview:trichrome_webview_32_bundle_validate_libs_and_assets",
          "//android_webview:trichrome_webview_64_32_bundle_validate_libs_and_assets",
          "//android_webview:trichrome_webview_64_bundle_validate_libs_and_assets",
        ]
      } else {
        deps += [
          ":${_main_monochrome_public_bundle_target}_validate_libs_and_assets",
          ":${_main_trichrome_chrome_bundle_target}_validate_libs_and_assets",
          ":${_main_trichrome_library_apk_target}_validate_libs_and_assets",
          "//android_webview:trichrome_webview_bundle_validate_libs_and_assets",
        ]
      }
    }
    if (enable_manifest_verification) {
      if (android_64bit_target_cpu) {
        deps += [
          ":monochrome_32_64_public_bundle__base_bundle_module_validate_android_manifest",
          ":monochrome_32_public_bundle__base_bundle_module_validate_android_manifest",
          ":monochrome_64_32_public_bundle_validate_manifests",
          ":monochrome_64_32_public_bundle_validate_proguard_config",
          ":monochrome_64_public_bundle__base_bundle_module_validate_android_manifest",
          ":trichrome_chrome_32_64_bundle__base_bundle_module_validate_android_manifest",
          ":trichrome_chrome_32_bundle__base_bundle_module_validate_android_manifest",
          ":trichrome_chrome_64_32_bundle__base_bundle_module_validate_android_manifest",
          ":trichrome_chrome_64_bundle__base_bundle_module_validate_android_manifest",
          ":trichrome_library_32_64_apk_validate_android_manifest",
          ":trichrome_library_32_apk_validate_android_manifest",
          ":trichrome_library_64_32_apk_validate_android_manifest",
          ":trichrome_library_64_apk_validate_android_manifest",
          "//android_webview:system_webview_32_64_base_bundle_module_validate_android_manifest",
          "//android_webview:system_webview_32_base_bundle_module_validate_android_manifest",
          "//android_webview:system_webview_64_base_bundle_module_validate_android_manifest",
          "//android_webview:trichrome_webview_32_64_base_bundle_module_validate_android_manifest",
          "//android_webview:trichrome_webview_32_base_bundle_module_validate_android_manifest",
          "//android_webview:trichrome_webview_64_32_base_bundle_module_validate_android_manifest",
          "//android_webview:trichrome_webview_64_base_bundle_module_validate_android_manifest",
        ]
      } else {
        deps += [
          ":${_main_monochrome_public_bundle_target}_validate_manifests",
          ":${_main_monochrome_public_bundle_target}_validate_proguard_config",
          ":${_main_trichrome_chrome_bundle_target}__base_bundle_module_validate_android_manifest",
          ":${_main_trichrome_library_apk_target}_validate_android_manifest",
          "//android_webview:system_webview_base_bundle_module_validate_android_manifest",
          "//android_webview:trichrome_webview_base_bundle_module_validate_android_manifest",
        ]
      }
    }
  }
}