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

Unified Diff: url/url_util_unittest.cc

Issue 2644133002: Do not sanitize about:blank/#foo & about:blank?foo (Closed)
Patch Set: Add missing include 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..a3b61fff8a6ae17b31f2bfa81e74ef504920bc6d 100644
--- a/url/url_util_unittest.cc
+++ b/url/url_util_unittest.cc
@@ -6,6 +6,7 @@
#include "base/macros.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "url/gurl.h"
#include "url/third_party/mozilla/url_parse.h"
#include "url/url_canon.h"
#include "url/url_canon_stdstring.h"
@@ -417,4 +418,19 @@ TEST(URLUtilTest, TestDomainIs) {
}
}
+TEST(URLUtilTest, IsAboutBlank) {
+ const std::string kAboutBlankUrls[] = {"about:blank", "about:blank?foo",
+ "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",
+ "foo@about:blank", "foo:bar@about:blank", "about:blank:8000"};
+ 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