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

Unified Diff: extensions/common/url_pattern_unittest.cc

Issue 2455373002: Add implicit trailing dot domain matching support to URLPattern. (Closed)
Patch Set: Created 4 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
Index: extensions/common/url_pattern_unittest.cc
diff --git a/extensions/common/url_pattern_unittest.cc b/extensions/common/url_pattern_unittest.cc
index 87ce1a1d7780bd21d4a0ca17744579e2f60849a8..9a2ac5df51f99ac13f5da35d5ed8d6453aa364b5 100644
--- a/extensions/common/url_pattern_unittest.cc
+++ b/extensions/common/url_pattern_unittest.cc
@@ -849,4 +849,19 @@ TEST(ExtensionURLPatternTest, MatchesSingleOrigin) {
.MatchesSingleOrigin());
}
+TEST(ExtensionURLPatternTest, TrailingDotDomain) {
+ const GURL normal_domain("http://example.com/");
+ const GURL trailing_dot_domain("http://example.com./");
+
+ // Both patterns should match trailing dot and non trailing dot domains.
+ const URLPattern pattern(URLPattern::SCHEME_HTTP, "*://example.com/*");
+ EXPECT_TRUE(pattern.MatchesURL(GURL(normal_domain)));
+ EXPECT_TRUE(pattern.MatchesURL(GURL(trailing_dot_domain)));
+
+ const URLPattern trailing_pattern(URLPattern::SCHEME_HTTP,
+ "*://example.com./*");
+ EXPECT_TRUE(trailing_pattern.MatchesURL(GURL(normal_domain)));
+ EXPECT_TRUE(trailing_pattern.MatchesURL(GURL(trailing_dot_domain)));
+}
+
} // namespace

Powered by Google App Engine
This is Rietveld 408576698