#include "net/dns/host_resolver_cache.h"
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include "base/test/simple_test_clock.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/time/time.h"
#include "net/base/connection_endpoint_metadata.h"
#include "net/base/connection_endpoint_metadata_test_util.h"
#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/base/network_anonymization_key.h"
#include "net/base/schemeful_site.h"
#include "net/dns/host_resolver_internal_result.h"
#include "net/dns/host_resolver_internal_result_test_util.h"
#include "net/dns/public/dns_query_type.h"
#include "net/dns/public/host_resolver_source.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
namespace net {
namespace {
ElementsAre;
Eq;
IsEmpty;
Ne;
Optional;
Pair;
Pointee;
MATCHER(IsNotStale, "") { … }
MATCHER_P(IsNotStale, result_matcher, "") { … }
MATCHER_P(TimeDeltaIsApproximately, approximate_expectation, "") { … }
MATCHER_P2(IsStale, expired_by_matcher, expected_stale_by_generation, "") { … }
MATCHER_P3(IsStale,
result_matcher,
expired_by_matcher,
expected_stale_by_generation,
"") { … }
class HostResolverCacheTest : public ::testing::Test { … };
TEST_F(HostResolverCacheTest, CacheAResult) { … }
TEST_F(HostResolverCacheTest, CacheAaaaResult) { … }
TEST_F(HostResolverCacheTest, CacheHttpsResult) { … }
TEST_F(HostResolverCacheTest, RespectsSchemeAndPortInName) { … }
TEST_F(HostResolverCacheTest, CacheHttpsAliasResult) { … }
TEST_F(HostResolverCacheTest, CacheCnameAliasResult) { … }
TEST_F(HostResolverCacheTest, CacheWildcardAlias) { … }
TEST_F(HostResolverCacheTest, CacheErrorResult) { … }
TEST_F(HostResolverCacheTest, ResultsCanBeUpdated) { … }
TEST_F(HostResolverCacheTest, UpdateCanReplaceWildcard) { … }
TEST_F(HostResolverCacheTest, WildcardUpdateCanReplaceSpecifics) { … }
TEST_F(HostResolverCacheTest, LookupNameIsCanonicalized) { … }
TEST_F(HostResolverCacheTest, LookupIgnoresExpiredResults) { … }
TEST_F(HostResolverCacheTest, ExpiredResultsCanBeUpdated) { … }
TEST_F(HostResolverCacheTest, LookupIgnoresResultsMarkedStale) { … }
TEST_F(HostResolverCacheTest, MarkedStaleResultsCanBeUpdated) { … }
TEST_F(HostResolverCacheTest, RespectsNetworkAnonymizationKey) { … }
TEST_F(HostResolverCacheTest, UpdateToStale) { … }
TEST_F(HostResolverCacheTest, PreferMoreRecentInsecureResult) { … }
TEST_F(HostResolverCacheTest, PreferMoreRecentSecureResult) { … }
TEST_F(HostResolverCacheTest, PreferMoreSecureResult) { … }
TEST_F(HostResolverCacheTest, LookupStalePrefersNonStaleResult) { … }
TEST_F(HostResolverCacheTest, InsecureLookupStalePrefersNonStaleResult) { … }
TEST_F(HostResolverCacheTest, LookupStalePrefersLeastStaleByGeneration) { … }
TEST_F(HostResolverCacheTest, LookupStalePrefersLeastStaleByExpiration) { … }
TEST_F(HostResolverCacheTest, LookupStalePrefersMostSecure) { … }
TEST_F(HostResolverCacheTest, LookupStalePrefersMostSecureNonStale) { … }
TEST_F(HostResolverCacheTest, LookupStalePrefersMoreRecent) { … }
TEST_F(HostResolverCacheTest, EvictStaleResults) { … }
TEST_F(HostResolverCacheTest, EvictSoonestToExpireResult) { … }
TEST_F(HostResolverCacheTest, EvictLeastSecureResult) { … }
TEST_F(HostResolverCacheTest, EvictOldestResult) { … }
TEST_F(HostResolverCacheTest, EvictLatestResult) { … }
TEST_F(HostResolverCacheTest, SerializeAndDeserialize) { … }
TEST_F(HostResolverCacheTest, TransientAnonymizationKeyNotSerialized) { … }
TEST_F(HostResolverCacheTest, DeserializePrefersExistingResults) { … }
TEST_F(HostResolverCacheTest, DeserializeStopsBeforeEviction) { … }
TEST_F(HostResolverCacheTest, SerializeForLogging) { … }
}
}