chromium/components/autofill/core/browser/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/buildflag_header.gni")
import("//build/config/chrome_build.gni")
import("//build/config/features.gni")
import("//chrome/version.gni")
import("//components/optimization_guide/features.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//tools/grit/grit_rule.gni")
if (is_android) {
  import("//build/config/android/rules.gni")
}

grit("autofill_address_rewriter_resources") {
  source = "autofill_address_rewriter_resources.grd"
  outputs = [
    "grit/autofill_address_rewriter_resources.h",
    "grit/autofill_address_rewriter_resources_map.cc",
    "grit/autofill_address_rewriter_resources_map.h",
    "autofill_address_rewriter_resources.pak",
  ]
  output_dir = "$root_gen_dir/components/autofill/core/browser"
}

declare_args() {
  # Normally, only branded builds use Google-internal sets of parsing patterns.
  #
  # Setting the variable 'use_internal_autofill_patterns' in args.gn overrides
  # this default.
  use_internal_autofill_patterns = is_chrome_branded
}

buildflag_header("buildflags") {
  header = "form_parsing/buildflags.h"
  flags = [ "USE_INTERNAL_AUTOFILL_PATTERNS=$use_internal_autofill_patterns" ]
}

action("regex_patterns_inl_h") {
  visibility = [ ":*" ]

  # The order of sources must be so that it matches the PatternSource enum
  # values in regex_patterns.h.
  sources = [ "form_parsing/resources/legacy_regex_patterns.json" ]
  if (use_internal_autofill_patterns) {
    sources += [
      "form_parsing/internal_resources/0_default_regex_patterns.json",
      "form_parsing/internal_resources/1_experimental_regex_patterns.json",
    ]
  }

  script = "form_parsing/transpile_regex_patterns.py"
  outputs = [ "$target_gen_dir/form_parsing/regex_patterns_inl.h" ]
  args = [ "--input" ] + rebase_path(sources, root_build_dir) + [ "--output" ] +
         rebase_path(outputs, root_build_dir)
}

