chromium/net/dns/public/BUILD.gn

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

if (is_android) {
  import("//build/config/android/rules.gni")
}

source_set("public") {
  # Due to circular dependencies, should only be depended on through //net.
  # Limit visibility to //net and other source_sets with the same access
  # restriction.
  visibility = [
    "//net",
    "//net/dns:dns_client",
    "//net/dns:host_resolver",
    "//net/dns:host_resolver_manager",
  ]

  sources = [
    "dns_config_overrides.cc",
    "dns_config_overrides.h",
    "dns_over_https_config.cc",
    "dns_over_https_config.h",
    "dns_over_https_server_config.cc",
    "dns_over_https_server_config.h",
    "dns_protocol.h",
    "dns_query_type.cc",
    "dns_query_type.h",
    "doh_provider_entry.cc",
    "doh_provider_entry.h",
    "host_resolver_results.cc",
    "host_resolver_results.h",
    "host_resolver_source.cc",
    "host_resolver_source.h",
    "mdns_listener_update_type.h",
    "resolve_error_info.cc",
    "resolve_error_info.h",
    "secure_dns_mode.h",
    "secure_dns_policy.cc",
    "secure_dns_policy.h",
    "util.cc",
    "util.h",
  ]

  if (is_posix && !is_android) {
    sources += [
      "resolv_reader.cc",
      "resolv_reader.h",
      "scoped_res_state.cc",
      "scoped_res_state.h",
    ]
  }

  if (is_win) {
    sources += [
      "win_dns_system_settings.cc",
      "win_dns_system_settings.h",
    ]
  }

  deps = [ "//net:net_deps" ]

  public_deps = [ "//net:net_public_deps" ]
}

if (is_android) {
  java_cpp_enum("secure_dns_mode_generated_enum") {
    sources = [ "secure_dns_mode.h" ]
  }
}

source_set("tests") {
  testonly = true
  sources = [
    "dns_over_https_config_unittest.cc",
    "dns_over_https_server_config_unittest.cc",
    "doh_provider_entry_unittest.cc",
  ]

  if (is_posix && !is_android) {
    sources += [ "resolv_reader_unittest.cc" ]
  }

  if (is_win) {
    sources += [ "win_dns_system_settings_unittest.cc" ]
  }

  deps = [
    "//net",
    "//testing/gmock",
    "//testing/gtest",
  ]
}