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

Unified Diff: net/base/net_util_unittest.cc

Issue 938093003: Always treat .localhost as loopback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rsleevi's comments Created 5 years, 10 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
Index: net/base/net_util_unittest.cc
diff --git a/net/base/net_util_unittest.cc b/net/base/net_util_unittest.cc
index fa2a60b3714c6ed6c54faacb30d94ce838cc8637..dad6b6e6cbf4b3a99ef13a479d1b0a22e6280068 100644
--- a/net/base/net_util_unittest.cc
+++ b/net/base/net_util_unittest.cc
@@ -803,6 +803,7 @@ TEST(NetUtilTest, IsLocalhost) {
EXPECT_TRUE(net::IsLocalhost("127.255.0.0"));
EXPECT_TRUE(net::IsLocalhost("::1"));
EXPECT_TRUE(net::IsLocalhost("0:0:0:0:0:0:0:1"));
+ EXPECT_TRUE(net::IsLocalhost("foo.localhost"));
EXPECT_FALSE(net::IsLocalhost("localhostx"));
EXPECT_FALSE(net::IsLocalhost("foo.localdomain"));
@@ -816,6 +817,14 @@ TEST(NetUtilTest, IsLocalhost) {
EXPECT_FALSE(net::IsLocalhost("0:0:0:0:1:0:0:1"));
EXPECT_FALSE(net::IsLocalhost("::1:1"));
EXPECT_FALSE(net::IsLocalhost("0:0:0:0:0:0:0:0:1"));
+ EXPECT_FALSE(net::IsLocalhost("foo.localhost.com"));
+}
+
+TEST(NetUtilTest, IsLocalhostTLD) {
+ EXPECT_TRUE(net::IsLocalhostTLD("foo.localhost"));
+ EXPECT_TRUE(net::IsLocalhostTLD("foo.localhost."));
+ EXPECT_FALSE(net::IsLocalhostTLD("foo.localhos"));
+ EXPECT_FALSE(net::IsLocalhostTLD("foo.localhost.com"));
Ryan Sleevi 2015/03/24 23:15:20 foo.localhoste ? Just want to make sure we cover
estark 2015/03/25 23:53:33 Done.
}
// Verify GetNetworkList().
« net/base/net_util.cc ('K') | « net/base/net_util.cc ('k') | net/dns/host_resolver_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698