static_library("browser") {
  sources = [
    "address_data_cleaner.cc",
    "address_data_cleaner.h",
    "address_data_manager.cc",
    "address_data_manager.h",
    "address_normalization_manager.cc",
    "address_normalization_manager.h",
    "address_normalizer.h",
    "address_normalizer_impl.cc",
    "address_normalizer_impl.h",
    "address_profile_save_manager.cc",
    "address_profile_save_manager.h",
    "address_suggestion_generator.cc",
    "address_suggestion_generator.h",
    "autocomplete_history_manager.cc",
    "autocomplete_history_manager.h",
    "autofill_ablation_study.cc",
    "autofill_ablation_study.h",
    "autofill_address_util.cc",
    "autofill_address_util.h",
    "autofill_browser_util.cc",
    "autofill_browser_util.h",
    "autofill_client.cc",
    "autofill_client.h",
    "autofill_compose_delegate.h",
    "autofill_data_util.cc",
    "autofill_data_util.h",
    "autofill_driver.cc",
    "autofill_driver.h",
    "autofill_driver_factory.cc",
    "autofill_driver_factory.h",
    "autofill_driver_router.cc",
    "autofill_driver_router.h",
    "autofill_experiments.cc",
    "autofill_experiments.h",
    "autofill_external_delegate.cc",
    "autofill_external_delegate.h",
    "autofill_feedback_data.cc",
    "autofill_feedback_data.h",
    "autofill_field.cc",
    "autofill_field.h",
    "autofill_granular_filling_utils.cc",
    "autofill_granular_filling_utils.h",
    "autofill_manager.cc",
    "autofill_manager.h",
    "autofill_optimization_guide.cc",
    "autofill_optimization_guide.h",
    "autofill_plus_address_delegate.h",
    "autofill_prediction_improvements_delegate.h",
    "autofill_profile_import_process.cc",
    "autofill_profile_import_process.h",
    "autofill_shared_storage_handler.h",
    "autofill_trigger_details.h",
    "autofill_type.cc",
    "autofill_type.h",
    "browser_autofill_manager.cc",
    "browser_autofill_manager.h",
    "country_type.h",
    "crowdsourcing/autofill_crowdsourcing_encoding.cc",
    "crowdsourcing/autofill_crowdsourcing_encoding.h",
    "crowdsourcing/autofill_crowdsourcing_manager.cc",
    "crowdsourcing/autofill_crowdsourcing_manager.h",
    "crowdsourcing/determine_possible_field_types.cc",
    "crowdsourcing/determine_possible_field_types.h",
    "crowdsourcing/disambiguate_possible_field_types.cc",
    "crowdsourcing/disambiguate_possible_field_types.h",
    "data_model/address.cc",
    "data_model/address.h",
    "data_model/autofill_data_model.cc",
    "data_model/autofill_data_model.h",
    "data_model/autofill_feature_guarded_address_component.cc",
    "data_model/autofill_feature_guarded_address_component.h",
    "data_model/autofill_i18n_api.cc",
    "data_model/autofill_i18n_api.h",
    "data_model/autofill_i18n_formatting_expressions.h",
    "data_model/autofill_i18n_hierarchies.h",
    "data_model/autofill_i18n_parsing_expression_components.cc",
    "data_model/autofill_i18n_parsing_expression_components.h",
    "data_model/autofill_i18n_parsing_expressions.h",
    "data_model/autofill_i18n_stopwords.h",
    "data_model/autofill_offer_data.cc",
    "data_model/autofill_offer_data.h",
    "data_model/autofill_profile.cc",
    "data_model/autofill_profile.h",
    "data_model/autofill_profile_comparator.cc",
    "data_model/autofill_profile_comparator.h",
    "data_model/autofill_structured_address.cc",
    "data_model/autofill_structured_address.h",
    "data_model/autofill_structured_address_component.cc",
    "data_model/autofill_structured_address_component.h",
    "data_model/autofill_structured_address_component_store.cc",
    "data_model/autofill_structured_address_component_store.h",
    "data_model/autofill_structured_address_constants.cc",
    "data_model/autofill_structured_address_constants.h",
    "data_model/autofill_structured_address_format_provider.cc",
    "data_model/autofill_structured_address_format_provider.h",
    "data_model/autofill_structured_address_name.cc",
    "data_model/autofill_structured_address_name.h",
    "data_model/autofill_structured_address_regex_provider.cc",
    "data_model/autofill_structured_address_regex_provider.h",
    "data_model/autofill_structured_address_utils.cc",
    "data_model/autofill_structured_address_utils.h",
    "data_model/autofill_synthesized_address_component.cc",
    "data_model/autofill_synthesized_address_component.h",
    "data_model/autofill_wallet_usage_data.cc",
    "data_model/autofill_wallet_usage_data.h",
    "data_model/bank_account.cc",
    "data_model/bank_account.h",
    "data_model/borrowed_transliterator.cc",
    "data_model/borrowed_transliterator.h",
    "data_model/contact_info.cc",
    "data_model/contact_info.h",
    "data_model/credit_card.cc",
    "data_model/credit_card.h",
    "data_model/credit_card_art_image.cc",
    "data_model/credit_card_art_image.h",
    "data_model/credit_card_benefit.cc",
    "data_model/credit_card_benefit.h",
    "data_model/credit_card_cloud_token_data.cc",
    "data_model/credit_card_cloud_token_data.h",
    "data_model/data_model_utils.cc",
    "data_model/data_model_utils.h",
    "data_model/ewallet.cc",
    "data_model/ewallet.h",
    "data_model/form_group.cc",
    "data_model/form_group.h",
    "data_model/iban.cc",
    "data_model/iban.h",
    "data_model/payment_instrument.cc",
    "data_model/payment_instrument.h",
    "data_model/payments_metadata.cc",
    "data_model/payments_metadata.h",
    "data_model/phone_number.cc",
    "data_model/phone_number.h",
    "field_filling_address_util.cc",
    "field_filling_address_util.h",
    "field_filling_payments_util.cc",
    "field_filling_payments_util.h",
    "field_type_utils.cc",
    "field_type_utils.h",
    "field_types.cc",
    "field_types.h",
    "filling_product.cc",
    "filling_product.h",
    "form_autofill_history.cc",
    "form_autofill_history.h",
    "form_data_importer.cc",
    "form_data_importer.h",
    "form_data_importer_utils.cc",
    "form_data_importer_utils.h",
    "form_filler.cc",
    "form_filler.h",
    "form_forest.cc",
    "form_forest.h",
    "form_forest_util_inl.h",
    "form_parsing/address_field_parser.cc",
    "form_parsing/address_field_parser.h",
    "form_parsing/address_field_parser_ng.cc",
    "form_parsing/address_field_parser_ng.h",
    "form_parsing/autofill_parsing_utils.h",
    "form_parsing/autofill_scanner.cc",
    "form_parsing/autofill_scanner.h",
    "form_parsing/credit_card_field_parser.cc",
    "form_parsing/credit_card_field_parser.h",
    "form_parsing/email_field_parser.cc",
    "form_parsing/email_field_parser.h",
    "form_parsing/field_candidates.cc",
    "form_parsing/field_candidates.h",
    "form_parsing/form_field_parser.cc",
    "form_parsing/form_field_parser.h",
    "form_parsing/iban_field_parser.cc",
    "form_parsing/iban_field_parser.h",
    "form_parsing/merchant_promo_code_field_parser.cc",
    "form_parsing/merchant_promo_code_field_parser.h",
    "form_parsing/name_field_parser.cc",
    "form_parsing/name_field_parser.h",
    "form_parsing/numeric_quantity_field_parser.cc",
    "form_parsing/numeric_quantity_field_parser.h",
    "form_parsing/phone_field_parser.cc",
    "form_parsing/phone_field_parser.h",
    "form_parsing/price_field_parser.cc",
    "form_parsing/price_field_parser.h",
    "form_parsing/regex_patterns.cc",
    "form_parsing/regex_patterns.h",
    "form_parsing/search_field_parser.cc",
    "form_parsing/search_field_parser.h",
    "form_parsing/standalone_cvc_field_parser.cc",
    "form_parsing/standalone_cvc_field_parser.h",
    "form_parsing/travel_field_parser.cc",
    "form_parsing/travel_field_parser.h",
    "form_processing/label_processing_util.cc",
    "form_processing/label_processing_util.h",
    "form_processing/name_processing_util.cc",
    "form_processing/name_processing_util.h",
    "form_structure.cc",
    "form_structure.h",
    "form_structure_rationalization_engine.cc",
    "form_structure_rationalization_engine.h",
    "form_structure_rationalizer.cc",
    "form_structure_rationalizer.h",
    "form_structure_sectioning_util.cc",
    "form_structure_sectioning_util.h",
    "form_types.cc",
    "form_types.h",
    "geo/address_i18n.cc",
    "geo/address_i18n.h",
    "geo/address_rewriter.cc",
    "geo/address_rewriter.h",
    "geo/alternative_state_name_map.cc",
    "geo/alternative_state_name_map.h",
    "geo/alternative_state_name_map_updater.cc",
    "geo/alternative_state_name_map_updater.h",
    "geo/autofill_country.cc",
    "geo/autofill_country.h",
    "geo/country_data.cc",
    "geo/country_data.h",
    "geo/country_names.cc",
    "geo/country_names.h",
    "geo/country_names_for_locale.cc",
    "geo/country_names_for_locale.h",
    "geo/phone_number_i18n.cc",
    "geo/phone_number_i18n.h",
    "geo/region_data_loader.h",
    "geo/region_data_loader_impl.cc",
    "geo/region_data_loader_impl.h",
    "geo/state_names.cc",
    "geo/state_names.h",
    "geo/subkey_requester.cc",
    "geo/subkey_requester.h",
    "heuristic_source.cc",
    "heuristic_source.h",
    "logging/log_buffer_submitter.cc",
    "logging/log_buffer_submitter.h",
    "logging/log_manager.cc",
    "logging/log_manager.h",
    "logging/log_protobufs.h",
    "logging/log_receiver.h",
    "logging/log_router.cc",
    "logging/log_router.h",
    "logging/text_log_receiver.cc",
    "logging/text_log_receiver.h",
    "manual_testing_import.cc",
    "manual_testing_import.h",
    "merchant_promo_code_manager.cc",
    "merchant_promo_code_manager.h",
    "metrics/address_data_cleaner_metrics.cc",
    "metrics/address_data_cleaner_metrics.h",
    "metrics/address_save_metrics.cc",
    "metrics/address_save_metrics.h",
    "metrics/autofill_in_devtools_metrics.cc",
    "metrics/autofill_in_devtools_metrics.h",
    "metrics/autofill_metrics.cc",
    "metrics/autofill_metrics.h",
    "metrics/autofill_metrics_utils.cc",
    "metrics/autofill_metrics_utils.h",
    "metrics/autofill_settings_metrics.cc",
    "metrics/autofill_settings_metrics.h",
    "metrics/fallback_autocomplete_unrecognized_metrics.cc",
    "metrics/fallback_autocomplete_unrecognized_metrics.h",
    "metrics/field_filling_stats_and_score_metrics.cc",
    "metrics/field_filling_stats_and_score_metrics.h",
    "metrics/form_events/address_form_event_logger.cc",
    "metrics/form_events/address_form_event_logger.h",
    "metrics/form_events/credit_card_form_event_logger.cc",
    "metrics/form_events/credit_card_form_event_logger.h",
    "metrics/form_events/form_event_logger_base.cc",
    "metrics/form_events/form_event_logger_base.h",
    "metrics/form_events/form_events.h",
    "metrics/granular_filling_metrics.cc",
    "metrics/granular_filling_metrics.h",
    "metrics/granular_filling_metrics_utils.cc",
    "metrics/granular_filling_metrics_utils.h",
    "metrics/log_event.cc",
    "metrics/log_event.h",
    "metrics/manual_fallback_metrics.cc",
    "metrics/manual_fallback_metrics.h",
    "metrics/payments/better_auth_metrics.cc",
    "metrics/payments/better_auth_metrics.h",
    "metrics/payments/card_metadata_metrics.cc",
    "metrics/payments/card_metadata_metrics.h",
    "metrics/payments/card_unmask_authentication_metrics.cc",
    "metrics/payments/card_unmask_authentication_metrics.h",
    "metrics/payments/card_unmask_flow_metrics.cc",
    "metrics/payments/card_unmask_flow_metrics.h",
    "metrics/payments/credit_card_save_metrics.cc",
    "metrics/payments/credit_card_save_metrics.h",
    "metrics/payments/cvc_storage_metrics.cc",
    "metrics/payments/cvc_storage_metrics.h",
    "metrics/payments/iban_metrics.cc",
    "metrics/payments/iban_metrics.h",
    "metrics/payments/local_card_migration_metrics.cc",
    "metrics/payments/local_card_migration_metrics.h",
    "metrics/payments/manage_cards_prompt_metrics.cc",
    "metrics/payments/manage_cards_prompt_metrics.h",
    "metrics/payments/mandatory_reauth_metrics.cc",
    "metrics/payments/mandatory_reauth_metrics.h",
    "metrics/payments/offers_metrics.cc",
    "metrics/payments/offers_metrics.h",
    "metrics/payments/payments_window_metrics.cc",
    "metrics/payments/payments_window_metrics.h",
    "metrics/payments/risk_data_metrics.cc",
    "metrics/payments/risk_data_metrics.h",
    "metrics/payments/virtual_card_enrollment_metrics.cc",
    "metrics/payments/virtual_card_enrollment_metrics.h",
    "metrics/payments/virtual_card_manual_fallback_bubble_metrics.cc",
    "metrics/payments/virtual_card_manual_fallback_bubble_metrics.h",
    "metrics/payments/virtual_card_standalone_cvc_suggestion_metrics.cc",
    "metrics/payments/virtual_card_standalone_cvc_suggestion_metrics.h",
    "metrics/payments/wallet_usage_data_metrics.cc",
    "metrics/payments/wallet_usage_data_metrics.h",
    "metrics/placeholder_metrics.cc",
    "metrics/placeholder_metrics.h",
    "metrics/profile_deduplication_metrics.cc",
    "metrics/profile_deduplication_metrics.h",
    "metrics/profile_import_metrics.cc",
    "metrics/profile_import_metrics.h",
    "metrics/profile_token_quality_metrics.cc",
    "metrics/profile_token_quality_metrics.h",
    "metrics/quality_metrics.cc",
    "metrics/quality_metrics.h",
    "metrics/quality_metrics_filling.cc",
    "metrics/quality_metrics_filling.h",
    "metrics/shadow_prediction_metrics.cc",
    "metrics/shadow_prediction_metrics.h",
    "metrics/stored_profile_metrics.cc",
    "metrics/stored_profile_metrics.h",
    "metrics/suggestions_list_metrics.cc",
    "metrics/suggestions_list_metrics.h",
    "payments/account_info_getter.h",
    "payments/autofill_error_dialog_context.cc",
    "payments/autofill_error_dialog_context.h",
    "payments/autofill_offer_manager.cc",
    "payments/autofill_offer_manager.h",
    "payments/autofill_payments_feature_availability.cc",
    "payments/autofill_payments_feature_availability.h",
    "payments/autofill_wallet_data_type_controller.cc",
    "payments/autofill_wallet_data_type_controller.h",
    "payments/card_unmask_delegate.cc",
    "payments/card_unmask_delegate.h",
    "payments/client_behavior_constants.h",
    "payments/constants.h",
    "payments/credit_card_access_manager.cc",
    "payments/credit_card_access_manager.h",
    "payments/credit_card_cvc_authenticator.cc",
    "payments/credit_card_cvc_authenticator.h",
    "payments/credit_card_otp_authenticator.cc",
    "payments/credit_card_otp_authenticator.h",
    "payments/credit_card_risk_based_authenticator.cc",
    "payments/credit_card_risk_based_authenticator.h",
    "payments/credit_card_save_manager.cc",
    "payments/credit_card_save_manager.h",
    "payments/full_card_request.cc",
    "payments/full_card_request.h",
    "payments/iban_access_manager.cc",
    "payments/iban_access_manager.h",
    "payments/iban_manager.cc",
    "payments/iban_manager.h",
    "payments/iban_save_manager.cc",
    "payments/iban_save_manager.h",
    "payments/mandatory_reauth_manager.cc",
    "payments/mandatory_reauth_manager.h",
    "payments/offer_notification_handler.cc",
    "payments/offer_notification_handler.h",
    "payments/offer_notification_options.h",
    "payments/otp_unmask_delegate.h",
    "payments/otp_unmask_result.h",
    "payments/payments_autofill_client.cc",
    "payments/payments_autofill_client.h",
    "payments/payments_customer_data.h",
    "payments/payments_data_cleaner.cc",
    "payments/payments_data_cleaner.h",
    "payments/payments_network_interface.cc",
    "payments/payments_network_interface.h",
    "payments/payments_network_interface_base.cc",
    "payments/payments_network_interface_base.h",
    "payments/payments_requests/get_card_upload_details_request.cc",
    "payments/payments_requests/get_card_upload_details_request.h",
    "payments/payments_requests/get_details_for_enrollment_request.cc",
    "payments/payments_requests/get_details_for_enrollment_request.h",
    "payments/payments_requests/get_iban_upload_details_request.cc",
    "payments/payments_requests/get_iban_upload_details_request.h",
    "payments/payments_requests/get_unmask_details_request.cc",
    "payments/payments_requests/get_unmask_details_request.h",
    "payments/payments_requests/opt_change_request.cc",
    "payments/payments_requests/opt_change_request.h",
    "payments/payments_requests/payments_request.cc",
    "payments/payments_requests/payments_request.h",
    "payments/payments_requests/select_challenge_option_request.cc",
    "payments/payments_requests/select_challenge_option_request.h",
    "payments/payments_requests/unmask_card_request.cc",
    "payments/payments_requests/unmask_card_request.h",
    "payments/payments_requests/unmask_iban_request.cc",
    "payments/payments_requests/unmask_iban_request.h",
    "payments/payments_requests/update_virtual_card_enrollment_request.cc",
    "payments/payments_requests/update_virtual_card_enrollment_request.h",
    "payments/payments_requests/upload_card_request.cc",
    "payments/payments_requests/upload_card_request.h",
    "payments/payments_requests/upload_iban_request.cc",
    "payments/payments_requests/upload_iban_request.h",
    "payments/payments_service_url.cc",
    "payments/payments_service_url.h",
    "payments/payments_util.cc",
    "payments/payments_util.h",
    "payments/payments_window_manager.cc",
    "payments/payments_window_manager.h",
    "payments/payments_window_manager_util.cc",
    "payments/payments_window_manager_util.h",
    "payments/risk_data_loader.h",
    "payments/virtual_card_enroll_metrics_logger.cc",
    "payments/virtual_card_enroll_metrics_logger.h",
    "payments/virtual_card_enrollment_flow.h",
    "payments/virtual_card_enrollment_manager.cc",
    "payments/virtual_card_enrollment_manager.h",
    "payments/wait_for_signal_or_timeout.cc",
    "payments/wait_for_signal_or_timeout.h",
    "payments/webauthn_callback_types.h",
    "payments_data_manager.cc",
    "payments_data_manager.h",
    "payments_suggestion_generator.cc",
    "payments_suggestion_generator.h",
    "personal_data_manager.cc",
    "personal_data_manager.h",
    "personal_data_manager_observer.h",
    "profile_requirement_utils.cc",
    "profile_requirement_utils.h",
    "profile_token_quality.cc",
    "profile_token_quality.h",
    "randomized_encoder.cc",
    "randomized_encoder.h",
    "rationalization_util.cc",
    "rationalization_util.h",
    "select_control_util.cc",
    "select_control_util.h",
    "single_field_form_fill_router.cc",
    "single_field_form_fill_router.h",
    "single_field_form_filler.cc",
    "single_field_form_filler.h",
    "strike_databases/address_suggestion_strike_database.cc",
    "strike_databases/address_suggestion_strike_database.h",
    "strike_databases/autofill_profile_migration_strike_database.h",
    "strike_databases/autofill_profile_save_strike_database.h",
    "strike_databases/autofill_profile_update_strike_database.h",
    "strike_databases/history_clearable_strike_database.h",
    "strike_databases/payments/credit_card_save_strike_database.h",
    "strike_databases/payments/cvc_storage_strike_database.cc",
    "strike_databases/payments/cvc_storage_strike_database.h",
    "strike_databases/payments/iban_save_strike_database.h",
    "strike_databases/payments/virtual_card_enrollment_strike_database.cc",
    "strike_databases/payments/virtual_card_enrollment_strike_database.h",
    "strike_databases/simple_autofill_strike_database.h",
    "strike_databases/strike_database.cc",
    "strike_databases/strike_database.h",
    "strike_databases/strike_database_base.cc",
    "strike_databases/strike_database_base.h",
    "strike_databases/strike_database_integrator_base.cc",
    "strike_databases/strike_database_integrator_base.h",
    "strike_databases/strike_database_integrator_test_strike_database.cc",
    "strike_databases/strike_database_integrator_test_strike_database.h",
    "suggestions_context.cc",
    "suggestions_context.h",
    "ui/address_combobox_model.cc",
    "ui/address_combobox_model.h",
    "ui/autofill_image_fetcher_base.h",
    "ui/autofill_resource_utils.cc",
    "ui/autofill_resource_utils.h",
    "ui/autofill_suggestion_delegate.h",
    "ui/country_combobox_model.cc",
    "ui/country_combobox_model.h",
    "ui/fast_checkout_client.h",
    "ui/fast_checkout_delegate.h",
    "ui/fast_checkout_enums.h",
    "ui/payments/autofill_error_dialog_controller.h",
    "ui/payments/autofill_error_dialog_controller_impl.cc",
    "ui/payments/autofill_error_dialog_controller_impl.h",
    "ui/payments/autofill_error_dialog_view.h",
    "ui/payments/autofill_progress_dialog_controller.h",
    "ui/payments/autofill_progress_dialog_controller_impl.cc",
    "ui/payments/autofill_progress_dialog_controller_impl.h",
    "ui/payments/autofill_progress_dialog_view.h",
    "ui/payments/bubble_show_options.cc",
    "ui/payments/bubble_show_options.h",
    "ui/payments/card_unmask_authentication_selection_dialog.h",
    "ui/payments/card_unmask_authentication_selection_dialog_controller.h",
    "ui/payments/card_unmask_authentication_selection_dialog_controller_impl.cc",
    "ui/payments/card_unmask_authentication_selection_dialog_controller_impl.h",
    "ui/payments/card_unmask_otp_input_dialog_controller.h",
    "ui/payments/card_unmask_otp_input_dialog_controller_impl.cc",
    "ui/payments/card_unmask_otp_input_dialog_controller_impl.h",
    "ui/payments/card_unmask_otp_input_dialog_view.h",
    "ui/payments/card_unmask_prompt_controller.h",
    "ui/payments/card_unmask_prompt_controller_impl.cc",
    "ui/payments/card_unmask_prompt_controller_impl.h",
    "ui/payments/card_unmask_prompt_options.cc",
    "ui/payments/card_unmask_prompt_options.h",
    "ui/payments/card_unmask_prompt_view.h",
    "ui/payments/payments_bubble_closed_reasons.h",
    "ui/payments/payments_window_user_consent_dialog.h",
    "ui/payments/payments_window_user_consent_dialog_controller.h",
    "ui/payments/payments_window_user_consent_dialog_controller_impl.cc",
    "ui/payments/payments_window_user_consent_dialog_controller_impl.h",
    "ui/payments/save_payment_method_and_virtual_card_enroll_confirmation_ui_params.cc",
    "ui/payments/save_payment_method_and_virtual_card_enroll_confirmation_ui_params.h",
    "ui/payments/virtual_card_enroll_bubble_controller.h",
    "ui/payments/virtual_card_enroll_ui_model.cc",
    "ui/payments/virtual_card_enroll_ui_model.h",
    "ui/popup_interaction.h",
    "ui/popup_open_enums.h",
    "ui/region_combobox_model.cc",
    "ui/region_combobox_model.h",
    "ui/suggestion.cc",
    "ui/suggestion.h",
    "ui/suggestion_button_action.h",
    "ui/suggestion_hiding_reason.h",
    "ui/suggestion_type.cc",
    "ui/suggestion_type.h",
    "ui/touch_to_fill_delegate.h",
    "validation.cc",
    "validation.h",
    "webdata/addresses/address_autofill_table.cc",
    "webdata/addresses/address_autofill_table.h",
    "webdata/addresses/autofill_profile_sync_bridge.cc",
    "webdata/addresses/autofill_profile_sync_bridge.h",
    "webdata/addresses/autofill_profile_sync_difference_tracker.cc",
    "webdata/addresses/autofill_profile_sync_difference_tracker.h",
    "webdata/addresses/autofill_profile_sync_util.cc",
    "webdata/addresses/autofill_profile_sync_util.h",
    "webdata/addresses/contact_info_data_type_controller.cc",
    "webdata/addresses/contact_info_data_type_controller.h",
    "webdata/addresses/contact_info_precondition_checker.cc",
    "webdata/addresses/contact_info_precondition_checker.h",
    "webdata/addresses/contact_info_sync_bridge.cc",
    "webdata/addresses/contact_info_sync_bridge.h",
    "webdata/addresses/contact_info_sync_util.cc",
    "webdata/addresses/contact_info_sync_util.h",
    "webdata/autocomplete/autocomplete_entry.cc",
    "webdata/autocomplete/autocomplete_entry.h",
    "webdata/autocomplete/autocomplete_sync_bridge.cc",
    "webdata/autocomplete/autocomplete_sync_bridge.h",
    "webdata/autocomplete/autocomplete_table.cc",
    "webdata/autocomplete/autocomplete_table.h",
    "webdata/autofill_change.cc",
    "webdata/autofill_change.h",
    "webdata/autofill_sync_metadata_table.cc",
    "webdata/autofill_sync_metadata_table.h",
    "webdata/autofill_table_encryptor.h",
    "webdata/autofill_table_encryptor_factory.cc",
    "webdata/autofill_table_encryptor_factory.h",
    "webdata/autofill_table_utils.cc",
    "webdata/autofill_table_utils.h",
    "webdata/autofill_webdata_backend.h",
    "webdata/autofill_webdata_backend_impl.cc",
    "webdata/autofill_webdata_backend_impl.h",
    "webdata/autofill_webdata_service.cc",
    "webdata/autofill_webdata_service.h",
    "webdata/autofill_webdata_service_observer.h",
    "webdata/payments/autofill_wallet_credential_sync_bridge.cc",
    "webdata/payments/autofill_wallet_credential_sync_bridge.h",
    "webdata/payments/autofill_wallet_metadata_sync_bridge.cc",
    "webdata/payments/autofill_wallet_metadata_sync_bridge.h",
    "webdata/payments/autofill_wallet_offer_sync_bridge.cc",
    "webdata/payments/autofill_wallet_offer_sync_bridge.h",
    "webdata/payments/autofill_wallet_sync_bridge.cc",
    "webdata/payments/autofill_wallet_sync_bridge.h",
    "webdata/payments/autofill_wallet_usage_data_sync_bridge.cc",
    "webdata/payments/autofill_wallet_usage_data_sync_bridge.h",
    "webdata/payments/payments_autofill_table.cc",
    "webdata/payments/payments_autofill_table.h",
    "webdata/payments/payments_sync_bridge_util.cc",
    "webdata/payments/payments_sync_bridge_util.h",
    "webdata/system_encryptor.cc",
    "webdata/system_encryptor.h",
  ]

  sources += get_target_outputs(":regex_patterns_inl_h")

  if (is_ios) {
    sources += [
      "autofill_save_update_address_profile_delegate_ios.cc",
      "autofill_save_update_address_profile_delegate_ios.h",
    ]
  }

  if (is_android) {
    sources += [
      "payments/autofill_save_iban_ui_info.cc",
      "payments/autofill_save_iban_ui_info.h",
    ]
  }

  if (is_ios || is_android) {
    sources += [
      "payments/autofill_save_card_delegate.cc",
      "payments/autofill_save_card_delegate.h",
      "payments/autofill_save_card_infobar_delegate_mobile.cc",
      "payments/autofill_save_card_infobar_delegate_mobile.h",
      "payments/autofill_save_card_infobar_mobile.h",
      "payments/autofill_save_card_ui_info.cc",
      "payments/autofill_save_card_ui_info.h",
      "payments/autofill_virtual_card_enrollment_infobar_delegate_mobile.cc",
      "payments/autofill_virtual_card_enrollment_infobar_delegate_mobile.h",
      "payments/autofill_virtual_card_enrollment_infobar_mobile.h",
      "ui/payments/card_expiration_date_fix_flow_controller.h",
      "ui/payments/card_expiration_date_fix_flow_controller_impl.cc",
      "ui/payments/card_expiration_date_fix_flow_controller_impl.h",
      "ui/payments/card_expiration_date_fix_flow_view.h",
      "ui/payments/card_name_fix_flow_controller.h",
      "ui/payments/card_name_fix_flow_controller_impl.cc",
      "ui/payments/card_name_fix_flow_controller_impl.h",
      "ui/payments/card_name_fix_flow_view.h",
    ]
  }

  if (!is_ios) {
    sources += [
      "autofill_policy_handler.cc",
      "autofill_policy_handler.h",
      "payments/credit_card_fido_authenticator.cc",
      "payments/credit_card_fido_authenticator.h",
      "strike_databases/payments/fido_authentication_strike_database.h",
    ]
  }

  if (!is_android) {
    sources += [
      "ui/autofill_image_fetcher.cc",
      "ui/autofill_image_fetcher.h",
    ]
  }

  if (build_with_tflite_lib) {
    sources += [
      "ml_model/autofill_ml_prediction_model_handler.cc",
      "ml_model/autofill_ml_prediction_model_handler.h",
      "ml_model/autofill_model_encoder.cc",
      "ml_model/autofill_model_encoder.h",
      "ml_model/autofill_model_executor.cc",
      "ml_model/autofill_model_executor.h",
    ]
  }

  defines = [ "CHROME_VERSION_MAJOR=" + chrome_version_major ]

  configs += [
    "//build/config:precompiled_headers",
    "//build/config/compiler:wexit_time_destructors",
  ]

  public_deps = [
    ":legal_message_line",
    "//components/autofill/core/browser/payments:card_unmask_challenge_option",
    "//components/autofill/core/browser/proto",
    "//components/autofill/core/common",
    "//components/autofill/core/common/mojom:mojo_types",
    "//components/leveldb_proto",
    "//components/resources",
    "//components/security_interstitials/core",
    "//components/security_state/core",
    "//components/translate/core/browser",
    "//skia",
    "//third_party/abseil-cpp:absl",
    "//third_party/libaddressinput",
    "//third_party/libaddressinput:strings_grit",
    "//ui/base",
    "//ui/gfx/geometry",
    "//ui/gfx/range",
    "//url",
  ]

  if (build_with_tflite_lib) {
    public_deps += [
      "//third_party/tflite",
      "//third_party/tflite:tflite_public_headers",
      "//third_party/tflite_support",
      "//third_party/tflite_support:tflite_support_proto",
    ]
  }

  deps = [
    ":autofill_address_rewriter_resources",
    ":buildflags",
    ":regex_patterns_inl_h",
    "//base",
    "//base:i18n",
    "//build:branding_buildflags",
    "//build:chromeos_buildflags",
    "//components/autofill/core/common:autofill_regex",
    "//components/autofill/core/common:credit_card_number_validation",
    "//components/crash/core/common:crash_key",
    "//components/device_reauth",
    "//components/feature_engagement",
    "//components/google/core/common",
    "//components/history/core/browser",
    "//components/image_fetcher/core",
    "//components/infobars/core",
    "//components/keyed_service/core",
    "//components/language/core/browser",
    "//components/optimization_guide:machine_learning_tflite_buildflags",
    "//components/optimization_guide/core",
    "//components/optimization_guide/proto:optimization_guide_proto",
    "//components/os_crypt/sync",
    "//components/policy/core/browser",
    "//components/policy/core/common",
    "//components/pref_registry",
    "//components/prefs",
    "//components/profile_metrics",
    "//components/security_interstitials/core:insecure_form_util",
    "//components/signin/public/base",
    "//components/signin/public/identity_manager",
    "//components/strings",
    "//components/sync",
    "//components/translate/core/common",
    "//components/variations",
    "//components/variations/net",
    "//components/version_info",
    "//components/webdata/common",
    "//crypto",
    "//google_apis",
    "//google_apis/common:request_util",
    "//net",
    "//services/data_decoder/public/cpp:cpp",
    "//services/metrics/public/cpp:metrics_cpp",
    "//services/metrics/public/cpp:ukm_builders",
    "//services/network/public/cpp",
    "//services/network/public/mojom",
    "//third_party/icu",
    "//third_party/libphonenumber",
    "//third_party/re2",
    "//third_party/zlib/google:compression_utils",
    "//ui/accessibility:accessibility",
  ]

  if (use_blink) {
    deps += [
      "//components/webauthn/core/browser",
      "//third_party/blink/public/common",
    ]
  }

  if (is_android) {
    deps += [
      "//components/autofill/android:main_autofill_jni_headers",
      "//components/messages/android:feature_flags",
      "//components/resources:android_resources",
    ]
  }

  if (is_ios || is_android) {
    deps += [ "//components/strings" ]
  }

  if (!is_android && !is_ios) {
    sources += [
      "payments/local_card_migration_manager.cc",
      "payments/local_card_migration_manager.h",
      "payments/payments_requests/migrate_cards_request.cc",
      "payments/payments_requests/migrate_cards_request.h",
      "server_prediction_overrides.cc",
      "server_prediction_overrides.h",
      "strike_databases/payments/local_card_migration_strike_database.h",
      "ui/payments/local_card_migration_bubble_controller.h",
      "ui/payments/local_card_migration_dialog_controller.h",
    ]
    deps += [
      "//ui/native_theme",
      "//ui/native_theme:native_theme_browser",
    ]
  }

  if (is_ios) {
    deps += [ "//components/autofill/ios/common" ]
  }
}

