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

Unified Diff: net/base/escape_unittest.cc

Issue 681713002: Update from chromium https://crrev.com/301315 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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
« no previous file with comments | « net/base/escape.cc ('k') | net/base/net_log_logger.cc » ('j') | 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 1e82239b8959430bb66713b9e532d2c1d560c508..4d3bcbdd40c029025f0881c9b102e5bd4e80b344 100644
--- a/net/base/escape_unittest.cc
+++ b/net/base/escape_unittest.cc
@@ -479,6 +479,43 @@ TEST(EscapeTest, UnescapeForHTML) {
}
}
+TEST(EscapeTest, EscapeExternalHandlerValue) {
+ 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(
+ "!#$&'()*+,-./0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]_"
+ "abcdefghijklmnopqrstuvwxyz~",
+ EscapeExternalHandlerValue(
+ "!#$&'()*+,-./0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]_"
+ "abcdefghijklmnopqrstuvwxyz~"));
+
+ ASSERT_EQ("%258k", EscapeExternalHandlerValue("%8k"));
+ ASSERT_EQ("a%25", EscapeExternalHandlerValue("a%"));
+ ASSERT_EQ("%25a", EscapeExternalHandlerValue("%a"));
+ ASSERT_EQ("a%258", EscapeExternalHandlerValue("a%8"));
+ ASSERT_EQ("%ab", EscapeExternalHandlerValue("%ab"));
+ ASSERT_EQ("%AB", EscapeExternalHandlerValue("%AB"));
+
+ 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
« no previous file with comments | « net/base/escape.cc ('k') | net/base/net_log_logger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698