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

Unified Diff: extensions/common/user_script_unittest.cc

Issue 2455373002: Add implicit trailing dot domain matching support to URLPattern. (Closed)
Patch Set: Add a comment with additional links to an external spec, cleanup test. Created 4 years, 1 month 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 | « extensions/common/url_pattern_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/user_script_unittest.cc
diff --git a/extensions/common/user_script_unittest.cc b/extensions/common/user_script_unittest.cc
index 8532358c346aaef7f498029ad24055e0ef9b552c..0b8f35b03cfb7cdd233c57cbb31584e797d3ae9b 100644
--- a/extensions/common/user_script_unittest.cc
+++ b/extensions/common/user_script_unittest.cc
@@ -104,6 +104,25 @@ TEST(ExtensionUserScriptTest, ExcludeUrlPattern) {
EXPECT_TRUE(script.MatchesURL(GURL("http://business.nytimes.com")));
}
+TEST(ExtensionUserScriptTest, ExcludeUrlPatternWithTrailingDot) {
+ UserScript script;
+
+ URLPattern pattern(kAllSchemes);
+ ASSERT_EQ(URLPattern::PARSE_SUCCESS, pattern.Parse("*://*/*"));
+ script.add_url_pattern(pattern);
+
+ URLPattern exclude(kAllSchemes);
+ ASSERT_EQ(URLPattern::PARSE_SUCCESS, exclude.Parse("*://mail.nytimes.com/*"));
+ script.add_exclude_url_pattern(exclude);
+
+ EXPECT_TRUE(script.MatchesURL(GURL("http://www.nytimes.com/health")));
+ EXPECT_TRUE(script.MatchesURL(GURL("http://business.nytimes.com")));
+ EXPECT_FALSE(script.MatchesURL(GURL("http://mail.nytimes.com")));
+ EXPECT_FALSE(script.MatchesURL(GURL("http://mail.nytimes.com.")));
+ EXPECT_FALSE(script.MatchesURL(GURL("http://mail.nytimes.com/login")));
+ EXPECT_FALSE(script.MatchesURL(GURL("http://mail.nytimes.com./login")));
+}
+
TEST(ExtensionUserScriptTest, UrlPatternAndIncludeGlobs) {
UserScript script;
« no previous file with comments | « extensions/common/url_pattern_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698