chromium/components/account_manager_core/BUILD.gn

# Copyright 2020 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/ui.gni")
import("//third_party/protobuf/proto_library.gni")

assert(is_chromeos)

component("account_manager_core") {
  sources = [
    "account.cc",
    "account.h",
    "account_addition_options.h",
    "account_manager_facade.cc",
    "account_manager_facade.h",
    "account_manager_facade_impl.cc",
    "account_manager_facade_impl.h",
    "account_manager_util.cc",
    "account_manager_util.h",
    "account_upsertion_result.cc",
    "account_upsertion_result.h",
    "chromeos/access_token_fetcher.cc",
    "chromeos/access_token_fetcher.h",
    "chromeos/account_manager.cc",
    "chromeos/account_manager.h",
    "chromeos/account_manager_facade_factory.h",
    "chromeos/account_manager_mojo_service.cc",
    "chromeos/account_manager_mojo_service.h",
    "chromeos/account_manager_ui.cc",
    "chromeos/account_manager_ui.h",
    "pref_names.cc",
    "pref_names.h",
  ]

  deps = [
    "//base",
    "//build:chromeos_buildflags",
    "//chromeos/crosapi/mojom",
    "//components/prefs:prefs",
    "//google_apis:google_apis",
    "//mojo/public/cpp/bindings",
    "//services/network/public/cpp:cpp",
  ]

  if (is_chromeos_lacros) {
    sources += [ "chromeos/account_manager_facade_factory_lacros.cc" ]
    deps += [ "//chromeos/lacros:lacros" ]
  }

  public_deps = [
    ":account_manager_proto",
    "//third_party/abseil-cpp:absl",
  ]

  defines = [ "IS_ACCOUNT_MANAGER_CORE_IMPL" ]
}

source_set("test_support") {
  testonly = true

  sources = [
    "account_manager_test_util.cc",
    "account_manager_test_util.h",
    "chromeos/fake_account_manager_ui.cc",
    "chromeos/fake_account_manager_ui.h",
    "mock_account_manager_facade.cc",
    "mock_account_manager_facade.h",
  ]

  public_deps = [
    "//base",
    "//google_apis",
    "//testing/gmock",
  ]

  deps = [ ":account_manager_core" ]
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "account_manager_facade_impl_unittest.cc",
    "account_manager_util_unittest.cc",
    "chromeos/account_manager_mojo_service_unittest.cc",
    "chromeos/account_manager_unittest.cc",
  ]

  deps = [
    ":account_manager_core",
    ":test_support",
    "//base/test:test_support",
    "//chromeos/crosapi/mojom",
    "//components/prefs:test_support",
    "//google_apis:google_apis",
    "//services/network:test_support",
    "//services/network/public/cpp:cpp",
    "//testing/gtest",
  ]
}

proto_library("account_manager_proto") {
  visibility = [ ":*" ]
  sources = [ "chromeos/tokens.proto" ]

  proto_out_dir = "components/account_manager_core/chromeos"
}