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

Unified Diff: net/base/escape_unittest.cc

Issue 646333002: Update EscapeExternalHandlerValue to keep '#', '[', and ']' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments Created 6 years, 2 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
« net/base/escape.cc ('K') | « net/base/escape.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/escape_unittest.cc
diff --git a/net/base/escape_unittest.cc b/net/base/escape_unittest.cc
index 74ae29336d82c2f1ea1379edb196a9b8392b0a1b..4319fe5eff99d130f70d4bc1dc4188743bd706ef 100644
--- a/net/base/escape_unittest.cc
+++ b/net/base/escape_unittest.cc
@@ -453,6 +453,29 @@ TEST(EscapeTest, UnescapeForHTML) {
}
}
+TEST(EscapeTest, EscapeExternalHandlerValue) {
asanka 2014/10/23 07:20:04 Add a test case for invalid percent escape sequenc
asanka 2014/10/23 07:20:04 Have a test case for our identity set: "!#$&'()*+
Jaekyun Seok (inactive) 2014/10/23 12:43:19 Done.
Jaekyun Seok (inactive) 2014/10/23 12:43:19 Done.
+ ASSERT_EQ(
+ // Escaped
+ "%02%0A%1D%20!%22#$%25&'()*+,-./0123456789:;"
+ "%3C=%3E?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "[%5C]%5E_%60abcdefghijklmnopqrstuvwxyz"
+ "%7B%7C%7D~%7F%80%FF",
+ // Most of the character space we care about, un-escaped
+ EscapeExternalHandlerValue(
+ "\x02\n\x1d !\"#$%&'()*+,-./0123456789:;"
+ "<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "[\\]^_`abcdefghijklmnopqrstuvwxyz"
+ "{|}~\x7f\x80\xff"));
+
+ ASSERT_EQ("http://example.com/path/sub?q=a%7Cb%7Cc&q=1%7C2%7C3#ref%7C",
+ EscapeExternalHandlerValue(
+ "http://example.com/path/sub?q=a|b|c&q=1|2|3#ref|"));
+ ASSERT_EQ("http://example.com/path/sub?q=a%7Cb%7Cc&q=1%7C2%7C3#ref%7C",
+ EscapeExternalHandlerValue(
+ "http://example.com/path/sub?q=a%7Cb%7Cc&q=1%7C2%7C3#ref%7C"));
+ ASSERT_EQ("http://[2001:db8:0:1]:80",
+ EscapeExternalHandlerValue("http://[2001:db8:0:1]:80"));
+}
} // namespace
} // namespace net
« net/base/escape.cc ('K') | « net/base/escape.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698