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

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

Issue 2876009: Re-implement app overlap detection with new extent syntax. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: donk Created 10 years, 6 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/extension_extent.cc ('k') | chrome/common/extensions/url_pattern.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension_extent_unittest.cc
diff --git a/chrome/common/extensions/extension_extent_unittest.cc b/chrome/common/extensions/extension_extent_unittest.cc
index 41f2d15e7d4276628f313de40606754c86ce4be7..eb2d436c83a348a3ea0aaaad8e0f0a5fba4cd5ab 100644
--- a/chrome/common/extensions/extension_extent_unittest.cc
+++ b/chrome/common/extensions/extension_extent_unittest.cc
@@ -33,3 +33,24 @@ TEST(ExtensionExtentTest, Two) {
EXPECT_TRUE(extent.ContainsURL(GURL("http://www.yahoo.com/monkey")));
EXPECT_FALSE(extent.ContainsURL(GURL("https://www.apple.com/monkey")));
}
+
+TEST(ExtensionExtentTest, OverlapsWith) {
+ ExtensionExtent extent1;
+ extent1.AddPattern(*URLPattern::CreateFromString("http://www.google.com/f*"));
+ extent1.AddPattern(*URLPattern::CreateFromString("http://www.yahoo.com/b*"));
+
+ ExtensionExtent extent2;
+ extent2.AddPattern(*URLPattern::CreateFromString("http://www.reddit.com/f*"));
+ extent2.AddPattern(*URLPattern::CreateFromString("http://www.yahoo.com/z*"));
+
+ ExtensionExtent extent3;
+ extent3.AddPattern(*URLPattern::CreateFromString(
+ "http://www.google.com/q/*"));
+ extent3.AddPattern(*URLPattern::CreateFromString("http://www.yahoo.com/b/*"));
+
+ EXPECT_FALSE(extent1.OverlapsWith(extent2));
+ EXPECT_FALSE(extent2.OverlapsWith(extent1));
+
+ EXPECT_TRUE(extent1.OverlapsWith(extent3));
+ EXPECT_TRUE(extent3.OverlapsWith(extent1));
+}
« no previous file with comments | « chrome/common/extensions/extension_extent.cc ('k') | chrome/common/extensions/url_pattern.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698