# 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.h",
    "mdns_listener_update_type.h",
    "resolve_error_info.cc",
    "resolve_error_info.h",
    "secure_dns_mode.h",
    "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 && !is_starboard) {
    sources += [
      "win_dns_system_settings.cc",
      "win_dns_system_settings.h",
    ]
  }

  deps = [ "//net:net_deps" ]

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

if (is_android && !use_cobalt_customizations) {
  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 && !is_starboard) {
    sources += [ "win_dns_system_settings_unittest.cc" ]
  }

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