static_library("legal_message_line") {
  sources = [
    "payments/legal_message_line.cc",
    "payments/legal_message_line.h",
  ]
  deps = [
    "//base",
    "//base:i18n",
    "//ui/gfx/range",
    "//url",
  ]
  configs += [ "//build/config/compiler:wexit_time_destructors" ]
}

static_library("test_support") {
  testonly = true
  sources = [
    "address_data_cleaner_test_api.h",
    "address_data_manager_test_api.h",
    "autofill_driver_factory_test_api.cc",
    "autofill_driver_factory_test_api.h",
    "autofill_driver_test_api.h",
    "autofill_form_test_utils.cc",
    "autofill_form_test_utils.h",
    "autofill_manager_test_api.h",
    "autofill_test_utils.cc",
    "autofill_test_utils.h",
    "autofill_testing_pref_service.cc",
    "autofill_testing_pref_service.h",
    "browser_autofill_manager_test_api.cc",
    "browser_autofill_manager_test_api.h",
    "browser_autofill_manager_test_delegate.cc",
    "browser_autofill_manager_test_delegate.h",
    "crowdsourcing/autofill_crowdsourcing_manager_test_api.h",
    "crowdsourcing/mock_autofill_crowdsourcing_manager.cc",
    "crowdsourcing/mock_autofill_crowdsourcing_manager.h",
    "data_model/autofill_profile_test_api.cc",
    "data_model/autofill_profile_test_api.h",
    "data_model/autofill_structured_address_component_test_api.h",
    "data_model/autofill_structured_address_test_utils.cc",
    "data_model/autofill_structured_address_test_utils.h",
    "data_model/credit_card_benefit_test_api.h",
    "data_model/test_autofill_data_model.cc",
    "data_model/test_autofill_data_model.h",
    "form_data_importer_test_api.h",
    "form_filler_test_api.h",
    "form_forest_test_api.cc",
    "form_forest_test_api.h",
    "form_structure_test_api.cc",
    "form_structure_test_api.h",
    "geo/alternative_state_name_map_test_utils.cc",
    "geo/alternative_state_name_map_test_utils.h",
    "geo/mock_alternative_state_name_map_updater.cc",
    "geo/mock_alternative_state_name_map_updater.h",
    "geo/test_region_data_loader.cc",
    "geo/test_region_data_loader.h",
    "logging/stub_log_manager.cc",
    "logging/stub_log_manager.h",
    "metrics/autofill_metrics_test_base.cc",
    "metrics/autofill_metrics_test_base.h",
    "metrics/ukm_metrics_test_utils.cc",
    "metrics/ukm_metrics_test_utils.h",
    "mock_autocomplete_history_manager.cc",
    "mock_autocomplete_history_manager.h",
    "mock_autofill_compose_delegate.cc",
    "mock_autofill_compose_delegate.h",
    "mock_autofill_manager.cc",
    "mock_autofill_manager.h",
    "mock_autofill_manager_observer.cc",
    "mock_autofill_manager_observer.h",
    "mock_autofill_optimization_guide.cc",
    "mock_autofill_optimization_guide.h",
    "mock_autofill_plus_address_delegate.cc",
    "mock_autofill_plus_address_delegate.h",
    "mock_autofill_prediction_improvements_delegate.cc",
    "mock_autofill_prediction_improvements_delegate.h",
    "mock_merchant_promo_code_manager.cc",
    "mock_merchant_promo_code_manager.h",
    "mock_single_field_form_fill_router.cc",
    "mock_single_field_form_fill_router.h",
    "payments/credit_card_access_manager_test_api.h",
    "payments/mock_iban_access_manager.cc",
    "payments/mock_iban_access_manager.h",
    "payments/mock_test_payments_network_interface.cc",
    "payments/mock_test_payments_network_interface.h",
    "payments/payments_network_interface_test_base.cc",
    "payments/payments_network_interface_test_base.h",
    "payments/test/autofill_payments_test_utils.cc",
    "payments/test/autofill_payments_test_utils.h",
    "payments/test/mock_iban_manager.cc",
    "payments/test/mock_iban_manager.h",
    "payments/test/mock_mandatory_reauth_manager.cc",
    "payments/test/mock_mandatory_reauth_manager.h",
    "payments/test/mock_payments_window_manager.cc",
    "payments/test/mock_payments_window_manager.h",
    "payments/test/test_credit_card_otp_authenticator.cc",
    "payments/test/test_credit_card_otp_authenticator.h",
    "payments/test/test_credit_card_risk_based_authenticator.cc",
    "payments/test/test_credit_card_risk_based_authenticator.h",
    "payments/test_authentication_requester.cc",
    "payments/test_authentication_requester.h",
    "payments/test_credit_card_save_manager.cc",
    "payments/test_credit_card_save_manager.h",
    "payments/test_legal_message_line.h",
    "payments/test_payments_autofill_client.cc",
    "payments/test_payments_autofill_client.h",
    "payments/test_payments_network_interface.cc",
    "payments/test_payments_network_interface.h",
    "payments/test_virtual_card_enrollment_manager.cc",
    "payments/test_virtual_card_enrollment_manager.h",
    "payments_data_manager_test_api.cc",
    "payments_data_manager_test_api.h",
    "personal_data_manager_test_utils.cc",
    "personal_data_manager_test_utils.h",
    "profile_token_quality_test_api.cc",
    "profile_token_quality_test_api.h",
    "strike_databases/payments/test_credit_card_save_strike_database.cc",
    "strike_databases/payments/test_credit_card_save_strike_database.h",
    "strike_databases/payments/test_strike_database.cc",
    "strike_databases/payments/test_strike_database.h",
    "strike_databases/test_inmemory_strike_database.cc",
    "strike_databases/test_inmemory_strike_database.h",
    "test_address_data_manager.cc",
    "test_address_data_manager.h",
    "test_address_normalizer.cc",
    "test_address_normalizer.h",
    "test_autofill_client.cc",
    "test_autofill_client.h",
    "test_autofill_clock.cc",
    "test_autofill_clock.h",
    "test_autofill_driver.cc",
    "test_autofill_driver.h",
    "test_autofill_external_delegate.cc",
    "test_autofill_external_delegate.h",
    "test_autofill_manager_waiter.cc",
    "test_autofill_manager_waiter.h",
    "test_browser_autofill_manager.cc",
    "test_browser_autofill_manager.h",
    "test_event_waiter.h",
    "test_form_data_importer.cc",
    "test_form_data_importer.h",
    "test_form_filler.cc",
    "test_form_filler.h",
    "test_payments_data_manager.cc",
    "test_payments_data_manager.h",
    "test_personal_data_manager.cc",
    "test_personal_data_manager.h",
    "test_utils/test_profiles.cc",
    "test_utils/test_profiles.h",
    "test_utils/vote_uploads_test_matchers.h",
    "ui/mock_autofill_suggestion_delegate.cc",
    "ui/mock_autofill_suggestion_delegate.h",
    "ui/mock_fast_checkout_client.cc",
    "ui/mock_fast_checkout_client.h",
    "ui/payments/virtual_card_enroll_ui_model_test_api.h",
    "ui/suggestion_test_helpers.cc",
    "ui/suggestion_test_helpers.h",
    "webdata/mock_autofill_webdata_backend.cc",
    "webdata/mock_autofill_webdata_backend.h",
    "webdata/mock_autofill_webdata_service.cc",
    "webdata/mock_autofill_webdata_service.h",
    "webdata/payments/payments_sync_bridge_test_util.cc",
    "webdata/payments/payments_sync_bridge_test_util.h",
  ]

  public_deps = [
    ":browser",
    "//components/autofill/core/common:test_support",
  ]

  deps = [
    ":autofill_address_rewriter_resources",
    "//base",
    "//base/test:test_support",
    "//components/autofill/core/browser",
    "//components/autofill/core/common",
    "//components/autofill/core/common:credit_card_number_validation",
    "//components/device_reauth:test_support",
    "//components/feature_engagement",
    "//components/leveldb_proto",
    "//components/optimization_guide:machine_learning_tflite_buildflags",
    "//components/os_crypt/sync",
    "//components/os_crypt/sync:test_support",
    "//components/pref_registry",
    "//components/prefs:test_support",
    "//components/signin/public/identity_manager:test_support",
    "//components/sync:test_support",
    "//components/translate/core/browser",
    "//components/translate/core/browser:test_support",
    "//components/ukm",
    "//components/ukm:test_support",
    "//components/variations",
    "//components/variations:test_support",
    "//components/variations/net",
    "//components/version_info:version_info",
    "//components/webdata/common",
    "//google_apis:test_support",
    "//services/network:test_support",
    "//services/network/public/cpp",
    "//skia",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/libaddressinput:test_support",
    "//third_party/libaddressinput:util",
    "//third_party/re2:re2",
    "//ui/accessibility",
    "//ui/gfx:test_support",
    "//ui/gfx/geometry",
  ]

  if (use_blink) {
    sources += [
      "payments/test_credit_card_fido_authenticator.cc",
      "payments/test_credit_card_fido_authenticator.h",
      "payments/test_internal_authenticator.cc",
      "payments/test_internal_authenticator.h",
    ]

    public_deps += [ "//components/autofill/content/browser" ]

    deps += [
      "//components/webauthn/core/browser",
      "//third_party/blink/public/common",
    ]
  }

  if (!is_ios && !is_android) {
    sources += [
      "payments/test_local_card_migration_manager.cc",
      "payments/test_local_card_migration_manager.h",
    ]
  }
}

