#ifndef NET_DNS_DNS_TEST_UTIL_H_
#define NET_DNS_DNS_TEST_UTIL_H_
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "base/containers/span.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/synchronization/condition_variable.h"
#include "base/time/time.h"
#include "base/values.h"
#include "net/base/connection_endpoint_metadata.h"
#include "net/base/ip_endpoint.h"
#include "net/dns/dns_client.h"
#include "net/dns/dns_config.h"
#include "net/dns/dns_response.h"
#include "net/dns/dns_transaction.h"
#include "net/dns/dns_util.h"
#include "net/dns/public/dns_over_https_server_config.h"
#include "net/dns/public/dns_protocol.h"
#include "net/dns/public/secure_dns_mode.h"
#include "net/socket/socket_test_util.h"
#include "url/scheme_host_port.h"
namespace net {
static const char kT0HostName[] = …;
static const uint16_t kT0Qtype = …;
static const char kT0DnsName[] = …;
static const size_t kT0QuerySize = …;
static const uint8_t kT0ResponseDatagram[] = …;
static const char* const kT0IpAddresses[] = …;
static const char kT0CanonName[] = …;
static const base::TimeDelta kT0Ttl = …;
static const unsigned kT0RecordCount = …;
static const char kT1HostName[] = …;
static const uint16_t kT1Qtype = …;
static const char kT1DnsName[] = …;
static const size_t kT1QuerySize = …;
static const uint8_t kT1ResponseDatagram[] = …;
static const char* const kT1IpAddresses[] = …;
static const char kT1CanonName[] = …;
static const base::TimeDelta kT1Ttl = …;
static const unsigned kT1RecordCount = …;
static const char kT2HostName[] = …;
static const uint16_t kT2Qtype = …;
static const char kT2DnsName[] = …;
static const size_t kT2QuerySize = …;
static const uint8_t kT2ResponseDatagram[] = …;
static const char* const kT2IpAddresses[] = …;
static const char kT2CanonName[] = …;
static const base::TimeDelta kT2Ttl = …;
static const unsigned kT2RecordCount = …;
static const char kT3HostName[] = …;
static const uint16_t kT3Qtype = …;
static const char kT3DnsName[] = …;
static const size_t kT3QuerySize = …;
static const uint8_t kT3ResponseDatagram[] = …;
static const char* const kT3IpAddresses[] = …;
static const char kT3CanonName[] = …;
static const base::TimeDelta kT3Ttl = …;
static const unsigned kT3RecordCount = …;
static const char kT4HostName[] = …;
static const uint16_t kT4Qtype = …;
static const char kT4DnsName[] = …;
static const size_t kT4QuerySize = …;
static const uint8_t kT4ResponseDatagram[] = …;
static const char* const kT4IpAddresses[] = …;
static const base::TimeDelta kT4Ttl = …;
static const unsigned kT4RecordCount = …;
class AddressSorter;
class DnsClient;
class DnsSession;
class IPAddress;
class ResolveContext;
class URLRequestContext;
DnsConfig CreateValidDnsConfig();
DnsResourceRecord BuildTestDnsRecord(std::string name,
uint16_t type,
std::string rdata,
base::TimeDelta ttl = base::Days(1));
DnsResourceRecord BuildTestCnameRecord(std::string name,
std::string_view canonical_name,
base::TimeDelta ttl = base::Days(1));
DnsResourceRecord BuildTestAddressRecord(std::string name,
const IPAddress& ip,
base::TimeDelta ttl = base::Days(1));
DnsResourceRecord BuildTestTextRecord(std::string name,
std::vector<std::string> text_strings,
base::TimeDelta ttl = base::Days(1));
DnsResourceRecord BuildTestHttpsAliasRecord(
std::string name,
std::string_view alias_name,
base::TimeDelta ttl = base::Days(1));
std::pair<uint16_t, std::string> BuildTestHttpsServiceAlpnParam(
const std::vector<std::string>& alpns);
std::pair<uint16_t, std::string> BuildTestHttpsServiceEchConfigParam(
base::span<const uint8_t> ech_config_list);
std::pair<uint16_t, std::string> BuildTestHttpsServiceMandatoryParam(
std::vector<uint16_t> param_key_list);
std::pair<uint16_t, std::string> BuildTestHttpsServicePortParam(uint16_t port);
DnsResourceRecord BuildTestHttpsServiceRecord(
std::string name,
uint16_t priority,
std::string_view service_name,
const std::map<uint16_t, std::string>& params,
base::TimeDelta ttl = base::Days(1));
DnsResponse BuildTestDnsResponse(
std::string name,
uint16_t type,
const std::vector<DnsResourceRecord>& answers,
const std::vector<DnsResourceRecord>& authority = { … };
DnsResponse BuildTestDnsAddressResponse(std::string name,
const IPAddress& ip,
std::string answer_name = "");
DnsResponse BuildTestDnsAddressResponseWithCname(std::string name,
const IPAddress& ip,
std::string cannonname,
std::string answer_name = "");
DnsResponse BuildTestDnsTextResponse(
std::string name,
std::vector<std::vector<std::string>> text_records,
std::string answer_name = "");
DnsResponse BuildTestDnsPointerResponse(std::string name,
std::vector<std::string> pointer_names,
std::string answer_name = "");
struct TestServiceRecord { … };
DnsResponse BuildTestDnsServiceResponse(
std::string name,
std::vector<TestServiceRecord> service_records,
std::string answer_name = "");
struct MockDnsClientRule { … };
MockDnsClientRuleList;
class MockDnsTransactionFactory : public DnsTransactionFactory { … };
class MockDnsClient : public DnsClient { … };
class MockHostResolverProc : public HostResolverProc { … };
}
#endif