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

Unified Diff: url/url_util_unittest.cc

Issue 2644133002: Do not sanitize about:blank/#foo & about:blank?foo (Closed)
Patch Set: Added unit test Created 3 years, 11 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
« url/url_util.h ('K') | « url/url_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/url_util_unittest.cc
diff --git a/url/url_util_unittest.cc b/url/url_util_unittest.cc
index a706f5a08a04bbfeca8a9cf936ad4bee664a079f..616e2ae6bfe7d38527623232ab56ac6348e53edc 100644
--- a/url/url_util_unittest.cc
+++ b/url/url_util_unittest.cc
@@ -417,4 +417,18 @@ TEST(URLUtilTest, TestDomainIs) {
}
}
+TEST(URLUtilTest, IsAboutBlank) {
+ const std::string kAboutBlankURLS[] = {"about:blank", "about:blank?foo",
Charlie Reis 2017/01/20 20:31:02 Minor nit: Lowercase s at the end (kAboutBlankURLs
clamy 2017/01/23 12:26:27 Done.
+ "about:blank/#foo",
+ "about:blank?foo#foo"};
+ for (const auto& url : kAboutBlankURLS)
+ EXPECT_TRUE(IsAboutBlank(GURL(url)));
+
+ const std::string kNotAboutBlankURLS[] = {
+ "http:blank", "about:blan", "about://blank",
+ "about:blank/foo", "about://:8000/blank", "about://foo:foo@/blank"};
Charlie Reis 2017/01/20 20:31:02 A few more to add: foo@about:blank foo:bar@about:b
clamy 2017/01/23 12:26:27 Done.
+ for (const auto& url : kNotAboutBlankURLS)
+ EXPECT_FALSE(IsAboutBlank(GURL(url)));
+}
+
} // namespace url
« url/url_util.h ('K') | « url/url_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698