Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(440)

Unified Diff: net/dns/host_resolver_impl_unittest.cc

Issue 2577503003: Misc HostResolverImpl refactors. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« net/dns/host_resolver_impl.cc ('K') | « net/dns/host_resolver_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/host_resolver_impl_unittest.cc
diff --git a/net/dns/host_resolver_impl_unittest.cc b/net/dns/host_resolver_impl_unittest.cc
index 15822d9a1131524965bcd7eb0a88c90e429e7319..0b4807a98518d049d388ef428a1c668e6e10400d 100644
--- a/net/dns/host_resolver_impl_unittest.cc
+++ b/net/dns/host_resolver_impl_unittest.cc
@@ -1503,6 +1503,12 @@ TEST_F(HostResolverImplTest, NameCollisionIcann) {
EXPECT_THAT(request->Resolve(), IsError(ERR_IO_PENDING));
EXPECT_THAT(request->WaitForResult(), IsError(ERR_ICANN_NAME_COLLISION));
+ // ERR_ICANN_NAME_COLLISION is cached like any other error, using a
+ // fixed TTL for failed entries from proc-based resolver. That said, the
+ // fixed TTL is 0, so it will never be cached.
+ request = CreateRequest("single");
+ EXPECT_THAT(request->ResolveFromCache(), IsError(ERR_DNS_CACHE_MISS));
+
request = CreateRequest("multiple");
EXPECT_THAT(request->Resolve(), IsError(ERR_IO_PENDING));
EXPECT_THAT(request->WaitForResult(), IsError(ERR_ICANN_NAME_COLLISION));
@@ -1836,6 +1842,14 @@ TEST_F(HostResolverImplDnsTest, NameCollisionIcann) {
EXPECT_THAT(requests_[1]->WaitForResult(), IsError(OK));
EXPECT_TRUE(requests_[1]->HasAddress("::127.0.53.53", 80));
+
+ // The mock responses for 4collision (and 6collision) have a TTL of 1 day.
+ // Test whether the ERR_ICANN_NAME_COLLISION failure was cached.
+ // On the one hand caching the failure makes sense, as the error is derived
+ // from the IP in the response. However for consistency with the the proc-
+ // based implementation the TTL is unused.
+ EXPECT_THAT(CreateRequest("4collision", 80)->ResolveFromCache(),
+ IsError(ERR_DNS_CACHE_MISS));
}
TEST_F(HostResolverImplDnsTest, ServeFromHosts) {
« net/dns/host_resolver_impl.cc ('K') | « net/dns/host_resolver_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698