chromium/components/payments/core/BUILD.gn

# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")

static_library("core") {
  sources = [
    "android_app_description.cc",
    "android_app_description.h",
    "android_app_description_tools.cc",
    "android_app_description_tools.h",
    "csp_checker.h",
    "currency_formatter.cc",
    "currency_formatter.h",
    "error_logger.cc",
    "error_logger.h",
    "error_message_util.cc",
    "error_message_util.h",
    "features.cc",
    "features.h",
    "has_enrolled_instrument_query.cc",
    "has_enrolled_instrument_query.h",
    "journey_logger.cc",
    "journey_logger.h",
    "payer_data.cc",
    "payer_data.h",
    "payment_address.cc",
    "payment_address.h",
    "payment_currency_amount.cc",
    "payment_currency_amount.h",
    "payment_details.cc",
    "payment_details.h",
    "payment_details_modifier.cc",
    "payment_details_modifier.h",
    "payment_details_validation.cc",
    "payment_details_validation.h",
    "payment_item.cc",
    "payment_item.h",
    "payment_manifest_downloader.cc",
    "payment_manifest_downloader.h",
    "payment_method_data.cc",
    "payment_method_data.h",
    "payment_prefs.cc",
    "payment_prefs.h",
    "payment_request_base_delegate.h",
    "payment_request_data_util.cc",
    "payment_request_data_util.h",
    "payment_request_delegate.cc",
    "payment_request_delegate.h",
    "payment_request_metrics.cc",
    "payment_request_metrics.h",
    "payment_shipping_option.cc",
    "payment_shipping_option.h",
    "payments_experimental_features.cc",
    "payments_experimental_features.h",
    "payments_validators.cc",
    "payments_validators.h",
    "pre_purchase_query.h",
    "secure_payment_confirmation_credential.cc",
    "secure_payment_confirmation_credential.h",
    "secure_payment_confirmation_metrics.cc",
    "secure_payment_confirmation_metrics.h",
    "sizes.h",
    "url_util.cc",
    "url_util.h",
  ]

  if (!is_android) {
    sources += [
      "payment_options.cc",
      "payment_options.h",
      "payment_options_provider.h",
      "payment_response.cc",
      "payment_response.h",
      "payments_profile_comparator.cc",
      "payments_profile_comparator.h",
      "strings_util.cc",
      "strings_util.h",
    ]
  }

  deps = [
    ":error_strings",
    ":method_strings",
    "//base",
    "//build:blink_buildflags",
    "//build:chromeos_buildflags",
    "//components/autofill/core/browser",
    "//components/keyed_service/core",
    "//components/link_header_util",
    "//components/payments/mojom",
    "//components/pref_registry",
    "//components/prefs",
    "//components/strings:components_strings_grit",
    "//net",
    "//services/metrics/public/cpp:metrics_cpp",
    "//services/metrics/public/cpp:ukm_builders",
    "//services/network/public/cpp",
    "//third_party/re2",
    "//ui/base",
    "//url",
  ]

  if (use_blink) {
    deps += [ "//third_party/blink/public:runtime_features_for_public" ]
  }

  public_deps = [
    "//services/network/public/cpp",
    "//third_party/icu",
    "//third_party/libaddressinput",
  ]
}

static_library("error_strings") {
  sources = [
    "error_strings.cc",
    "error_strings.h",
    "native_error_strings.cc",
    "native_error_strings.h",
  ]

  if (is_chromeos) {
    sources += [
      "chrome_os_error_strings.cc",
      "chrome_os_error_strings.h",
    ]
  }
}

static_library("method_strings") {
  sources = [
    "method_strings.cc",
    "method_strings.h",
  ]
}

static_library("test_support") {
  testonly = true
  sources = [
    "const_csp_checker.cc",
    "const_csp_checker.h",
    "payments_test_util.cc",
    "payments_test_util.h",
    "test_payment_manifest_downloader.cc",
    "test_payment_manifest_downloader.h",
    "test_payment_request_delegate.cc",
    "test_payment_request_delegate.h",
  ]

  deps = [
    ":core",
    "//base",
    "//components/autofill/core/browser",
    "//components/autofill/core/browser:test_support",
    "//components/leveldb_proto:leveldb_proto",
    "//components/pref_registry",
    "//components/prefs",
    "//net:test_support",
    "//services/network:test_support",
    "//services/network/public/cpp",
    "//testing/gmock",
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "android_app_description_tools_unittest.cc",
    "const_csp_checker_unittest.cc",
    "currency_formatter_unittest.cc",
    "has_enrolled_instrument_query_unittest.cc",
    "journey_logger_unittest.cc",
    "payment_currency_amount_unittest.cc",
    "payment_details_modifier_unittest.cc",
    "payment_details_unittest.cc",
    "payment_details_validation_unittest.cc",
    "payment_item_unittest.cc",
    "payment_manifest_downloader_unittest.cc",
    "payment_method_data_unittest.cc",
    "payment_request_metrics_unittest.cc",
    "payment_shipping_option_unittest.cc",
    "payments_validators_unittest.cc",
    "secure_payment_confirmation_credential_unittest.cc",
    "url_util_unittest.cc",
  ]

  if (!is_android) {
    sources += [
      "payment_address_unittest.cc",
      "payment_options_unittest.cc",
      "payment_request_data_util_unittest.cc",
      "payment_response_unittest.cc",
      "payments_profile_comparator_unittest.cc",
    ]
  }

  deps = [
    ":core",
    ":test_support",
    "//base",
    "//base/test:test_support",
    "//components/autofill/core/browser",
    "//components/autofill/core/browser:test_support",
    "//components/leveldb_proto:leveldb_proto",
    "//components/prefs",
    "//components/prefs:test_support",
    "//components/strings:components_strings_grit",
    "//components/ukm",
    "//components/ukm:test_support",
    "//net:test_support",
    "//services/metrics/public/cpp:ukm_builders",
    "//services/network:test_support",
    "//services/network/public/cpp",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/libaddressinput:test_support",
    "//ui/base",
  ]
}