#include "net/dns/context_host_resolver.h"
#include <memory>
#include <optional>
#include <utility>
#include "base/containers/fixed_flat_map.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/test/task_environment.h"
#include "base/time/time.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_isolation_key.h"
#include "net/base/schemeful_site.h"
#include "net/base/test_completion_callback.h"
#include "net/dns/dns_config.h"
#include "net/dns/dns_test_util.h"
#include "net/dns/dns_util.h"
#include "net/dns/host_cache.h"
#include "net/dns/host_resolver.h"
#include "net/dns/host_resolver_manager.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/public/dns_over_https_config.h"
#include "net/dns/public/dns_protocol.h"
#include "net/dns/public/host_resolver_source.h"
#include "net/dns/public/resolve_error_info.h"
#include "net/dns/resolve_context.h"
#include "net/log/net_log_with_source.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"
#if BUILDFLAG(IS_ANDROID)
#include "base/android/build_info.h"
#include "net/android/network_change_notifier_factory_android.h"
#endif
namespace net {
namespace {
const IPEndPoint kEndpoint(IPAddress(1, 2, 3, 4), 100);
}
class ContextHostResolverTest : public ::testing::Test,
public WithTaskEnvironment { … };
TEST_F(ContextHostResolverTest, Resolve) { … }
TEST_F(ContextHostResolverTest, ResolveWithScheme) { … }
TEST_F(ContextHostResolverTest, ResolveWithSchemeAndIpLiteral) { … }
TEST_F(ContextHostResolverTest, DestroyRequest) { … }
TEST_F(ContextHostResolverTest, DohProbeRequest) { … }
TEST_F(ContextHostResolverTest, DohProbesFromSeparateContexts) { … }
TEST_F(ContextHostResolverTest, DestroyResolver) { … }
TEST_F(ContextHostResolverTest, DestroyResolver_CompletedRequests) { … }
TEST_F(ContextHostResolverTest, DestroyResolver_DelayedStartRequest) { … }
TEST_F(ContextHostResolverTest, DestroyResolver_DelayedStartDohProbeRequest) { … }
TEST_F(ContextHostResolverTest, OnShutdown_PendingRequest) { … }
TEST_F(ContextHostResolverTest, OnShutdown_CompletedRequests) { … }
TEST_F(ContextHostResolverTest, OnShutdown_SubsequentRequests) { … }
TEST_F(ContextHostResolverTest, OnShutdown_SubsequentDohProbeRequest) { … }
TEST_F(ContextHostResolverTest, OnShutdown_DelayedStartRequest) { … }
TEST_F(ContextHostResolverTest, OnShutdown_DelayedStartDohProbeRequest) { … }
TEST_F(ContextHostResolverTest, ResolveFromCache) { … }
TEST_F(ContextHostResolverTest, ResultsAddedToCache) { … }
TEST_F(ContextHostResolverTest, ResultsAddedToCacheWithNetworkIsolationKey) { … }
TEST_F(ContextHostResolverTest, HostCacheInvalidation) { … }
class FakeServiceEndpontRequestDelegate
: public HostResolver::ServiceEndpointRequest::Delegate { … };
class ContextHostResolverServiceEndpointTest : public ContextHostResolverTest { … };
TEST_F(ContextHostResolverServiceEndpointTest, Resolve) { … }
TEST_F(ContextHostResolverServiceEndpointTest, DestroyResolver) { … }
class NetworkBoundResolveContext : public ResolveContext { … };
class NetworkAwareHostResolverProc : public HostResolverProc { … };
TEST_F(ContextHostResolverTest, ExistingNetworkBoundLookup) { … }
TEST_F(ContextHostResolverTest, NotExistingNetworkBoundLookup) { … }
TEST_F(ContextHostResolverTest, NetworkBoundResolverCacheInvalidation) { … }
}