summaryrefslogtreecommitdiffstats
path: root/extensions/common/url_pattern_set_unittest.cc
diff options
context:
space:
mode:
authorgpdavis.chromium@gmail.com <gpdavis.chromium@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-15 23:05:41 +0000
committergpdavis.chromium@gmail.com <gpdavis.chromium@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-15 23:06:47 +0000
commite1670584cb59505582f455923b2c476ffb49ec6b (patch)
treee04f14b1a6264d48534d4c62ee89e88b8f1f258e /extensions/common/url_pattern_set_unittest.cc
parent8faaaa1db317847005281e04eaa3a44909a4f097 (diff)
downloadchromium_src-e1670584cb59505582f455923b2c476ffb49ec6b.zip
chromium_src-e1670584cb59505582f455923b2c476ffb49ec6b.tar.gz
chromium_src-e1670584cb59505582f455923b2c476ffb49ec6b.tar.bz2
Support "always allow" for runtime script execution
BUG=391922 Review URL: https://codereview.chromium.org/396033002 Cr-Commit-Position: refs/heads/master@{#290039} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290039 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions/common/url_pattern_set_unittest.cc')
-rw-r--r--extensions/common/url_pattern_set_unittest.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/extensions/common/url_pattern_set_unittest.cc b/extensions/common/url_pattern_set_unittest.cc
index 1ad223e..ce2c94e 100644
--- a/extensions/common/url_pattern_set_unittest.cc
+++ b/extensions/common/url_pattern_set_unittest.cc
@@ -421,4 +421,22 @@ TEST(URLPatternSetTest, NwayUnion) {
}
}
+TEST(URLPatternSetTest, AddOrigin) {
+ URLPatternSet set;
+ EXPECT_TRUE(set.AddOrigin(
+ URLPattern::SCHEME_ALL, GURL("https://www.google.com/")));
+ EXPECT_TRUE(set.MatchesURL(GURL("https://www.google.com/foo/bar")));
+ EXPECT_FALSE(set.MatchesURL(GURL("http://www.google.com/foo/bar")));
+ EXPECT_FALSE(set.MatchesURL(GURL("https://en.google.com/foo/bar")));
+ set.ClearPatterns();
+
+ EXPECT_TRUE(set.AddOrigin(
+ URLPattern::SCHEME_ALL, GURL("https://google.com/")));
+ EXPECT_FALSE(set.MatchesURL(GURL("https://www.google.com/foo/bar")));
+ EXPECT_TRUE(set.MatchesURL(GURL("https://google.com/foo/bar")));
+
+ EXPECT_FALSE(set.AddOrigin(
+ URLPattern::SCHEME_HTTP, GURL("https://google.com/")));
+}
+
} // namespace extensions