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

Unified Diff: net/base/url_util_unittest.cc

Issue 24261010: Allow explicitly whitelisted apps/extensions in public sessions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix handing of guest user ID. Created 7 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/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 83ac258650b8c73e6a7e4628b8873af40bce18c2..158e2740306e29bcdcfd1ab53b6d5cfcbd39af43 100644
--- a/net/base/url_util_unittest.cc
+++ b/net/base/url_util_unittest.cc
@@ -108,5 +108,56 @@ TEST(UrlUtilTest, GetValueForKeyInQueryInvalidURL) {
EXPECT_FALSE(GetValueForKeyInQuery(url, "test", &value));
}
+TEST(UrlUtilTest, ParseQuery) {
+ const GURL url("http://example.com/path?name=value&boolParam&"
+ "url=http://test.com/q?n1%3Dv1%26n2&"
+ "multikey=value1&multikey=value2&multikey");
+ QueryIterator it(url);
+
+ ASSERT_FALSE(it.IsAtEnd());
+ EXPECT_EQ("name", it.GetKey());
+ EXPECT_EQ("value", it.GetValue());
+ EXPECT_EQ("value", it.GetUnescapedValue());
+ it.Advance();
+
+ ASSERT_FALSE(it.IsAtEnd());
+ EXPECT_EQ("boolParam", it.GetKey());
+ EXPECT_EQ("", it.GetValue());
+ EXPECT_EQ("", it.GetUnescapedValue());
+ it.Advance();
+
+ ASSERT_FALSE(it.IsAtEnd());
+ EXPECT_EQ("url", it.GetKey());
+ EXPECT_EQ("http://test.com/q?n1%3Dv1%26n2", it.GetValue());
+ EXPECT_EQ("http://test.com/q?n1=v1&n2", it.GetUnescapedValue());
+ it.Advance();
+
+ ASSERT_FALSE(it.IsAtEnd());
+ EXPECT_EQ("multikey", it.GetKey());
+ EXPECT_EQ("value1", it.GetValue());
+ EXPECT_EQ("value1", it.GetUnescapedValue());
+ it.Advance();
+
+ ASSERT_FALSE(it.IsAtEnd());
+ EXPECT_EQ("multikey", it.GetKey());
+ EXPECT_EQ("value2", it.GetValue());
+ EXPECT_EQ("value2", it.GetUnescapedValue());
+ it.Advance();
+
+ ASSERT_FALSE(it.IsAtEnd());
+ EXPECT_EQ("multikey", it.GetKey());
+ EXPECT_EQ("", it.GetValue());
+ EXPECT_EQ("", it.GetUnescapedValue());
+ it.Advance();
+
+ EXPECT_TRUE(it.IsAtEnd());
+}
+
+TEST(UrlUtilTest, ParseQueryInvalidURL) {
+ const GURL url("http://%01/?test");
+ QueryIterator it(url);
+ EXPECT_TRUE(it.IsAtEnd());
+}
+
} // namespace
} // namespace net
« no previous file with comments | « net/base/url_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698