chromium/components/captive_portal/core/BUILD.gn

# Copyright 2014 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/buildflag_header.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//components/captive_portal/core/features.gni")

component("core") {
  # Avoid clashes with other targets named "core".
  output_name = "captive_portal_core"

  sources = [
    "captive_portal_detector.cc",
    "captive_portal_detector.h",
    "captive_portal_export.h",
    "captive_portal_metrics.cc",
    "captive_portal_metrics.h",
    "captive_portal_types.cc",
    "captive_portal_types.h",
  ]

  defines = [ "CAPTIVE_PORTAL_IMPLEMENTATION" ]

  deps = [
    "//base",
    "//build:chromeos_buildflags",
    "//net",
    "//services/network/public/cpp",
    "//url",
  ]

  if (is_chromeos_ash) {
    deps += [ "//chromeos/ash/components/network" ]
  }
}

buildflag_header("buildflags") {
  header = "buildflags.h"
  flags = [ "ENABLE_CAPTIVE_PORTAL_DETECTION=$enable_captive_portal_detection" ]
}

static_library("test_support") {
  testonly = true
  sources = [
    "captive_portal_testing_utils.cc",
    "captive_portal_testing_utils.h",
  ]

  deps = [
    ":core",
    "//base",
    "//net:test_support",
    "//services/network:test_support",
    "//url",
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = [ "captive_portal_detector_unittest.cc" ]

  deps = [
    ":core",
    ":test_support",
    "//base",
    "//net:test_support",
    "//testing/gtest",
  ]
}