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

Unified Diff: net/dns/dns_hosts_unittest.cc

Issue 2294343003: Refuse to resolve some types of invalid DNS addresses. (Closed)
Patch Set: Oops Created 4 years, 3 months 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
« no previous file with comments | « net/dns/dns_hosts.cc ('k') | net/dns/dns_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/dns_hosts_unittest.cc
diff --git a/net/dns/dns_hosts_unittest.cc b/net/dns/dns_hosts_unittest.cc
index 9e52f0e229a7a951d65922b488059dc50fbe4946..727220172060e729d421a8816edcc2aa8e852c35 100644
--- a/net/dns/dns_hosts_unittest.cc
+++ b/net/dns/dns_hosts_unittest.cc
@@ -48,22 +48,26 @@ TEST(DnsHostsTest, ParseHosts) {
"256.0.0.0 cache3 # bogus IP should not clear parsed IP cache\n"
"127.0.0.1 cache4 # should still be reused\n"
"127.0.0.2 cache5\n"
+ "127.0.0.3 .foo # entries with leading dot are ignored\n"
+ "127.0.0.3 . # just a dot is ignored\n"
+ "127.0.0.4 bar. # trailing dot is allowed, for now\n"
"gibberish";
const ExpectedHostsEntry kEntries[] = {
- { "localhost", ADDRESS_FAMILY_IPV4, "127.0.0.1" },
- { "localhost.localdomain", ADDRESS_FAMILY_IPV4, "127.0.0.1" },
- { "company", ADDRESS_FAMILY_IPV4, "1.0.0.1" },
- { "localhost", ADDRESS_FAMILY_IPV6, "::1" },
- { "ip6-localhost", ADDRESS_FAMILY_IPV6, "::1" },
- { "ip6-loopback", ADDRESS_FAMILY_IPV6, "::1" },
- { "ip6-localnet", ADDRESS_FAMILY_IPV6, "fe00::0" },
- { "company", ADDRESS_FAMILY_IPV6, "2048::1" },
- { "example", ADDRESS_FAMILY_IPV6, "2048::2" },
- { "cache1", ADDRESS_FAMILY_IPV4, "127.0.0.1" },
- { "cache2", ADDRESS_FAMILY_IPV4, "127.0.0.1" },
- { "cache4", ADDRESS_FAMILY_IPV4, "127.0.0.1" },
- { "cache5", ADDRESS_FAMILY_IPV4, "127.0.0.2" },
+ {"localhost", ADDRESS_FAMILY_IPV4, "127.0.0.1"},
+ {"localhost.localdomain", ADDRESS_FAMILY_IPV4, "127.0.0.1"},
+ {"company", ADDRESS_FAMILY_IPV4, "1.0.0.1"},
+ {"localhost", ADDRESS_FAMILY_IPV6, "::1"},
+ {"ip6-localhost", ADDRESS_FAMILY_IPV6, "::1"},
+ {"ip6-loopback", ADDRESS_FAMILY_IPV6, "::1"},
+ {"ip6-localnet", ADDRESS_FAMILY_IPV6, "fe00::0"},
+ {"company", ADDRESS_FAMILY_IPV6, "2048::1"},
+ {"example", ADDRESS_FAMILY_IPV6, "2048::2"},
+ {"cache1", ADDRESS_FAMILY_IPV4, "127.0.0.1"},
+ {"cache2", ADDRESS_FAMILY_IPV4, "127.0.0.1"},
+ {"cache4", ADDRESS_FAMILY_IPV4, "127.0.0.1"},
+ {"cache5", ADDRESS_FAMILY_IPV4, "127.0.0.2"},
+ {"bar.", ADDRESS_FAMILY_IPV4, "127.0.0.4"},
};
DnsHosts expected_hosts, actual_hosts;
« no previous file with comments | « net/dns/dns_hosts.cc ('k') | net/dns/dns_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698