chromium/components/manta/BUILD.gn

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

# TODO(b/358224257): Re-enable when shared_library is properly used.
# allow_internal = is_chrome_branded
allow_internal = false

component("manta") {
  sources = [
    "anchovy/anchovy_proto_helper.h",
    "anchovy/anchovy_provider.cc",
    "anchovy/anchovy_provider.h",
    "anchovy/anchovy_requests.cc",
    "anchovy/anchovy_requests.h",
    "base_provider.cc",
    "base_provider.h",
    "features.cc",
    "features.h",
    "manta_service.cc",
    "manta_service.h",
    "manta_service_callbacks.cc",
    "manta_service_callbacks.h",
    "manta_status.h",
    "provider_params.h",
  ]

  if (allow_internal) {
    sources += [
      "//components/accessibility/internal/anchovy/anchovy_proto_helper.cc",
    ]
  } else {
    sources += [ "anchovy/anchovy_proto_helper.cc" ]
  }

  defines = [ "IS_MANTA_IMPL" ]

  deps = [
    "proto",
    "//base",
    "//build:chromeos_buildflags",
    "//components/account_id:account_id",
    "//components/endpoint_fetcher",
    "//components/keyed_service/core",
    "//components/signin/public/identity_manager",
    "//net",
  ]

  if (is_chromeos_ash) {
    sources += [
      "mahi_provider.cc",
      "mahi_provider.h",
      "orca_provider.cc",
      "orca_provider.h",
      "snapper_provider.cc",
      "snapper_provider.h",
      "sparky/sparky_context.cc",
      "sparky/sparky_context.h",
      "sparky/sparky_delegate.cc",
      "sparky/sparky_delegate.h",
      "sparky/sparky_provider.cc",
      "sparky/sparky_provider.h",
      "sparky/sparky_util.cc",
      "sparky/sparky_util.h",
      "sparky/system_info_delegate.cc",
      "sparky/system_info_delegate.h",
    ]
    deps += [ "//chromeos/constants:constants" ]
  }
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "base_provider_test_helper.cc",
    "base_provider_test_helper.h",
  ]

  if (is_chromeos_ash) {
    sources += [
      "orca_provider_unittest.cc",
      "snapper_provider_unittest.cc",
      "sparky/sparky_provider_unittest.cc",
      "sparky/sparky_util_unittest.cc",
    ]
  }

  deps = [
    ":manta",
    "proto",
    "//base",
    "//base/test:test_support",
    "//components/endpoint_fetcher",
    "//components/signin/public/identity_manager:test_support",
    "//net/traffic_annotation:test_support",
    "//services/network:test_support",
    "//testing/gtest",
  ]
}