chromium/components/autofill/core/common/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("//testing/libfuzzer/fuzzer_test.gni")

static_library("common") {
  sources = [
    "aliases.h",
    "autocomplete_parsing_util.cc",
    "autocomplete_parsing_util.h",
    "autofill_clock.cc",
    "autofill_clock.h",
    "autofill_constants.cc",
    "autofill_constants.h",
    "autofill_data_validation.cc",
    "autofill_data_validation.h",
    "autofill_internals/log_message.cc",
    "autofill_internals/log_message.h",
    "autofill_internals/logging_scope.cc",
    "autofill_internals/logging_scope.h",
    "autofill_l10n_util.cc",
    "autofill_l10n_util.h",
    "autofill_prefs.cc",
    "autofill_prefs.h",
    "autofill_switches.cc",
    "autofill_switches.h",
    "autofill_util.cc",
    "autofill_util.h",
    "dense_set.h",
    "field_data_manager.cc",
    "field_data_manager.h",
    "form_data.cc",
    "form_data.h",
    "form_data_predictions.cc",
    "form_data_predictions.h",
    "form_field_data.cc",
    "form_field_data.h",
    "form_field_data_predictions.cc",
    "form_field_data_predictions.h",
    "form_interactions_flow.h",
    "html_field_types.cc",
    "html_field_types.h",
    "is_required.h",
    "language_code.h",
    "logging/log_buffer.cc",
    "logging/log_buffer.h",
    "logging/log_macros.h",
    "password_form_fill_data.cc",
    "password_form_fill_data.h",
    "password_form_generation_data.h",
    "password_generation_util.cc",
    "password_generation_util.h",
    "save_password_progress_logger.cc",
    "save_password_progress_logger.h",
    "signatures.cc",
    "signatures.h",
    "unique_ids.cc",
    "unique_ids.h",
  ]

  public_deps = [
    ":autofill_regex",
    ":features",
    "//base",
    "//base:i18n",

    # Note: Can't use mojom:mojo_types here, as that already depends on :common.
    "//components/autofill/core/common/mojom:mojo_types_shared",
    "//third_party/abseil-cpp:absl",
  ]

  deps = [
    "//build:chromeos_buildflags",
    "//components/pref_registry",
    "//components/prefs",
    "//components/variations",
    "//crypto",
    "//google_apis:google_apis",
    "//ui/base",
    "//ui/gfx/geometry",
    "//url",
  ]

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

static_library("credit_card_number_validation") {
  sources = [
    "credit_card_network_identifiers.h",
    "credit_card_number_validation.cc",
    "credit_card_number_validation.h",
  ]

  deps = [
    ":autofill_regex",
    ":features",
    "//base",
  ]
}

static_library("autofill_regex") {
  sources = [
    "autofill_regex_constants.h",
    "autofill_regexes.cc",
    "autofill_regexes.h",
  ]

  public_deps = [ "//third_party/icu" ]

  deps = [ "//base:i18n" ]
}

component("features") {
  output_name = "autofill_core_common_features"
  defines = [ "IS_AUTOFILL_IMPL" ]
  sources = [
    "autofill_features.cc",
    "autofill_features.h",
    "autofill_payments_features.cc",
    "autofill_payments_features.h",
  ]

  deps = [
    "//base",
    "//build:chromeos_buildflags",
  ]

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

static_library("test_support") {
  testonly = true
  sources = [
    "autofill_test_utils.cc",
    "autofill_test_utils.h",
    "form_data_test_api.h",
    "test_matchers.h",
  ]
  deps = [
    "//base",
    "//base/test:test_support",
    "//url",
  ]
  public_deps = [
    ":common",
    "//testing/gmock",
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "autocomplete_parsing_util_unittest.cc",
    "autofill_internals/log_message_unittest.cc",
    "autofill_internals/logging_scope_unittest.cc",
    "autofill_prefs_unittest.cc",
    "autofill_regexes_unittest.cc",
    "autofill_util_unittest.cc",
    "credit_card_number_validation_unittest.cc",
    "dense_set_unittest.cc",
    "field_data_manager_unittest.cc",
    "form_data_unittest.cc",
    "form_field_data_unittest.cc",
    "logging/log_buffer_unittest.cc",
    "save_password_progress_logger_unittest.cc",
    "signatures_unittest.cc",
  ]

  deps = [
    ":autofill_regex",
    ":common",
    ":credit_card_number_validation",
    "//base",
    "//base:i18n",
    "//base/test:test_support",
    "//components/autofill/core/common:test_support",
    "//components/pref_registry",
    "//components/prefs",
    "//components/prefs:test_support",
    "//crypto:crypto",
    "//google_apis:google_apis",
    "//testing/gmock",
    "//testing/gtest",
    "//url",
  ]
}

static_library("fuzzer_support") {
  sources = [
    "form_data_fuzzed_producer.cc",
    "form_data_fuzzed_producer.h",
  ]

  deps = [
    ":common",
    "//url",
  ]
}

fuzzer_test("autofill_autocomplete_parsing_util_fuzzer") {
  sources = [ "autocomplete_parsing_util_fuzzer.cc" ]
  deps = [ ":common" ]
}