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

import("//components/enterprise/buildflags/buildflags.gni")

static_library("core") {
  public = [
    "features.h",
    "prefs.h",
  ]
  sources = [
    "features.cc",
    "prefs.cc",
  ]
  public_deps = [
    "//base",
    "//components/enterprise/buildflags",
    "//components/keyed_service/core",
    "//components/prefs",
  ]

  if (enterprise_proxy) {
    public += [
      "enterprise_proxy_error_data.h",
      "enterprise_proxy_error_service.h",
      "enterprise_proxy_service.h",
      "flag_descriptions.h",
      "provisioning_domain_client.h",
      "provisioning_domain_fetcher.h",
      "proxy_provisioning_domain_manager.h",
      "timer_utils.h",
      "types.h",
      "utils.h",
    ]
    sources += [
      "enterprise_network_auth_service.cc",
      "enterprise_proxy_error_data.cc",
      "enterprise_proxy_error_service.cc",
      "enterprise_proxy_service.cc",
      "flag_descriptions.cc",
      "provisioning_domain_client.cc",
      "provisioning_domain_fetcher.cc",
      "proxy_provisioning_domain_manager.cc",
      "timer_utils.cc",
      "types.cc",
      "utils.cc",
    ]
    deps = [
      "//components/enterprise/browser/identifiers",
      "//components/language/core/browser",
      "//components/policy/core/common",
      "//components/signin/public/identity_manager",
      "//net",
      "//services/network/public/cpp",
    ]
  }
}

source_set("unit_tests") {
  testonly = true
  sources = []
  deps = []

  if (enterprise_proxy) {
    sources += [
      "enterprise_network_auth_service_unittest.cc",
      "enterprise_proxy_error_service_unittest.cc",
      "enterprise_proxy_service_unittest.cc",
      "provisioning_domain_client_unittest.cc",
      "provisioning_domain_fetcher_unittest.cc",
      "proxy_provisioning_domain_manager_unittest.cc",
      "timer_utils_unittest.cc",
      "utils_unittest.cc",
    ]
    deps += [
      ":core",
      ":test_support",
      "//base",
      "//base/test:test_support",
      "//components/enterprise/browser/identifiers",
      "//components/enterprise/buildflags",
      "//components/language/core/browser",
      "//components/prefs:test_support",
      "//components/signin/public/identity_manager:test_support",
      "//net:test_support",
      "//services/network:test_support",
      "//services/network/public/cpp",
      "//testing/gmock",
      "//testing/gtest",
    ]
    if (!is_ios) {
      deps += [ "//content/test:test_support" ]
    }
  }
}

static_library("test_support") {
  testonly = true
  public = []
  sources = []
  public_deps = [
    ":core",
    "//base",
    "//testing/gmock",
  ]

  if (enterprise_proxy) {
    public += [
      "mock_enterprise_network_auth_service.h",
      "mock_enterprise_proxy_service.h",
    ]
    sources += [
      "mock_enterprise_network_auth_service.cc",
      "mock_enterprise_proxy_service.cc",
    ]
    public_deps += [ "//net" ]
  }
}
