chromium/ash/quick_pair/common/BUILD.gn

# Copyright 2021 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")

assert(is_chromeos_ash,
       "Quick Pair protocols (e.g. Fast Pair) are ash-chrome only")

component("common") {
  output_name = "quick_pair_common"

  defines = [ "IS_QUICK_PAIR_COMMON_IMPL" ]

  sources = [
    "account_key_failure.cc",
    "account_key_failure.h",
    "constants.cc",
    "constants.h",
    "device.cc",
    "device.h",
    "fast_pair/fast_pair_decoder.cc",
    "fast_pair/fast_pair_decoder.h",
    "fast_pair/fast_pair_feature_usage_metrics_logger.cc",
    "fast_pair/fast_pair_feature_usage_metrics_logger.h",
    "fast_pair/fast_pair_http_result.cc",
    "fast_pair/fast_pair_http_result.h",
    "fast_pair/fast_pair_metrics.cc",
    "fast_pair/fast_pair_metrics.h",
    "log_buffer.cc",
    "log_buffer.h",
    "logging.cc",
    "logging.h",
    "pair_failure.cc",
    "pair_failure.h",
    "protocol.cc",
    "protocol.h",
    "quick_pair_browser_delegate.cc",
    "quick_pair_browser_delegate.h",
  ]

  deps = [
    "//ash/constants:constants",
    "//ash/quick_pair/proto:fastpair_proto",
    "//base",
    "//chromeos/ash/components/feature_usage",
    "//chromeos/ash/services/quick_pair/public/mojom",
    "//components/cross_device/logging:logging",
    "//components/metrics/structured:structured_events",
    "//components/metrics/structured:structured_metrics_features",
    "//components/prefs",
    "//device/bluetooth",
    "//device/bluetooth/public/cpp",
    "//net",
    "//services/network/public/cpp",
    "//services/network/public/mojom",
    "//url",
  ]
}

static_library("test_support") {
  testonly = true

  sources = [
    "fake_bluetooth_adapter.cc",
    "fake_bluetooth_adapter.h",
    "fake_quick_pair_browser_delegate.cc",
    "fake_quick_pair_browser_delegate.h",
    "fast_pair/fast_pair_service_data_creator.cc",
    "fast_pair/fast_pair_service_data_creator.h",
    "mock_quick_pair_browser_delegate.cc",
    "mock_quick_pair_browser_delegate.h",
  ]

  deps = [
    ":common",
    "//ash/constants",
    "//ash/quick_pair/repository",
    "//base/test:test_support",
    "//chromeos/ash/services/quick_pair/public/mojom",
    "//components/image_fetcher/core",
    "//components/prefs:test_support",
    "//device/bluetooth:mocks",
    "//services/network/public/cpp",
    "//testing/gtest",
  ]
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "device_unittest.cc",
    "fast_pair/fast_pair_decoder_unittest.cc",
    "fast_pair/fast_pair_feature_usage_metrics_logger_unittest.cc",
    "log_buffer_unittest.cc",
    "logging_unittest.cc",
  ]

  deps = [
    ":common",
    ":test_support",
    "//ash/constants:constants",
    "//base/test:test_support",
    "//chromeos/ash/components/feature_usage",
    "//components/prefs:test_support",
    "//device/bluetooth",
    "//device/bluetooth:mocks",
    "//testing/gtest",
  ]
}