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

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: add 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 e9cd79bced354ff6e47807adf5d93b39a32e1a28..2ac1456100953bac2247799accacf64bd1241649 100644
--- a/net/base/net_util_unittest.cc
+++ b/net/base/net_util_unittest.cc
@@ -794,6 +794,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"));
@@ -807,6 +808,13 @@ 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_FALSE(net::IsLocalhostTLD("foo.localhos"));
Ryan Sleevi 2015/02/19 22:24:56 Add for the .suffix case foo.localhost.
estark 2015/02/20 01:55:19 Done.
+ EXPECT_FALSE(net::IsLocalhostTLD("foo.localhost.com"));
}
// Verify GetNetworkList().

Powered by Google App Engine
This is Rietveld 408576698