#include "net/dns/resolve_context.h"
#include <stdint.h>
#include <memory>
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/time/time.h"
#include "net/base/address_list.h"
#include "net/base/features.h"
#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
#include "net/base/mock_network_change_notifier.h"
#include "net/base/network_change_notifier.h"
#include "net/base/network_isolation_key.h"
#include "net/dns/dns_config.h"
#include "net/dns/dns_server_iterator.h"
#include "net/dns/dns_session.h"
#include "net/dns/dns_util.h"
#include "net/dns/host_cache.h"
#include "net/dns/public/dns_over_https_config.h"
#include "net/dns/public/dns_over_https_server_config.h"
#include "net/dns/public/dns_protocol.h"
#include "net/dns/public/dns_query_type.h"
#include "net/dns/public/host_resolver_source.h"
#include "net/dns/public/secure_dns_mode.h"
#include "net/socket/socket_test_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"
namespace net {
namespace {
class ResolveContextTest : public ::testing::Test, public WithTaskEnvironment { … };
DnsConfig CreateDnsConfig(int num_servers, int num_doh_servers) { … }
DnsConfig CreateDnsConfigWithKnownDohProviderConfig() { … }
TEST_F(ResolveContextTest, ReusedSessionPointer) { … }
TEST_F(ResolveContextTest, DohServerAvailability_InitialAvailability) { … }
TEST_F(ResolveContextTest, DohServerAvailability_RecordedSuccess) { … }
TEST_F(ResolveContextTest, DohServerAvailability_NoCurrentSession) { … }
TEST_F(ResolveContextTest, DohServerAvailability_DifferentSession) { … }
TEST_F(ResolveContextTest, DohServerIndexToUse) { … }
TEST_F(ResolveContextTest, DohServerIndexToUse_NoneEligible) { … }
TEST_F(ResolveContextTest, DohServerIndexToUse_SecureMode) { … }
TEST_F(ResolveContextTest, StartDohAutoupgradeSuccessTimer) { … }
class TestDnsObserver : public NetworkChangeNotifier::DNSObserver { … };
TEST_F(ResolveContextTest, DohServerAvailabilityNotification) { … }
TEST_F(ResolveContextTest, HostCacheInvalidation) { … }
TEST_F(ResolveContextTest, HostCacheInvalidation_SameSession) { … }
TEST_F(ResolveContextTest, Failures_Consecutive) { … }
TEST_F(ResolveContextTest, Failures_NonConsecutive) { … }
TEST_F(ResolveContextTest, Failures_NoSession) { … }
TEST_F(ResolveContextTest, Failures_DifferentSession) { … }
TEST_F(ResolveContextTest, TwoFailures) { … }
class TestDohStatusObserver : public ResolveContext::DohStatusObserver { … };
TEST_F(ResolveContextTest, DohFailures_Consecutive) { … }
TEST_F(ResolveContextTest, DohFailures_NonConsecutive) { … }
TEST_F(ResolveContextTest, DohFailures_SuccessAfterFailures) { … }
TEST_F(ResolveContextTest, DohFailures_NoSession) { … }
TEST_F(ResolveContextTest, DohFailures_DifferentSession) { … }
TEST_F(ResolveContextTest, DohFailures_NeverSuccessful) { … }
TEST_F(ResolveContextTest, DohFailures_NeverSuccessfulKnownProviderConfig) { … }
TEST_F(ResolveContextTest, TwoDohFailures) { … }
TEST_F(ResolveContextTest, FallbackPeriod_Default) { … }
TEST_F(ResolveContextTest, FallbackPeriod_ShortConfigured) { … }
TEST_F(ResolveContextTest, FallbackPeriod_LongConfigured) { … }
TEST_F(ResolveContextTest, FallbackPeriod_LongRtt) { … }
TEST_F(ResolveContextTest, FallbackPeriod_NoSession) { … }
TEST_F(ResolveContextTest, FallbackPeriod_DifferentSession) { … }
TEST_F(ResolveContextTest, SecureTransactionTimeout_SmallFallbackPeriod) { … }
TEST_F(ResolveContextTest, SecureTransactionTimeout_LongFallbackPeriod) { … }
TEST_F(ResolveContextTest, SecureTransactionTimeout_LongRtt) { … }
TEST_F(ResolveContextTest, SecureTransactionTimeout_DifferentSession) { … }
TEST_F(ResolveContextTest, ClassicTransactionTimeout_SmallFallbackPeriod) { … }
TEST_F(ResolveContextTest, ClassicTransactionTimeout_LongFallbackPeriod) { … }
TEST_F(ResolveContextTest, ClassicTransactionTimeout_LongRtt) { … }
TEST_F(ResolveContextTest, ClassicTransactionTimeout_DifferentSession) { … }
TEST_F(ResolveContextTest, NegativeRtt) { … }
TEST_F(ResolveContextTest, SessionChange) { … }
TEST_F(ResolveContextTest, SessionChange_NoSession) { … }
TEST_F(ResolveContextTest, SessionChange_NoDohServers) { … }
}
}