#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "net/dns/host_resolver_manager_unittest.h"
#include <iterator>
#include <limits>
#include <optional>
#include <string>
#include <string_view>
#include <tuple>
#include <utility>
#include <vector>
#include "base/auto_reset.h"
#include "base/containers/contains.h"
#include "base/containers/to_vector.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/numerics/safe_conversions.h"
#include "base/rand_util.h"
#include "base/ranges/algorithm.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/condition_variable.h"
#include "base/synchronization/lock.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_clock.h"
#include "base/test/test_mock_time_task_runner.h"
#include "base/test/test_timeouts.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "base/timer/mock_timer.h"
#include "base/values.h"
#include "build/build_config.h"
#include "net/base/address_family.h"
#include "net/base/address_list.h"
#include "net/base/connection_endpoint_metadata_test_util.h"
#include "net/base/features.h"
#include "net/base/host_port_pair.h"
#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
#include "net/base/mock_network_change_notifier.h"
#include "net/base/net_errors.h"
#include "net/base/network_anonymization_key.h"
#include "net/base/network_change_notifier.h"
#include "net/base/network_interfaces.h"
#include "net/base/schemeful_site.h"
#include "net/dns/address_sorter.h"
#include "net/dns/dns_client.h"
#include "net/dns/dns_config.h"
#include "net/dns/dns_test_util.h"
#include "net/dns/dns_util.h"
#include "net/dns/host_resolver.h"
#include "net/dns/host_resolver_cache.h"
#include "net/dns/host_resolver_internal_result.h"
#include "net/dns/host_resolver_internal_result_test_util.h"
#include "net/dns/host_resolver_results_test_util.h"
#include "net/dns/host_resolver_system_task.h"
#include "net/dns/mock_host_resolver.h"
#include "net/dns/mock_mdns_client.h"
#include "net/dns/mock_mdns_socket_factory.h"
#include "net/dns/public/dns_config_overrides.h"
#include "net/dns/public/dns_over_https_config.h"
#include "net/dns/public/dns_protocol.h"
#include "net/dns/public/dns_query_type.h"
#include "net/dns/public/doh_provider_entry.h"
#include "net/dns/public/mdns_listener_update_type.h"
#include "net/dns/public/resolve_error_info.h"
#include "net/dns/public/secure_dns_mode.h"
#include "net/dns/public/secure_dns_policy.h"
#include "net/dns/resolve_context.h"
#include "net/dns/test_dns_config_service.h"
#include "net/log/net_log_event_type.h"
#include "net/log/net_log_source_type.h"
#include "net/log/net_log_with_source.h"
#include "net/log/test_net_log.h"
#include "net/log/test_net_log_util.h"
#include "net/proxy_resolution/configured_proxy_resolution_service.h"
#include "net/socket/next_proto.h"
#include "net/socket/socket_test_util.h"
#include "net/test/gtest_util.h"
#include "net/test/test_with_task_environment.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_builder.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/scheme_host_port.h"
#include "url/url_constants.h"
#if BUILDFLAG(ENABLE_MDNS)
#include "net/dns/mdns_client_impl.h"
#endif
IsError;
IsOk;
_;
AllOf;
AnyOf;
Between;
ByMove;
Contains;
ElementsAre;
Eq;
IsEmpty;
Not;
Optional;
Pair;
Pointee;
Property;
Return;
UnorderedElementsAre;
namespace net {
namespace {
const size_t kMaxJobs = …;
const size_t kMaxRetryAttempts = …;
HostResolverSystemTask::Params DefaultParams(
scoped_refptr<HostResolverProc> resolver_proc) { … }
class ResolveHostResponseHelper { … };
class LookupAttemptHostResolverProc : public HostResolverProc { … };
class TestHostResolverManager : public HostResolverManager { … };
bool HasAddress(const IPAddress& search_address,
const std::vector<IPEndPoint>& addresses) { … }
void TestBothLoopbackIPs(const std::string& host) { … }
const DohProviderEntry& GetDohProviderEntryForTesting(
std::string_view provider) { … }
}
HostResolverManagerTest::HostResolverManagerTest(
base::test::TaskEnvironment::TimeSource time_source)
: … { … }
HostResolverManagerTest::~HostResolverManagerTest() = default;
void HostResolverManagerTest::CreateResolver(bool check_ipv6_on_wifi) { … }
void HostResolverManagerTest::DestroyResolver() { … }
void HostResolverManagerTest::CreateSerialResolver(bool check_ipv6_on_wifi,
bool ipv6_reachable,
bool is_async) { … }
void HostResolverManagerTest::SetUp() { … }
void HostResolverManagerTest::TearDown() { … }
void HostResolverManagerTest::CreateResolverWithLimitsAndParams(
size_t max_concurrent_resolves,
const HostResolverSystemTask::Params& params,
bool ipv6_reachable,
bool check_ipv6_on_wifi,
bool is_async) { … }
HostResolver::ManagerOptions HostResolverManagerTest::DefaultOptions() { … }
void HostResolverManagerTest::CreateResolverWithOptionsAndParams(
HostResolver::ManagerOptions options,
const HostResolverSystemTask::Params& params,
bool ipv6_reachable,
bool is_async,
bool ipv4_reachable) { … }
size_t HostResolverManagerTest::num_running_dispatcher_jobs() const { … }
void HostResolverManagerTest::set_allow_fallback_to_systemtask(
bool allow_fallback_to_systemtask) { … }
int HostResolverManagerTest::StartIPv6ReachabilityCheck(
const NetLogWithSource& net_log,
raw_ptr<ClientSocketFactory> client_socket_factory,
CompletionOnceCallback callback) { … }
bool HostResolverManagerTest::GetLastIpv6ProbeResult() { … }
void HostResolverManagerTest::PopulateCache(const HostCache::Key& key,
IPEndPoint endpoint) { … }
const std::pair<const HostCache::Key, HostCache::Entry>*
HostResolverManagerTest::GetCacheHit(const HostCache::Key& key) { … }
void HostResolverManagerTest::MakeCacheStale() { … }
IPEndPoint HostResolverManagerTest::CreateExpected(
const std::string& ip_literal,
uint16_t port) { … }
TEST_F(HostResolverManagerTest, AsynchronousLookup) { … }
TEST_F(HostResolverManagerTest, AsynchronousLookupWithScheme) { … }
TEST_F(HostResolverManagerTest, AsynchronousIpv6Lookup) { … }
TEST_F(HostResolverManagerTest, AsynchronousAllFamilyLookup) { … }
TEST_F(HostResolverManagerTest, JobsClearedOnCompletion) { … }
TEST_F(HostResolverManagerTest, JobsClearedOnCompletion_MultipleRequests) { … }
TEST_F(HostResolverManagerTest, JobsClearedOnCompletion_Failure) { … }
TEST_F(HostResolverManagerTest, JobsClearedOnCompletion_Abort) { … }
TEST_F(HostResolverManagerTest, DnsQueryType) { … }
TEST_F(HostResolverManagerTest, DnsQueryWithoutAliases) { … }
void HostResolverManagerTest::LocalhostIPV4IPV6LookupTest(bool is_async) { … }
TEST_F(HostResolverManagerTest, LocalhostIPV4IPV6LookupAsync) { … }
TEST_F(HostResolverManagerTest, LocalhostIPV4IPV6LookupSync) { … }
TEST_F(HostResolverManagerTest, ResolveIPLiteralWithHostResolverSystemOnly) { … }
TEST_F(HostResolverManagerTest, EmptyListMeansNameNotResolved) { … }
TEST_F(HostResolverManagerTest, FailedAsynchronousLookup) { … }
TEST_F(HostResolverManagerTest, AbortedAsynchronousLookup) { … }
TEST_F(HostResolverManagerTest, NumericIPv4Address) { … }
TEST_F(HostResolverManagerTest, NumericIPv4AddressWithScheme) { … }
void HostResolverManagerTest::NumericIPv6AddressTest(bool is_async) { … }
TEST_F(HostResolverManagerTest, NumericIPv6AddressAsync) { … }
TEST_F(HostResolverManagerTest, NumericIPv6AddressSync) { … }
void HostResolverManagerTest::NumericIPv6AddressWithSchemeTest(bool is_async) { … }
TEST_F(HostResolverManagerTest, NumericIPv6AddressWithSchemeAsync) { … }
TEST_F(HostResolverManagerTest, NumericIPv6AddressWithSchemeSync) { … }
TEST_F(HostResolverManagerTest, AddRequestDuringFinishIPv6ReachabilityCheck) { … }
TEST_F(HostResolverManagerTest, EmptyHost) { … }
TEST_F(HostResolverManagerTest, EmptyDotsHost) { … }
TEST_F(HostResolverManagerTest, LongHost) { … }
TEST_F(HostResolverManagerTest, DeDupeRequests) { … }
TEST_F(HostResolverManagerTest, CancelMultipleRequests) { … }
TEST_F(HostResolverManagerTest, CanceledRequestsReleaseJobSlots) { … }
TEST_F(HostResolverManagerTest, CancelWithinCallback) { … }
TEST_F(HostResolverManagerTest, DeleteWithinCallback) { … }
TEST_F(HostResolverManagerTest, DeleteWithinAbortedCallback) { … }
TEST_F(HostResolverManagerTest, StartWithinCallback) { … }
TEST_F(HostResolverManagerTest, StartWithinEvictionCallback) { … }
TEST_F(HostResolverManagerTest, StartWithinEvictionCallback_DoubleEviction) { … }
TEST_F(HostResolverManagerTest, StartWithinEvictionCallback_SameRequest) { … }
TEST_F(HostResolverManagerTest, BypassCache) { … }
void HostResolverManagerTest::FlushCacheOnIPAddressChangeTest(bool is_async) { … }
TEST_F(HostResolverManagerTest, FlushCacheOnIPAddressChangeAsync) { … }
TEST_F(HostResolverManagerTest, FlushCacheOnIPAddressChangeSync) { … }
void HostResolverManagerTest::AbortOnIPAddressChangedTest(bool is_async) { … }
TEST_F(HostResolverManagerTest, AbortOnIPAddressChangedAsync) { … }
TEST_F(HostResolverManagerTest, AbortOnIPAddressChangedSync) { … }
TEST_F(HostResolverManagerTest, ObeyPoolConstraintsAfterIPAddressChange) { … }
void HostResolverManagerTest::AbortOnlyExistingRequestsOnIPAddressChangeTest(
bool is_async) { … }
TEST_F(HostResolverManagerTest,
AbortOnlyExistingRequestsOnIPAddressChangeAsync) { … }
TEST_F(HostResolverManagerTest,
AbortOnlyExistingRequestsOnIPAddressChangeSync) { … }
TEST_F(HostResolverManagerTest, HigherPriorityRequestsStartedFirst) { … }
void HostResolverManagerTest::ChangePriorityTest(bool is_async) { … }
TEST_F(HostResolverManagerTest, ChangePriorityAsync) { … }
TEST_F(HostResolverManagerTest, ChangePrioritySync) { … }
TEST_F(HostResolverManagerTest, CancelPendingRequest) { … }
TEST_F(HostResolverManagerTest, QueueOverflow) { … }
TEST_F(HostResolverManagerTest, QueueOverflow_SelfEvict) { … }
TEST_F(HostResolverManagerTest, AddressFamilyWithRawIPs) { … }
TEST_F(HostResolverManagerTest, LocalOnly_FromCache) { … }
TEST_F(HostResolverManagerTest, LocalOnly_StaleEntry) { … }
void HostResolverManagerTest::LocalOnlyFromIpTest(bool is_async) { … }
TEST_F(HostResolverManagerTest, LocalOnly_FromIpAsync) { … }
TEST_F(HostResolverManagerTest, LocalOnly_FromIpSync) { … }
TEST_F(HostResolverManagerTest, LocalOnly_InvalidName) { … }
TEST_F(HostResolverManagerTest, LocalOnly_InvalidLocalhost) { … }
TEST_F(HostResolverManagerTest, StaleAllowed) { … }
TEST_F(HostResolverManagerTest, StaleAllowed_NonLocal) { … }
void HostResolverManagerTest::StaleAllowedFromIpTest(bool is_async) { … }
TEST_F(HostResolverManagerTest, StaleAllowed_FromIpAsync) { … }
TEST_F(HostResolverManagerTest, StaleAllowed_FromIpSync) { … }
TEST_F(HostResolverManagerTest, MultipleAttempts) { … }
TEST_F(HostResolverManagerTest, DefaultMaxRetryAttempts) { … }
TEST_F(HostResolverManagerTest, NameCollisionIcann) { … }
TEST_F(HostResolverManagerTest, StartIPv6ReachabilityCheck) { … }
TEST_F(HostResolverManagerTest, IncludeCanonicalName) { … }
TEST_F(HostResolverManagerTest, FixupCanonicalName) { … }
TEST_F(HostResolverManagerTest, IncludeCanonicalNameButNotReceived) { … }
TEST_F(HostResolverManagerTest, IncludeCanonicalNameSkipsUrlCanonicalization) { … }
TEST_F(HostResolverManagerTest, LoopbackOnly) { … }
TEST_F(HostResolverManagerTest, IsSpeculative) { … }
TEST_F(HostResolverManagerTest, AvoidMulticastResolutionParameter) { … }
#if BUILDFLAG(ENABLE_MDNS)
const uint8_t kMdnsResponseA[] = …;
const uint8_t kMdnsResponseA2[] = …;
const uint8_t kMdnsResponseA2Goodbye[] = …;
const uint8_t kMdnsResponseAAAA[] = …;
const uint8_t kMdnsResponseNsec[] = …;
const uint8_t kMdnsResponseTxt[] = …;
const uint8_t kMdnsResponsePtr[] = …;
const uint8_t kMdnsResponsePtrRoot[] = …;
const uint8_t kMdnsResponseSrv[] = …;
const uint8_t kMdnsResponseSrvUnrestricted[] = …;
const uint8_t kMdnsResponseSrvUnrestrictedResult[] = …;
TEST_F(HostResolverManagerTest, Mdns) { … }
TEST_F(HostResolverManagerTest, Mdns_AaaaOnly) { … }
TEST_F(HostResolverManagerTest, Mdns_Txt) { … }
TEST_F(HostResolverManagerTest, Mdns_Ptr) { … }
TEST_F(HostResolverManagerTest, Mdns_Srv) { … }
TEST_F(HostResolverManagerTest, Mdns_Srv_Unrestricted) { … }
TEST_F(HostResolverManagerTest, Mdns_Srv_Result_Unrestricted) { … }
TEST_F(HostResolverManagerTest, Mdns_Nsec) { … }
TEST_F(HostResolverManagerTest, Mdns_NoResponse) { … }
TEST_F(HostResolverManagerTest, Mdns_WrongType) { … }
TEST_F(HostResolverManagerTest, Mdns_PartialResults) { … }
TEST_F(HostResolverManagerTest, Mdns_Cancel) { … }
TEST_F(HostResolverManagerTest, Mdns_PartialFailure) { … }
TEST_F(HostResolverManagerTest, Mdns_ListenFailure) { … }
class TestMdnsListenerDelegate : public HostResolver::MdnsListener::Delegate { … };
TEST_F(HostResolverManagerTest, MdnsListener) { … }
TEST_F(HostResolverManagerTest, MdnsListener_StartListenFailure) { … }
TEST_F(HostResolverManagerTest, MdnsListener_Expiration) { … }
TEST_F(HostResolverManagerTest, MdnsListener_Txt) { … }
TEST_F(HostResolverManagerTest, MdnsListener_Ptr) { … }
TEST_F(HostResolverManagerTest, MdnsListener_Srv) { … }
TEST_F(HostResolverManagerTest, MdnsListener_NonListeningTypes) { … }
TEST_F(HostResolverManagerTest, MdnsListener_RootDomain) { … }
#endif
DnsConfig CreateUpgradableDnsConfig() { … }
TEST_F(HostResolverManagerTest, NetworkAnonymizationKeyWriteToHostCache) { … }
TEST_F(HostResolverManagerTest, NetworkAnonymizationKeyReadFromHostCache) { … }
TEST_F(HostResolverManagerTest, NetworkAnonymizationKeyTwoRequestsAtOnce) { … }
TEST_F(HostResolverManagerTest, ContextsNotMerged) { … }
HostResolverManagerDnsTest::HostResolverManagerDnsTest(
base::test::TaskEnvironment::TimeSource time_source)
: … { … }
HostResolverManagerDnsTest::~HostResolverManagerDnsTest() = default;
void HostResolverManagerDnsTest::DestroyResolver() { … }
void HostResolverManagerDnsTest::SetDnsClient(
std::unique_ptr<DnsClient> dns_client) { … }
void HostResolverManagerDnsTest::TearDown() { … }
HostResolver::ManagerOptions HostResolverManagerDnsTest::DefaultOptions() { … }
void HostResolverManagerDnsTest::CreateResolverWithOptionsAndParams(
HostResolver::ManagerOptions options,
const HostResolverSystemTask::Params& params,
bool ipv6_reachable,
bool is_async,
bool ipv4_reachable) { … }
void HostResolverManagerDnsTest::UseMockDnsClient(const DnsConfig& config,
MockDnsClientRuleList rules) { … }
MockDnsClientRuleList HostResolverManagerDnsTest::CreateDefaultDnsRules() { … }
void HostResolverManagerDnsTest::AddDnsRule(
MockDnsClientRuleList* rules,
const std::string& prefix,
uint16_t qtype,
MockDnsClientRule::ResultType result_type,
bool delay) { … }
void HostResolverManagerDnsTest::AddDnsRule(MockDnsClientRuleList* rules,
const std::string& prefix,
uint16_t qtype,
const IPAddress& result_ip,
bool delay) { … }
void HostResolverManagerDnsTest::AddDnsRule(MockDnsClientRuleList* rules,
const std::string& prefix,
uint16_t qtype,
IPAddress result_ip,
std::string cannonname,
bool delay) { … }
void HostResolverManagerDnsTest::AddDnsRule(MockDnsClientRuleList* rules,
const std::string& prefix,
uint16_t qtype,
DnsResponse dns_test_response,
bool delay) { … }
void HostResolverManagerDnsTest::AddSecureDnsRule(
MockDnsClientRuleList* rules,
const std::string& prefix,
uint16_t qtype,
MockDnsClientRule::ResultType result_type,
bool delay) { … }
void HostResolverManagerDnsTest::ChangeDnsConfig(const DnsConfig& config) { … }
void HostResolverManagerDnsTest::InvalidateDnsConfig() { … }
void HostResolverManagerDnsTest::SetInitialDnsConfig(const DnsConfig& config) { … }
void HostResolverManagerDnsTest::TriggerInsecureFailureCondition() { … }
TEST_F(HostResolverManagerDnsTest, FlushCacheOnDnsConfigChange) { … }
TEST_F(HostResolverManagerDnsTest, DisableAndEnableInsecureDnsClient) { … }
TEST_F(HostResolverManagerDnsTest,
UseHostResolverSystemTaskWhenPrivateDnsActive) { … }
TEST_F(HostResolverManagerDnsTest, LocalhostLookup) { … }
TEST_F(HostResolverManagerDnsTest, LocalhostLookupWithHosts) { … }
TEST_F(HostResolverManagerDnsTest, DnsTask) { … }
TEST_F(HostResolverManagerDnsTest, DnsTaskWithScheme) { … }
TEST_F(HostResolverManagerDnsTest, NoFallbackToHostResolverSystemTask) { … }
TEST_F(HostResolverManagerDnsTest, OnDnsTaskFailureAbortedJob) { … }
TEST_F(HostResolverManagerDnsTest, FallbackBySource_Any) { … }
TEST_F(HostResolverManagerDnsTest, FallbackBySource_Dns) { … }
TEST_F(HostResolverManagerDnsTest, FallbackOnAbortBySource_Any) { … }
TEST_F(HostResolverManagerDnsTest, FallbackOnAbortBySource_Dns) { … }
TEST_F(HostResolverManagerDnsTest,
DisableInsecureDnsClient_SecureDnsTasksUnaffected) { … }
TEST_F(HostResolverManagerDnsTest, DnsTaskUnspec) { … }
TEST_F(HostResolverManagerDnsTest, NameCollisionIcann) { … }
TEST_F(HostResolverManagerDnsTest, ServeFromHosts) { … }
TEST_F(HostResolverManagerDnsTest,
SkipHostsWithUpcomingHostResolverSystemTask) { … }
TEST_F(HostResolverManagerDnsTest, BypassDnsTask) { … }
#if BUILDFLAG(ENABLE_MDNS)
TEST_F(HostResolverManagerDnsTest, BypassDnsToMdnsWithNonAddress) { … }
#endif
TEST_F(HostResolverManagerDnsTest, DnsNotBypassedWhenDnsSource) { … }
TEST_F(HostResolverManagerDnsTest, SystemOnlyBypassesDnsTask) { … }
TEST_F(HostResolverManagerDnsTest,
DisableInsecureDnsClientOnPersistentFailure) { … }
TEST_F(HostResolverManagerDnsTest, SecureDnsWorksAfterInsecureFailure) { … }
TEST_F(HostResolverManagerDnsTest, DontDisableDnsClientOnSporadicFailure) { … }
void HostResolverManagerDnsTest::Ipv6UnreachableTest(bool is_async) { … }
TEST_F(HostResolverManagerDnsTest, Ipv6UnreachableAsync) { … }
TEST_F(HostResolverManagerDnsTest, Ipv6UnreachableSync) { … }
void HostResolverManagerDnsTest::Ipv6UnreachableInvalidConfigTest(
bool is_async) { … }
TEST_F(HostResolverManagerDnsTest, Ipv6Unreachable_InvalidConfigAsync) { … }
TEST_F(HostResolverManagerDnsTest, Ipv6Unreachable_InvalidConfigSync) { … }
TEST_F(HostResolverManagerDnsTest, Ipv6Unreachable_UseLocalIpv6) { … }
TEST_F(HostResolverManagerDnsTest, Ipv6Unreachable_Localhost) { … }
TEST_F(HostResolverManagerDnsTest, Ipv6UnreachableOnlyDisablesAAAAQuery) { … }
TEST_F(HostResolverManagerDnsTest, SeparateJobsBySecureDnsMode) { … }
TEST_F(HostResolverManagerDnsTest, CancelWithOneTransactionActive) { … }
TEST_F(HostResolverManagerDnsTest, CancelWithOneTransactionActiveOnePending) { … }
TEST_F(HostResolverManagerDnsTest, CancelWithTwoTransactionsActive) { … }
TEST_F(HostResolverManagerDnsTest, DeleteWithActiveTransactions) { … }
TEST_F(HostResolverManagerDnsTest, DeleteWithSecureTransactions) { … }
TEST_F(HostResolverManagerDnsTest, DeleteWithCompletedRequests) { … }
TEST_F(HostResolverManagerDnsTest, CancelWithIPv6TransactionActive) { … }
TEST_F(HostResolverManagerDnsTest, CancelWithIPv4TransactionPending) { … }
TEST_F(HostResolverManagerDnsTest, CancelWithAutomaticModeTransactionPending) { … }
TEST_F(HostResolverManagerDnsTest, AAAACompletesFirst) { … }
TEST_F(HostResolverManagerDnsTest, AAAACompletesFirst_AutomaticMode) { … }
TEST_F(HostResolverManagerDnsTest, SecureDnsMode_Automatic) { … }
TEST_F(HostResolverManagerDnsTest, SecureDnsMode_Automatic_SecureCache) { … }
TEST_F(HostResolverManagerDnsTest, SecureDnsMode_Automatic_InsecureCache) { … }
TEST_F(HostResolverManagerDnsTest, SecureDnsMode_Automatic_Downgrade) { … }
TEST_F(HostResolverManagerDnsTest, SecureDnsMode_Automatic_Unavailable) { … }
TEST_F(HostResolverManagerDnsTest, SecureDnsMode_Automatic_Unavailable_Fail) { … }
TEST_F(HostResolverManagerDnsTest,
SecureDnsMode_Automatic_UnavailableByContext) { … }
TEST_F(HostResolverManagerDnsTest, SecureDnsMode_Automatic_Stale) { … }
TEST_F(HostResolverManagerDnsTest,
SecureDnsMode_Automatic_InsecureAsyncDisabled) { … }
TEST_F(HostResolverManagerDnsTest, SecureDnsMode_Automatic_DotActive) { … }
TEST_F(HostResolverManagerDnsTest, SecureDnsMode_Secure) { … }
TEST_F(HostResolverManagerDnsTest, SecureDnsMode_Secure_InsecureAsyncDisabled) { … }
TEST_F(HostResolverManagerDnsTest, SecureDnsMode_Secure_Local_CacheMiss) { … }
TEST_F(HostResolverManagerDnsTest, SecureDnsMode_Secure_Local_CacheHit) { … }
TEST_F(HostResolverManagerDnsTest,
SecureDnsModeIsSecureAndAAAAServfailCausesFailDespiteAResults) { … }
TEST_F(HostResolverManagerDnsTest, SlowResolve) { … }
TEST_F(HostResolverManagerDnsTest, SlowSecureResolve_AutomaticMode) { … }
TEST_F(HostResolverManagerDnsTest, SlowSecureResolve_SecureMode) { … }
TEST_F(HostResolverManagerDnsTest, SerialResolver) { … }
TEST_F(HostResolverManagerDnsTest, AAAAStartsAfterOtherJobFinishes) { … }
TEST_F(HostResolverManagerDnsTest, IPv4EmptyFallback) { … }
TEST_F(HostResolverManagerDnsTest, UnspecEmptyFallback) { … }
TEST_F(HostResolverManagerDnsTest, InvalidDnsConfigWithPendingRequests) { … }
TEST_F(HostResolverManagerDnsTest, DontAbortOnInitialDNSConfigRead) { … }
TEST_F(HostResolverManagerDnsTest,
AutomaticallyDisableInsecureDnsClientWithPendingRequests) { … }
TEST_F(HostResolverManagerDnsTest,
ManuallyDisableDnsClientWithPendingRequests) { … }
TEST_F(HostResolverManagerDnsTest, DnsCallsWithDisabledDnsClient) { … }
TEST_F(HostResolverManagerDnsTest,
DnsCallsWithDisabledDnsClient_DisabledAtConstruction) { … }
TEST_F(HostResolverManagerDnsTest, DnsCallsWithNoDnsConfig) { … }
TEST_F(HostResolverManagerDnsTest, NoCheckIpv6OnWifi) { … }
TEST_F(HostResolverManagerDnsTest, NotFoundTtl) { … }
TEST_F(HostResolverManagerDnsTest, NotFoundTtlWithHostCache) { … }
TEST_F(HostResolverManagerDnsTest, CachedError) { … }
TEST_F(HostResolverManagerDnsTest, CachedError_AutomaticMode) { … }
TEST_F(HostResolverManagerDnsTest, CachedError_SecureMode) { … }
TEST_F(HostResolverManagerDnsTest, TtlNotSharedBetweenQtypes) { … }
TEST_F(HostResolverManagerDnsTest, CanonicalName) { … }
TEST_F(HostResolverManagerDnsTest, CanonicalName_PreferV6) { … }
TEST_F(HostResolverManagerDnsTest, CanonicalName_V4Only) { … }
TEST_F(HostResolverManagerDnsTest, CanonicalNameWithoutResults) { … }
TEST_F(HostResolverManagerDnsTest, CanonicalNameWithResultsForOnlyOneFamily) { … }
TEST_F(HostResolverManagerDnsTest, CanonicalNameForcesProc) { … }
TEST_F(HostResolverManagerDnsTest, DnsAliases) { … }
TEST_F(HostResolverManagerDnsTest, DnsAliasesAreFixedUp) { … }
TEST_F(HostResolverManagerDnsTest, RejectsLocalhostAlias) { … }
TEST_F(HostResolverManagerDnsTest, NoAdditionalDnsAliases) { … }
TEST_F(HostResolverManagerTest, ResolveLocalHostname) { … }
TEST_F(HostResolverManagerDnsTest, AddDnsOverHttpsServerAfterConfig) { … }
TEST_F(HostResolverManagerDnsTest, AddDnsOverHttpsServerBeforeConfig) { … }
TEST_F(HostResolverManagerDnsTest, AddDnsOverHttpsServerBeforeClient) { … }
TEST_F(HostResolverManagerDnsTest, AddDnsOverHttpsServerAndThenRemove) { … }
class AlwaysFailSocketFactory : public MockClientSocketFactory { … };
class TestDnsObserver : public NetworkChangeNotifier::DNSObserver { … };
#if !BUILDFLAG(IS_IOS)
TEST_F(HostResolverManagerDnsTest, SetDnsConfigOverrides) { … }
TEST_F(HostResolverManagerDnsTest,
SetDnsConfigOverrides_OverrideEverythingCreation) { … }
TEST_F(HostResolverManagerDnsTest, SetDnsConfigOverrides_PartialOverride) { … }
TEST_F(HostResolverManagerDnsTest, SetDnsConfigOverrides_NewConfig) { … }
TEST_F(HostResolverManagerDnsTest, SetDnsConfigOverrides_ClearOverrides) { … }
TEST_F(HostResolverManagerDnsTest, SetDnsConfigOverrides_NoChange) { … }
TEST_F(HostResolverManagerDnsTest, NoBaseConfig_PartialOverrides) { … }
TEST_F(HostResolverManagerDnsTest, NoBaseConfig_OverridesEverything) { … }
TEST_F(HostResolverManagerDnsTest, DohMapping) { … }
TEST_F(HostResolverManagerDnsTest, DohMappingDisabled) { … }
TEST_F(HostResolverManagerDnsTest, DohMappingModeIneligibleForUpgrade) { … }
TEST_F(HostResolverManagerDnsTest,
DohMappingUnhandledOptionsIneligibleForUpgrade) { … }
TEST_F(HostResolverManagerDnsTest, DohMappingWithExclusion) { … }
TEST_F(HostResolverManagerDnsTest, DohMappingIgnoredIfTemplateSpecified) { … }
TEST_F(HostResolverManagerDnsTest,
DohMappingUnhandledOptionsAndTemplateSpecified) { … }
TEST_F(HostResolverManagerDnsTest, DohMappingWithAutomaticDot) { … }
TEST_F(HostResolverManagerDnsTest, DohMappingWithStrictDot) { … }
#endif
TEST_F(HostResolverManagerDnsTest, FlushCacheOnDnsConfigOverridesChange) { … }
TEST_F(HostResolverManagerDnsTest,
FlushContextSessionDataOnDnsConfigOverridesChange) { … }
TEST_F(HostResolverManagerDnsTest, CancellationOnBaseConfigChange) { … }
TEST_F(HostResolverManagerDnsTest,
CancellationOnBaseConfigChange_OverridesEverything) { … }
TEST_F(HostResolverManagerDnsTest, CancelQueriesOnSettingOverrides) { … }
TEST_F(HostResolverManagerDnsTest,
CancelQueriesOnSettingOverrides_SameOverrides) { … }
TEST_F(HostResolverManagerDnsTest, CancelQueriesOnClearingOverrides) { … }
TEST_F(HostResolverManagerDnsTest,
CancelQueriesOnClearingOverrides_NoOverrides) { … }
TEST_F(HostResolverManagerDnsTest,
FlushContextSessionDataOnSystemConfigChange) { … }
TEST_F(HostResolverManagerDnsTest, TxtQuery) { … }
TEST_F(HostResolverManagerDnsTest, TxtQueryRejectsIpLiteral) { … }
TEST_F(HostResolverManagerDnsTest, TxtQuery_MixedWithUnrecognizedType) { … }
TEST_F(HostResolverManagerDnsTest, TxtQuery_InvalidConfig) { … }
TEST_F(HostResolverManagerDnsTest, TxtQuery_NonexistentDomain) { … }
TEST_F(HostResolverManagerDnsTest, TxtQuery_Failure) { … }
TEST_F(HostResolverManagerDnsTest, TxtQuery_Timeout) { … }
TEST_F(HostResolverManagerDnsTest, TxtQuery_Empty) { … }
TEST_F(HostResolverManagerDnsTest, TxtQuery_Malformed) { … }
TEST_F(HostResolverManagerDnsTest, TxtQuery_MismatchedName) { … }
TEST_F(HostResolverManagerDnsTest, TxtQuery_WrongType) { … }
TEST_F(HostResolverManagerDnsTest,
TxtInsecureQueryDisallowedWhenAdditionalTypesDisallowed) { … }
TEST_F(HostResolverManagerDnsTest, TxtDnsQuery) { … }
TEST_F(HostResolverManagerDnsTest, PtrQuery) { … }
TEST_F(HostResolverManagerDnsTest, PtrQueryRejectsIpLiteral) { … }
TEST_F(HostResolverManagerDnsTest, PtrQueryHandlesReverseIpLookup) { … }
TEST_F(HostResolverManagerDnsTest, PtrQuery_NonexistentDomain) { … }
TEST_F(HostResolverManagerDnsTest, PtrQuery_Failure) { … }
TEST_F(HostResolverManagerDnsTest, PtrQuery_Timeout) { … }
TEST_F(HostResolverManagerDnsTest, PtrQuery_Empty) { … }
TEST_F(HostResolverManagerDnsTest, PtrQuery_Malformed) { … }
TEST_F(HostResolverManagerDnsTest, PtrQuery_MismatchedName) { … }
TEST_F(HostResolverManagerDnsTest, PtrQuery_WrongType) { … }
TEST_F(HostResolverManagerDnsTest,
PtrInsecureQueryDisallowedWhenAdditionalTypesDisallowed) { … }
TEST_F(HostResolverManagerDnsTest, PtrDnsQuery) { … }
TEST_F(HostResolverManagerDnsTest, SrvQuery) { … }
TEST_F(HostResolverManagerDnsTest, SrvQueryRejectsIpLiteral) { … }
TEST_F(HostResolverManagerDnsTest, SrvQuery_ZeroWeight) { … }
TEST_F(HostResolverManagerDnsTest, SrvQuery_NonexistentDomain) { … }
TEST_F(HostResolverManagerDnsTest, SrvQuery_Failure) { … }
TEST_F(HostResolverManagerDnsTest, SrvQuery_Timeout) { … }
TEST_F(HostResolverManagerDnsTest, SrvQuery_Empty) { … }
TEST_F(HostResolverManagerDnsTest, SrvQuery_Malformed) { … }
TEST_F(HostResolverManagerDnsTest, SrvQuery_MismatchedName) { … }
TEST_F(HostResolverManagerDnsTest, SrvQuery_WrongType) { … }
TEST_F(HostResolverManagerDnsTest,
SrvInsecureQueryDisallowedWhenAdditionalTypesDisallowed) { … }
TEST_F(HostResolverManagerDnsTest, SrvDnsQuery) { … }
TEST_F(HostResolverManagerDnsTest, HttpsQuery) { … }
TEST_F(HostResolverManagerDnsTest, HttpsQueryForNonStandardPort) { … }
TEST_F(HostResolverManagerDnsTest, HttpsQueryForHttpUpgrade) { … }
TEST_F(HostResolverManagerDnsTest, HttpsQueryForHttpUpgradeFromHttpsPort) { … }
TEST_F(HostResolverManagerDnsTest,
HttpsQueryForHttpUpgradeWithNonStandardPort) { … }
TEST_F(HostResolverManagerDnsTest, HttpsInAddressQuery) { … }
TEST_F(HostResolverManagerDnsTest, HttpsInAddressQueryWithNonstandardPort) { … }
TEST_F(HostResolverManagerDnsTest,
HttpsInAddressQueryWithNonstandardPortAndDefaultServiceName) { … }
TEST_F(HostResolverManagerDnsTest, HttpsInAddressQueryWithAlpnAndEch) { … }
TEST_F(HostResolverManagerDnsTest, HttpsInAddressQueryWithNonMatchingPort) { … }
TEST_F(HostResolverManagerDnsTest, HttpsInAddressQueryWithMatchingPort) { … }
TEST_F(HostResolverManagerDnsTest, HttpsInAddressQueryWithoutAddresses) { … }
TEST_F(HostResolverManagerDnsTest, HttpsQueriedInAddressQueryButNoResults) { … }
TEST_F(HostResolverManagerDnsTest,
MalformedHttpsInResponseInAddressRequestIsIgnored) { … }
TEST_F(HostResolverManagerDnsTest,
MalformedHttpsRdataInAddressRequestIsIgnored) { … }
TEST_F(HostResolverManagerDnsTest,
FailedHttpsInAddressRequestIsFatalWhenFeatureEnabled) { … }
TEST_F(HostResolverManagerDnsTest,
FailedHttpsInAddressRequestIgnoredWhenFeatureDisabled) { … }
TEST_F(
HostResolverManagerDnsTest,
FailedHttpsInAddressRequestAfterAddressFailureIsFatalWhenFeatureEnabled) { … }
TEST_F(
HostResolverManagerDnsTest,
FailedHttpsInAddressRequestAfterAddressFailureIgnoredWhenFeatureDisabled) { … }
TEST_F(HostResolverManagerDnsTest, TimeoutHttpsInAddressRequestIsFatal) { … }
TEST_F(HostResolverManagerDnsTest, ServfailHttpsInAddressRequestIsFatal) { … }
TEST_F(HostResolverManagerDnsTest, UnparsableHttpsInAddressRequestIsFatal) { … }
TEST_F(HostResolverManagerDnsTest, RefusedHttpsInAddressRequestIsIgnored) { … }
TEST_F(HostResolverManagerDnsTest, HttpsInAddressQueryForWssScheme) { … }
TEST_F(HostResolverManagerDnsTest, NoHttpsInAddressQueryWithoutScheme) { … }
TEST_F(HostResolverManagerDnsTest, NoHttpsInAddressQueryForNonHttpScheme) { … }
TEST_F(HostResolverManagerDnsTest,
HttpsInAddressQueryForHttpSchemeWhenUpgradeEnabled) { … }
TEST_F(HostResolverManagerDnsTest,
HttpsInAddressQueryForHttpSchemeWhenUpgradeEnabledWithAliasRecord) { … }
TEST_F(
HostResolverManagerDnsTest,
HttpsInAddressQueryForHttpSchemeWhenUpgradeEnabledWithIncompatibleServiceRecord) { … }
TEST_F(HostResolverManagerDnsTest,
HttpsInAddressQueryForHttpSchemeWhenUpgradeEnabledWithoutAddresses) { … }
TEST_F(HostResolverManagerDnsTest, HttpsInSecureModeAddressQuery) { … }
TEST_F(HostResolverManagerDnsTest, HttpsInSecureModeAddressQueryForHttpScheme) { … }
TEST_F(HostResolverManagerDnsTest, HttpsInInsecureAddressQuery) { … }
TEST_F(HostResolverManagerDnsTest, HttpsInInsecureAddressQueryForHttpScheme) { … }
TEST_F(HostResolverManagerDnsTest, FailedHttpsInInsecureAddressRequestIgnored) { … }
TEST_F(HostResolverManagerDnsTest,
TimeoutHttpsInInsecureAddressRequestIgnored) { … }
TEST_F(HostResolverManagerDnsTest,
ServfailHttpsInInsecureAddressRequestIgnored) { … }
TEST_F(HostResolverManagerDnsTest,
UnparsableHttpsInInsecureAddressRequestIgnored) { … }
TEST_F(HostResolverManagerDnsTest,
HttpsInAddressQueryWaitsWithoutAdditionalTimeout) { … }
TEST_F(HostResolverManagerDnsTest,
HttpsInSecureAddressQueryWithOnlyMinTimeout) { … }
TEST_F(HostResolverManagerDnsTest,
HttpsInSecureAddressQueryWithOnlyMaxTimeout) { … }
TEST_F(HostResolverManagerDnsTest,
HttpsInSecureAddressQueryWithRelativeTimeout) { … }
TEST_F(HostResolverManagerDnsTest,
HttpsInSecureAddressQueryWithMaxTimeoutFirst) { … }
TEST_F(HostResolverManagerDnsTest,
HttpsInAddressQueryWithRelativeTimeoutFirst) { … }
TEST_F(HostResolverManagerDnsTest,
HttpsInAddressQueryWithRelativeTimeoutShorterThanMinTimeout) { … }
TEST_F(HostResolverManagerDnsTest,
HttpsInInsecureAddressQueryWithOnlyMinTimeout) { … }
TEST_F(HostResolverManagerDnsTest,
HttpsInInsecureAddressQueryWithOnlyMaxTimeout) { … }
TEST_F(HostResolverManagerDnsTest,
HttpsInInsecureAddressQueryWithRelativeTimeout) { … }
TEST_F(HostResolverManagerDnsTest,
HttpsInAddressQueryWaitsWithoutTimeoutIfFatal) { … }
TEST_F(HostResolverManagerDnsTest,
HttpsInAddressQueryAlwaysRespectsTimeoutsForInsecure) { … }
TEST_F(HostResolverManagerDnsTest, UnsolicitedHttps) { … }
TEST_F(HostResolverManagerDnsTest, DohProbeRequest) { … }
TEST_F(HostResolverManagerDnsTest, DohProbeRequest_BeforeConfig) { … }
TEST_F(HostResolverManagerDnsTest, DohProbeRequest_InvalidateConfig) { … }
TEST_F(HostResolverManagerDnsTest, DohProbeRequest_RestartOnConnectionChange) { … }
TEST_F(HostResolverManagerDnsTest, MultipleDohProbeRequests) { … }
TEST_F(HostResolverManagerDnsTest,
NewlyRegisteredContext_ConfigBeforeRegistration) { … }
TEST_F(HostResolverManagerDnsTest,
NewlyRegisteredContext_NoConfigAtRegistration) { … }
TEST_F(HostResolverManagerDnsTest, AvoidMulticastIgnoredWithDnsTask) { … }
class MockAddressSorter : public AddressSorter { … };
TEST_F(HostResolverManagerDnsTest, ResultsAreSorted) { … }
TEST_F(HostResolverManagerDnsTest, ResultsAreSortedWithHostCache) { … }
TEST_F(HostResolverManagerDnsTest, Ipv4OnlyResultsAreSorted) { … }
TEST_F(HostResolverManagerDnsTest, Ipv4OnlyResultsNotSortedWithHostCache) { … }
TEST_F(HostResolverManagerDnsTest, EmptyResultsNotSorted) { … }
TEST_F(HostResolverManagerDnsTest, EmptyResultsNotSortedWithHostCache) { … }
TEST_F(HostResolverManagerDnsTest, ResultsSortedAsUnreachable) { … }
TEST_F(HostResolverManagerDnsTest, ResultsSortedAsUnreachableWithHostCache) { … }
TEST_F(HostResolverManagerDnsTest, SortFailure) { … }
TEST_F(HostResolverManagerDnsTest, PartialSortFailure) { … }
TEST_F(HostResolverManagerDnsTest, SortFailureWithHostCache) { … }
TEST_F(HostResolverManagerDnsTest, HostResolverCacheContainsTransactions) { … }
TEST_F(HostResolverManagerDnsTest, HostResolverCacheContainsAliasChains) { … }
TEST_F(HostResolverManagerDnsTest,
HostResolverCacheContainsAliasChainsWithErrors) { … }
TEST_F(HostResolverManagerDnsTest,
HostResolverCacheContainsAliasChainsWithNoTtlErrors) { … }
TEST_F(HostResolverManagerDnsTest, NetworkErrorsNotSavedInHostCache) { … }
TEST_F(HostResolverManagerDnsTest, PartialNetworkErrorsNotSavedInHostCache) { … }
TEST_F(HostResolverManagerDnsTest, NetworkErrorsNotSavedInHostResolverCache) { … }
TEST_F(HostResolverManagerDnsTest,
PartialNetworkErrorsNotSavedInHostResolverCache) { … }
TEST_F(HostResolverManagerDnsTest, MalformedResponsesNotSavedInHostCache) { … }
TEST_F(HostResolverManagerDnsTest,
PartialMalformedResponsesNotSavedInHostCache) { … }TEST_F(HostResolverManagerDnsTest,
MalformedResponsesNotSavedInHostResolverCache) { … }TEST_F(HostResolverManagerDnsTest,
PartialMalformedResponsesNotSavedInHostResolverCache) { … }TEST_F(HostResolverManagerDnsTest, HttpToHttpsUpgradeSavedInHostCache) { … }TEST_F(HostResolverManagerDnsTest,
HttpToHttpsUpgradeAfterAddressesSavedInHostResolverCache) { … }class HostResolverManagerBootstrapTest : public HostResolverManagerDnsTest { … }std::vector<IPAddress> IPAddresses(const std::vector<IPEndPoint>& endpoints) { … }std::vector<IPAddress> IPAddresses(const AddressList& addresses) { … }MATCHER_P(AddressesMatch, expected, "Matches addresses between AddressLists") { … }TEST_F(HostResolverManagerBootstrapTest, BlankSlate) { … }TEST_F(HostResolverManagerBootstrapTest, InsecureCacheEntry) { … }TEST_F(HostResolverManagerBootstrapTest, SecureCacheEntry) { … }TEST_F(HostResolverManagerBootstrapTest, OnlyBootstrap) { … }TEST_F(HostResolverManagerBootstrapTest, BootstrapAndInsecureCache) { … }TEST_F(HostResolverManagerBootstrapTest, BootstrapAndSecureCacheEntry) { … }TEST_F(HostResolverManagerBootstrapTest, BlankSlateFailure) { … }TEST_F(HostResolverManagerBootstrapTest, BootstrapFollowupFailure) { … }TEST_F(HostResolverManagerBootstrapTest, ContextClose) { … }TEST_F(HostResolverManagerBootstrapTest, BootstrapAfterFollowup) { … }TEST_F(HostResolverManagerBootstrapTest, BootstrapFollowupFailureTwice) { … }TEST_F(HostResolverManagerBootstrapTest, OnlyBootstrapTwice) { … }void HostResolverManagerTest::IPv4AddressLiteralInIPv6OnlyNetworkTest(
bool is_async) { … }TEST_F(HostResolverManagerTest, IPv4AddressLiteralInIPv6OnlyNetworkAsync) { … }TEST_F(HostResolverManagerTest, IPv4AddressLiteralInIPv6OnlyNetworkSync) { … }void HostResolverManagerTest::IPv4AddressLiteralInIPv6OnlyNetworkPort443Test(
bool is_async) { … }TEST_F(HostResolverManagerTest,
IPv4AddressLiteralInIPv6OnlyNetworkPort443Async) { … }TEST_F(HostResolverManagerTest,
IPv4AddressLiteralInIPv6OnlyNetworkPort443Sync) { … }void HostResolverManagerTest::IPv4AddressLiteralInIPv6OnlyNetworkNoDns64Test(
bool is_async) { … }TEST_F(HostResolverManagerTest,
IPv4AddressLiteralInIPv6OnlyNetworkNoDns64Async) { … }TEST_F(HostResolverManagerTest,
IPv4AddressLiteralInIPv6OnlyNetworkNoDns64Sync) { … }void HostResolverManagerTest::IPv4AddressLiteralInIPv6OnlyNetworkBadAddressTest(
bool is_async) { … }TEST_F(HostResolverManagerTest,
IPv4AddressLiteralInIPv6OnlyNetworkBadAddressAsync) { … }TEST_F(HostResolverManagerTest,
IPv4AddressLiteralInIPv6OnlyNetworkBadAddressSync) { … }