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

Unified Diff: net/base/url_util_unittest.cc

Issue 632843003: Add a function to escape a query part of url (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename the function to EscapeQueryParameters 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/url_util.h ('K') | « net/base/url_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/url_util_unittest.cc
diff --git a/net/base/url_util_unittest.cc b/net/base/url_util_unittest.cc
index 158e2740306e29bcdcfd1ab53b6d5cfcbd39af43..1576464eb0b3538eb8eaf5e1d62c427335ef0215 100644
--- a/net/base/url_util_unittest.cc
+++ b/net/base/url_util_unittest.cc
@@ -159,5 +159,26 @@ TEST(UrlUtilTest, ParseQueryInvalidURL) {
EXPECT_TRUE(it.IsAtEnd());
}
+TEST(UrlUtilTest, EscapeQueryPart) {
+ EXPECT_EQ("http://example.com/test?q=a%7Cb%7Cc",
+ EscapeQueryParameters(GURL("http://example.com/test?q=a%7Cb%7Cc"))
+ .spec());
+
+ EXPECT_EQ(
+ "http://example.com/test?q=a%7Cb%7Cc",
+ EscapeQueryParameters(GURL("http://example.com/test?q=a|b|c")).spec());
+
+ EXPECT_EQ("http://example.com/test?q=a%7Cb%7Cc&q=1%7C2%7C3",
+ EscapeQueryParameters(
+ GURL("http://example.com/test?q=a|b|c&q=1|2|3")).spec());
+
+ EXPECT_EQ("http://example.com/test?q=a%7Cb%7Cc&q2=1%7C2%7C3",
+ EscapeQueryParameters(
+ GURL("http://example.com/test?q=a|b|c&q2=1|2|3")).spec());
+
+ EXPECT_EQ("http://example.com/",
+ EscapeQueryParameters(GURL("http://example.com/")).spec());
+}
+
} // namespace
} // namespace net
« net/base/url_util.h ('K') | « net/base/url_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698