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

Unified Diff: components/subresource_filter/core/common/url_pattern_matching_unittest.cc

Issue 2167653002: Make the subresource filter support subdomain anchor matching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address more comments from engedy@ Created 4 years, 5 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 | « components/subresource_filter/core/common/url_pattern_matching.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/subresource_filter/core/common/url_pattern_matching_unittest.cc
diff --git a/components/subresource_filter/core/common/url_pattern_matching_unittest.cc b/components/subresource_filter/core/common/url_pattern_matching_unittest.cc
index 738585d58a5931e77c1ff61a3ff6d9e4140a5e68..801baa66c6df8e378e7928c81ec5ce85f0f46cac 100644
--- a/components/subresource_filter/core/common/url_pattern_matching_unittest.cc
+++ b/components/subresource_filter/core/common/url_pattern_matching_unittest.cc
@@ -112,6 +112,24 @@ TEST(UrlPatternMatchingTest, IsMatch) {
{{"a^a&a^a&"}, "http://ex.com/a/a/a/a/?a&a&a&a&a", true},
{{"abc*def^"}, "http://ex.com/abc/a/ddef/", true},
+
+ {{"https://example.com/"}, "http://example.com/", false},
+ {{"example.com/", kSubdomain, kAnchorNone}, "http://example.com/", true},
+ {{"examp", kSubdomain, kAnchorNone}, "http://example.com/", true},
+ {{"xamp", kSubdomain, kAnchorNone}, "http://example.com/", false},
+ {{"examp", kSubdomain, kAnchorNone}, "http://test.example.com/", true},
+ {{"t.examp", kSubdomain, kAnchorNone}, "http://test.example.com/", false},
+ {{"com^", kSubdomain, kAnchorNone}, "http://test.example.com/", true},
+ {{"x.com", kSubdomain, kAnchorNone}, "http://ex.com/?url=x.com", false},
+ {{"ex.com/", kSubdomain, kBoundary}, "http://ex.com/", true},
+ {{"ex.com^", kSubdomain, kBoundary}, "http://ex.com/", true},
+ {{"ex.co", kSubdomain, kBoundary}, "http://ex.com/", false},
+ {{"ex.com", kSubdomain, kBoundary}, "http://rex.com.ex.com/", false},
+ {{"ex.com/", kSubdomain, kBoundary}, "http://rex.com.ex.com/", true},
+ {{"http", kSubdomain, kBoundary}, "http://http.com/", false},
+ {{"http", kSubdomain, kAnchorNone}, "http://http.com/", true},
+ {{"/example.com", kSubdomain, kBoundary}, "http://example.com/", false},
+ {{"/example.com/", kSubdomain, kBoundary}, "http://example.com/", false},
};
for (const auto& test_case : kTestCases) {
« no previous file with comments | « components/subresource_filter/core/common/url_pattern_matching.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698