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

Unified Diff: net/base/net_util_unittest.cc

Issue 602973002: Change ParseHostAndPort() to not include brackets around IPv6 literals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a comment Created 6 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/base/net_util.cc ('k') | net/proxy/proxy_bypass_rules.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util_unittest.cc
diff --git a/net/base/net_util_unittest.cc b/net/base/net_util_unittest.cc
index 3bb518fd08312959e560c806c90f1f5e6eeaf2ae..5ef1d491193566281d8cafb5e720943a17436dc6 100644
--- a/net/base/net_util_unittest.cc
+++ b/net/base/net_util_unittest.cc
@@ -246,9 +246,20 @@ TEST(NetUtilTest, ParseHostAndPort) {
{
"[1080:0:0:0:8:800:200C:4171]:11",
true,
+ "1080:0:0:0:8:800:200C:4171",
+ 11
+ },
+ {
"[1080:0:0:0:8:800:200C:4171]",
- 11,
+ true,
+ "1080:0:0:0:8:800:200C:4171",
+ -1
},
+
+ // Because no validation is done on the host, the following are accepted,
+ // even though they are invalid names.
+ {"]", true, "]", -1},
+ {"::1", true, ":", 1},
// Invalid inputs:
{"foo:bar", false, "", -1},
{"foo:", false, "", -1},
@@ -262,6 +273,8 @@ TEST(NetUtilTest, ParseHostAndPort) {
{":password@host:80", false, "", -1},
{":password@host", false, "", -1},
{"@host", false, "", -1},
+ {"[", false, "", -1},
+ {"[]", false, "", -1},
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
« no previous file with comments | « net/base/net_util.cc ('k') | net/proxy/proxy_bypass_rules.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698