Chromium Code Reviews| 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 7a46a1c4dc4e3cfc1998858a5fb8bc75bd9b0fe7..770a57a21e2279185fee64f05900d6b4464d3ffb 100644 |
| --- a/net/dns/host_resolver_impl_unittest.cc |
| +++ b/net/dns/host_resolver_impl_unittest.cc |
| @@ -1319,6 +1319,36 @@ TEST_F(HostResolverImplTest, MultipleAttempts) { |
| EXPECT_EQ(resolver_proc->resolved_attempt_number(), kAttemptNumberToResolve); |
| } |
| +// If a host resolves to a list that includes 127.0.53.53, this is treated as |
| +// an error. 127.0.53.53 is a localhost address, however it has been given a |
| +// special significance by ICANN to help surfance name collision resulting from |
| +// the new gTLDs. |
| +TEST_F(HostResolverImplTest, NameCollision127_0_53_53) { |
| + proc_->AddRuleForAllFamilies("single", "127.0.53.53"); |
| + proc_->AddRuleForAllFamilies("multiple", "127.0.0.1,127.0.53.53"); |
| + proc_->AddRuleForAllFamilies("ipv6", "::127.0.53.53"); |
| + proc_->SignalMultiple(3u); |
| + |
| + Request* request; |
| + |
| + request = CreateRequest("single"); |
| + EXPECT_EQ(ERR_IO_PENDING, request->Resolve()); |
| + EXPECT_EQ(ERR_FAILED, request->WaitForResult()); |
|
Ryan Sleevi
2015/03/26 00:32:29
We don't give a better error here? To ensure that
eroman
2015/03/26 00:39:31
d'oh, forgot to update the unittest after adding t
|
| + |
| + request = CreateRequest("multiple"); |
| + EXPECT_EQ(ERR_IO_PENDING, request->Resolve()); |
| + EXPECT_EQ(ERR_FAILED, request->WaitForResult()); |
| + |
| + // Resolving an IP literal of 127.0.53.53 however is allowed. |
| + EXPECT_EQ(OK, CreateRequest("127.0.53.53")->Resolve()); |
| + |
| + // Moreover the address should not be recognized when embedded in an IPv6 |
| + // address. |
| + request = CreateRequest("ipv6"); |
| + EXPECT_EQ(ERR_IO_PENDING, request->Resolve()); |
| + EXPECT_EQ(OK, request->WaitForResult()); |
| +} |
| + |
| DnsConfig CreateValidDnsConfig() { |
| IPAddressNumber dns_ip; |
| bool rv = ParseIPLiteralToNumber("192.168.1.0", &dns_ip); |