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

Unified Diff: chrome/common/extensions/url_pattern_unittest.cc

Issue 7049032: Make URLPattern::OverlapsWith handle wildcards better by expanding them to explicit schemes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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 | « chrome/common/extensions/url_pattern.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/url_pattern_unittest.cc
diff --git a/chrome/common/extensions/url_pattern_unittest.cc b/chrome/common/extensions/url_pattern_unittest.cc
index ef1406bbe3f7625e9dcca36061e8d12789acd880..05b114f17855780bc90a30eb3c420fa35cb16260 100644
--- a/chrome/common/extensions/url_pattern_unittest.cc
+++ b/chrome/common/extensions/url_pattern_unittest.cc
@@ -366,6 +366,21 @@ TEST(ExtensionURLPatternTest, OverlapsWith) {
// Test that '<all_urls>' includes file URLs, while scheme '*' does not.
TestPatternOverlap(pattern7, pattern8, false);
TestPatternOverlap(pattern7, pattern10, true);
+
+ // Test that wildcard schemes are handled correctly, especially when compared
+ // to each-other.
+ URLPattern pattern11(kAllSchemes, "http://example.com/*");
+ URLPattern pattern12(kAllSchemes, "*://example.com/*");
+ URLPattern pattern13(kAllSchemes, "*://example.com/foo/*");
+ URLPattern pattern14(kAllSchemes, "*://google.com/*");
+ TestPatternOverlap(pattern8, pattern12, true);
+ TestPatternOverlap(pattern9, pattern12, true);
+ TestPatternOverlap(pattern10, pattern12, true);
+ TestPatternOverlap(pattern11, pattern12, true);
+ TestPatternOverlap(pattern12, pattern13, true);
+ TestPatternOverlap(pattern11, pattern13, true);
+ TestPatternOverlap(pattern14, pattern12, false);
+ TestPatternOverlap(pattern14, pattern13, false);
}
TEST(ExtensionURLPatternTest, ConvertToExplicitSchemes) {
« no previous file with comments | « chrome/common/extensions/url_pattern.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698