summaryrefslogtreecommitdiffstats
path: root/extensions/common/url_pattern_set_unittest.cc
diff options
context:
space:
mode:
authorrdevlin.cronin <rdevlin.cronin@chromium.org>2015-09-16 10:03:48 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-16 17:04:24 +0000
commit77cb0effc7d4c844f07bb380827a7b1a2cfd2c3c (patch)
tree9d076e393fcf61ed87c4e71ae1db727f611db8f1 /extensions/common/url_pattern_set_unittest.cc
parent4905daeee8695fb0caf31f34497a1c2f1dac29c4 (diff)
downloadchromium_src-77cb0effc7d4c844f07bb380827a7b1a2cfd2c3c.zip
chromium_src-77cb0effc7d4c844f07bb380827a7b1a2cfd2c3c.tar.gz
chromium_src-77cb0effc7d4c844f07bb380827a7b1a2cfd2c3c.tar.bz2
[Extensions] Allow revokable permissions
Add back-end support for revokable extension permissions for optional permissions, or, if the click-to-script feature is enabled, granted host permissions. BUG=532507 TBR=atwilson@chromium.org (micro change in c/b/background/) Review URL: https://codereview.chromium.org/1327523005 Cr-Commit-Position: refs/heads/master@{#349148}
Diffstat (limited to 'extensions/common/url_pattern_set_unittest.cc')
-rw-r--r--extensions/common/url_pattern_set_unittest.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/extensions/common/url_pattern_set_unittest.cc b/extensions/common/url_pattern_set_unittest.cc
index ce2c94e..19f3b5a 100644
--- a/extensions/common/url_pattern_set_unittest.cc
+++ b/extensions/common/url_pattern_set_unittest.cc
@@ -174,6 +174,36 @@ TEST(URLPatternSetTest, CreateIntersection) {
EXPECT_TRUE(set2.Contains(result));
}
+TEST(URLPatternSetTest, CreateSemanticIntersection) {
+ {
+ URLPatternSet set1;
+ AddPattern(&set1, "http://*.google.com/*");
+ AddPattern(&set1, "http://*.yahoo.com/*");
+
+ URLPatternSet set2;
+ AddPattern(&set2, "http://google.com/*");
+
+ // The semantic intersection should contain only those patterns that are in
+ // both set 1 and set 2, or "http://google.com/*".
+ URLPatternSet intersection =
+ URLPatternSet::CreateSemanticIntersection(set1, set2);
+ ASSERT_EQ(1u, intersection.size());
+ EXPECT_EQ("http://google.com/*", intersection.begin()->GetAsString());
+ }
+
+ {
+ // We don't handle funny intersections, where the resultant pattern is
+ // neither of the two compared patterns. So the intersection of these two
+ // is not http://www.google.com/*, but rather nothing.
+ URLPatternSet set1;
+ AddPattern(&set1, "http://*/*");
+ URLPatternSet set2;
+ AddPattern(&set2, "*://www.google.com/*");
+ EXPECT_TRUE(
+ URLPatternSet::CreateSemanticIntersection(set1, set2).is_empty());
+ }
+}
+
TEST(URLPatternSetTest, CreateUnion) {
URLPatternSet empty_set;