bundle_data("unit_tests_bundle_data") {
  sources = [
    "//components/test/data/autofill/merge/input/addressLinesLessInfo.in",
    "//components/test/data/autofill/merge/input/addressLinesMoreInfo.in",
    "//components/test/data/autofill/merge/input/ambiguous.in",
    "//components/test/data/autofill/merge/input/case.in",
    "//components/test/data/autofill/merge/input/email.in",
    "//components/test/data/autofill/merge/input/identical.in",
    "//components/test/data/autofill/merge/input/moreInfo.in",
    "//components/test/data/autofill/merge/input/names.in",
    "//components/test/data/autofill/merge/input/primarycase.in",
    "//components/test/data/autofill/merge/input/punctuation.in",
    "//components/test/data/autofill/merge/input/singlemerge.in",
    "//components/test/data/autofill/merge/input/streetaddress.in",
    "//components/test/data/autofill/merge/input/validation.in",
    "//components/test/data/autofill/merge/output/addressLinesLessInfo.out",
    "//components/test/data/autofill/merge/output/addressLinesMoreInfo.out",
    "//components/test/data/autofill/merge/output/ambiguous.out",
    "//components/test/data/autofill/merge/output/case.out",
    "//components/test/data/autofill/merge/output/email.out",
    "//components/test/data/autofill/merge/output/identical.out",
    "//components/test/data/autofill/merge/output/moreInfo.out",
    "//components/test/data/autofill/merge/output/names.out",
    "//components/test/data/autofill/merge/output/primarycase.out",
    "//components/test/data/autofill/merge/output/punctuation.out",
    "//components/test/data/autofill/merge/output/singlemerge.out",
    "//components/test/data/autofill/merge/output/streetaddress.out",
    "//components/test/data/autofill/merge/output/validation.out",
    "//components/test/data/autofill/ml_model/autofill_model-fold-one.tflite",
    "//components/test/data/autofill/ml_model/autofill_model_metadata.binarypb",
  ]
  outputs = [ "{{bundle_resources_dir}}/" +
              "{{source_root_relative_dir}}/{{source_file_part}}" ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "address_data_cleaner_unittest.cc",
    "address_data_manager_unittest.cc",
    "address_normalization_manager_unittest.cc",
    "address_normalizer_impl_unittest.cc",
    "address_profile_save_manager_unittest.cc",
    "address_suggestion_generator_unittest.cc",
    "autocomplete_history_manager_unittest.cc",
    "autofill_ablation_study_unittest.cc",
    "autofill_address_util_unittest.cc",
    "autofill_data_util_unittest.cc",
    "autofill_experiments_unittest.cc",
    "autofill_external_delegate_unittest.cc",
    "autofill_feedback_data_unittest.cc",
    "autofill_field_unittest.cc",
    "autofill_granular_filling_utils_unittest.cc",
    "autofill_manager_unittest.cc",
    "autofill_merge_unittest.cc",
    "autofill_optimization_guide_unittest.cc",
    "autofill_profile_import_process_unittest.cc",
    "autofill_type_unittest.cc",
    "browser_autofill_manager_unittest.cc",
    "crowdsourcing/autofill_crowdsourcing_encoding_unittest.cc",
    "crowdsourcing/autofill_crowdsourcing_manager_unittest.cc",
    "crowdsourcing/determine_possible_field_types_unittest.cc",
    "crowdsourcing/disambiguate_possible_field_types_unittest.cc",
    "data_model/address_unittest.cc",
    "data_model/autofill_data_model_unittest.cc",
    "data_model/autofill_i18n_api_unittest.cc",
    "data_model/autofill_i18n_parsing_expression_components_unittest.cc",
    "data_model/autofill_profile_comparator_unittest.cc",
    "data_model/autofill_profile_unittest.cc",
    "data_model/autofill_structured_address_component_unittest.cc",
    "data_model/autofill_structured_address_format_provider_unittest.cc",
    "data_model/autofill_structured_address_name_unittest.cc",
    "data_model/autofill_structured_address_regex_provider_unittest.cc",
    "data_model/autofill_structured_address_unittest.cc",
    "data_model/autofill_structured_address_utils_unittest.cc",
    "data_model/bank_account_unittest.cc",
    "data_model/borrowed_transliterator_unittest.cc",
    "data_model/contact_info_unittest.cc",
    "data_model/credit_card_benefit_unittest.cc",
    "data_model/credit_card_unittest.cc",
    "data_model/ewallet_unittest.cc",
    "data_model/iban_unittest.cc",
    "data_model/payment_instrument_unittest.cc",
    "data_model/phone_number_unittest.cc",
    "field_filling_address_util_unittest.cc",
    "field_filling_payments_util_unittest.cc",
    "field_type_utils_unittest.cc",
    "field_types_unittest.cc",
    "form_autofill_history_unittest.cc",
    "form_data_importer_unittest.cc",
    "form_data_importer_utils_unittest.cc",
    "form_filler_unittest.cc",
    "form_forest_unittest.cc",
    "form_parsing/address_field_parser_ng_unittest.cc",
    "form_parsing/address_field_parser_unittest.cc",
    "form_parsing/credit_card_field_parser_unittest.cc",
    "form_parsing/email_field_parser_unittest.cc",
    "form_parsing/field_candidates_unittest.cc",
    "form_parsing/form_field_parser_unittest.cc",
    "form_parsing/iban_field_parser_unittest.cc",
    "form_parsing/merchant_promo_code_field_parser_unittest.cc",
    "form_parsing/name_field_parser_unittest.cc",
    "form_parsing/numeric_quantity_field_parser_unittest.cc",
    "form_parsing/parsing_test_utils.cc",
    "form_parsing/parsing_test_utils.h",
    "form_parsing/phone_field_parser_unittest.cc",
    "form_parsing/price_field_parser_unittest.cc",
    "form_parsing/regex_patterns_unittest.cc",
    "form_parsing/search_field_parser_unittest.cc",
    "form_parsing/standalone_cvc_field_parser_unittest.cc",
    "form_processing/label_processing_util_unittest.cc",
    "form_processing/name_processing_util_unittest.cc",
    "form_structure_rationalization_engine_unittest.cc",
    "form_structure_rationalizer_unittest.cc",
    "form_structure_sectioning_util_unittest.cc",
    "form_structure_unittest.cc",
    "form_types_unittest.cc",
    "geo/address_i18n_unittest.cc",
    "geo/address_rewriter_unittest.cc",
    "geo/alternative_state_name_map_unittest.cc",
    "geo/alternative_state_name_map_updater_unittest.cc",
    "geo/autofill_country_unittest.cc",
    "geo/country_names_for_locale_unittest.cc",
    "geo/country_names_unittest.cc",
    "geo/phone_number_i18n_unittest.cc",
    "geo/subkey_requester_unittest.cc",
    "heuristic_source_unittest.cc",
    "logging/log_buffer_submitter_unittest.cc",
    "logging/log_manager_unittest.cc",
    "logging/log_router_unittest.cc",
    "logging/text_log_receiver_unittest.cc",
    "manual_testing_import_unittest.cc",
    "merchant_promo_code_manager_unittest.cc",
    "metrics/autofill_metrics_unittest.cc",
    "metrics/autofill_metrics_utils_unittest.cc",
    "metrics/autofill_settings_metrics_unittest.cc",
    "metrics/fallback_autocomplete_unrecognized_metrics_unittest.cc",
    "metrics/field_filling_stats_and_score_metrics_unittest.cc",
    "metrics/form_events/address_form_event_logger_unittest.cc",
    "metrics/form_events/form_event_logger_base_unittest.cc",
    "metrics/manual_fallback_metrics_unittest.cc",
    "metrics/payments/card_metadata_metrics_unittest.cc",
    "metrics/payments/cvc_storage_metrics_unittest.cc",
    "metrics/payments/iban_metrics_unittest.cc",
    "metrics/payments/offers_metrics_unittest.cc",
    "metrics/payments/virtual_card_standalone_cvc_suggestion_metrics_unittest.cc",
    "metrics/payments/wallet_usage_data_metrics_unittest.cc",
    "metrics/placeholder_metrics_unittest.cc",
    "metrics/profile_deduplication_metrics_unittest.cc",
    "metrics/profile_import_metrics_unittest.cc",
    "metrics/profile_token_quality_metrics_unittest.cc",
    "metrics/quality_metrics_filling_unittest.cc",
    "metrics/quality_metrics_unittest.cc",
    "metrics/shadow_prediction_metrics_unittest.cc",
    "metrics/stored_profile_metrics_unittest.cc",
    "metrics/suggestions_list_metrics_unittest.cc",
    "payments/autofill_offer_manager_unittest.cc",
    "payments/credit_card_access_manager_unittest.cc",
    "payments/credit_card_cvc_authenticator_unittest.cc",
    "payments/credit_card_otp_authenticator_unittest.cc",
    "payments/credit_card_risk_based_authenticator_unittest.cc",
    "payments/credit_card_save_manager_unittest.cc",
    "payments/full_card_request_unittest.cc",
    "payments/iban_access_manager_unittest.cc",
    "payments/iban_manager_unittest.cc",
    "payments/iban_save_manager_unittest.cc",
    "payments/legal_message_line_unittest.cc",
    "payments/payments_data_cleaner_unittest.cc",
    "payments/payments_network_interface_unittest.cc",
    "payments/payments_requests/get_card_upload_details_request_unittest.cc",
    "payments/payments_requests/get_details_for_enrollment_request_unittest.cc",
    "payments/payments_requests/get_iban_upload_details_request_unittest.cc",
    "payments/payments_requests/unmask_card_request_unittest.cc",
    "payments/payments_requests/unmask_iban_request_unittest.cc",
    "payments/payments_requests/update_virtual_card_enrollment_request_unittest.cc",
    "payments/payments_requests/upload_card_request_unittest.cc",
    "payments/payments_requests/upload_iban_request_unittest.cc",
    "payments/payments_service_url_unittest.cc",
    "payments/payments_util_unittest.cc",
    "payments/virtual_card_enroll_metrics_logger_unittest.cc",
    "payments/virtual_card_enrollment_manager_unittest.cc",
    "payments/wait_for_signal_or_timeout_unittest.cc",
    "payments_data_manager_test_base.cc",
    "payments_data_manager_test_base.h",
    "payments_data_manager_unittest.cc",
    "payments_suggestion_generator_unittest.cc",
    "profile_requirement_utils_unittest.cc",
    "profile_token_quality_unittest.cc",
    "randomized_encoder_unittest.cc",
    "rationalization_util_unittest.cc",
    "select_control_util_unittest.cc",
    "single_field_form_fill_router_unittest.cc",
    "strike_databases/history_clearable_strike_database_unittest.cc",
    "strike_databases/payments/virtual_card_enrollment_strike_database_unittest.cc",
    "strike_databases/simple_autofill_strike_database_unittest.cc",
    "strike_databases/strike_database_integrator_test_strike_database_unittest.cc",
    "strike_databases/strike_database_unittest.cc",
    "ui/address_combobox_model_unittest.cc",
    "ui/country_combobox_model_unittest.cc",
    "ui/payments/autofill_error_dialog_controller_impl_unittest.cc",
    "ui/payments/autofill_progress_dialog_controller_impl_unittest.cc",
    "ui/payments/bubble_show_options_unittest.cc",
    "ui/payments/card_unmask_otp_input_dialog_controller_impl_unittest.cc",
    "ui/payments/card_unmask_prompt_controller_impl_unittest.cc",
    "ui/payments/payments_window_user_consent_dialog_controller_impl_unittest.cc",
    "ui/payments/save_payment_method_and_virtual_card_enroll_confirmation_ui_params_unittest.cc",
    "ui/payments/virtual_card_enroll_ui_model_unittest.cc",
    "ui/region_combobox_model_unittest.cc",
    "validation_unittest.cc",
    "webdata/addresses/address_autofill_table_unittest.cc",
    "webdata/addresses/autofill_profile_sync_bridge_unittest.cc",
    "webdata/addresses/autofill_profile_sync_difference_tracker_unittest.cc",
    "webdata/addresses/autofill_profile_sync_util_unittest.cc",
    "webdata/addresses/contact_info_sync_bridge_unittest.cc",
    "webdata/addresses/contact_info_sync_util_unittest.cc",
    "webdata/autocomplete/autocomplete_sync_bridge_unittest.cc",
    "webdata/autocomplete/autocomplete_table_unittest.cc",
    "webdata/autofill_sync_metadata_table_unittest.cc",
    "webdata/payments/autofill_wallet_credential_sync_bridge_unittest.cc",
    "webdata/payments/autofill_wallet_metadata_sync_bridge_unittest.cc",
    "webdata/payments/autofill_wallet_offer_sync_bridge_unittest.cc",
    "webdata/payments/autofill_wallet_sync_bridge_unittest.cc",
    "webdata/payments/autofill_wallet_usage_data_sync_bridge_unittest.cc",
    "webdata/payments/payments_autofill_table_unittest.cc",
    "webdata/payments/payments_sync_bridge_util_unittest.cc",
    "webdata/web_data_service_unittest.cc",
  ]

  if (is_ios) {
    sources +=
        [ "autofill_save_update_address_profile_delegate_ios_unittest.cc" ]
  }

  if (is_android) {
    sources += [ "payments/autofill_save_iban_ui_info_unittest.cc" ]
  }

  if (is_ios || is_android) {
    sources += [
      "payments/autofill_save_card_delegate_unittest.cc",
      "payments/autofill_save_card_ui_info_unittest.cc",
      "ui/payments/card_expiration_date_fix_flow_controller_impl_unittest.cc",
      "ui/payments/card_name_fix_flow_controller_impl_unittest.cc",
    ]
  }

  if (!is_ios) {
    sources += [
      "autofill_policy_handler_unittest.cc",

      # Not included on iOS because the files need to be bundled specially.
      "heuristic_classification_unittests.cc",
    ]
  }

  if (!is_android) {
    sources += [ "ui/autofill_image_fetcher_unittest.cc" ]
  }

  if (is_win || is_mac || is_android) {
    sources += [
      "metrics/payments/better_auth_metrics_unittest.cc",
      "payments/credit_card_fido_authenticator_unittest.cc",
      "payments/mandatory_reauth_manager_unittest.cc",
    ]
  }

  if (!is_ios && !is_android) {
    sources += [
      "payments/local_card_migration_manager_unittest.cc",
      "payments/payments_requests/migrate_cards_request_unittest.cc",
      "server_prediction_overrides_unittest.cc",
    ]
  }

  if (build_with_tflite_lib) {
    sources += [
      "ml_model/autofill_ml_prediction_model_handler_unittest.cc",
      "ml_model/autofill_model_encoder_unittest.cc",
      "ml_model/autofill_model_executor_unittest.cc",
    ]
  }

  defines = [ "CHROME_VERSION_MAJOR=" + chrome_version_major ]

  deps = [
    ":autofill_address_rewriter_resources",
    ":browser",
    ":buildflags",
    ":regex_patterns_inl_h",
    ":test_support",
    ":unit_tests_bundle_data",
    "//base",
    "//base/test:test_support",
    "//build:chromeos_buildflags",
    "//components/autofill/core/common:autofill_regex",
    "//components/autofill/core/common:credit_card_number_validation",
    "//components/device_reauth:test_support",
    "//components/feature_engagement",
    "//components/history/core/browser",
    "//components/image_fetcher/core:core",
    "//components/image_fetcher/core:test_support",
    "//components/leveldb_proto",
    "//components/optimization_guide/core",
    "//components/optimization_guide/core:test_support",
    "//components/optimization_guide/proto:optimization_guide_proto",
    "//components/os_crypt/sync",
    "//components/os_crypt/sync:test_support",
    "//components/plus_addresses",
    "//components/policy/core/common",
    "//components/prefs:test_support",
    "//components/resources",
    "//components/search:search",
    "//components/security_state/core",
    "//components/signin/public/identity_manager:test_support",
    "//components/strings",
    "//components/sync",
    "//components/sync:test_support",
    "//components/translate/core/browser",
    "//components/translate/core/common",
    "//components/ukm",
    "//components/ukm:test_support",
    "//components/unified_consent",
    "//components/variations",
    "//components/variations:test_support",
    "//components/variations/net",
    "//components/version_info:version_info",
    "//components/webdata/common",
    "//google_apis",
    "//google_apis:test_support",
    "//google_apis/common:test_support",
    "//net:test_support",
    "//services/data_decoder/public/cpp:test_support",
    "//services/metrics/public/cpp:ukm_builders",
    "//services/network:test_support",
    "//services/network/public/cpp",
    "//testing/data_driven_testing",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/libaddressinput:test_support",
    "//third_party/libaddressinput:util",
    "//third_party/libphonenumber",
    "//third_party/re2:re2",
    "//ui/base",
    "//ui/base:test_support",
    "//ui/gfx:test_support",
    "//ui/resources",
    "//url",
  ]

  if (is_ios || is_android) {
    deps += [ "//build:branding_buildflags" ]
  }

  if (!is_ios && !is_android) {
    deps += [
      "//ui/native_theme",
      "//ui/native_theme:native_theme_browser",
    ]
  }

  if (use_blink) {
    deps += [
      "//content/test:test_support",
      "//third_party/blink/public/common",
    ]
  }

  if (is_ios) {
    deps += [ "//components/autofill/ios/common" ]
  }
}

fuzzer_test("form_structure_fuzzer") {
  sources = [ "form_structure_fuzzer.cc" ]
  deps = [
    # TODO(crbug.com/41421248): Reduce the dependency on "browser".
    ":browser",
    "//base",
    "//components:components_tests_pak",
    "//components/autofill/core/common",
    "//components/autofill/core/common:fuzzer_support",
    "//third_party/icu/fuzzers:fuzzer_support",
    "//ui/base",
    "//ui/resources:ui_test_pak",
  ]
  seed_corpus = "form_structure_fuzzer_corpus"
  dict = "form_structure_fuzzer.dict"
}

if (use_fuzzing_engine_with_lpm) {
  fuzzer_test("form_structure_process_query_response_fuzzer") {
    sources = [ "form_structure_process_query_response_fuzzer.cc" ]
    deps = [
      # TODO(crbug.com/41421248): Reduce the dependency on "browser".
      ":browser",
      "//base:base",
      "//components/autofill/core/browser",
      "//components/autofill/core/browser:test_support",
      "//components/autofill/core/browser/proto",
      "//components/autofill/core/common",
      "//third_party/libprotobuf-mutator",
    ]
  }
}

fuzzer_test("autofill_phone_number_i18n_fuzzer") {
  sources = [ "geo/phone_number_i18n_fuzzer.cc" ]

  deps = [
    # TODO(crbug.com/41421248): Reduce the dependency on "browser".
    ":browser",
    "//base",
    "//base:i18n",
    "//third_party/libphonenumber",
  ]

  dict = "geo/phone_number_i18n_fuzzer.dict"
}

fuzzer_test("autofill_legal_message_line_fuzzer") {
  sources = [ "payments/legal_message_line_fuzzer.cc" ]
  deps = [
    ":browser",
    "//base",
    "//third_party/abseil-cpp:absl",
  ]
}