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

Unified Diff: extensions/common/url_pattern_unittest.cc

Issue 396033002: Support "always allow" for runtime script execution (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring, minor changes Created 6 years, 4 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
Index: extensions/common/url_pattern_unittest.cc
diff --git a/extensions/common/url_pattern_unittest.cc b/extensions/common/url_pattern_unittest.cc
index 9618aeb16a175be5c0fdced0f59274fe49d51ecd..1b0c254f1ff19697d8d07d57d217547576cab067 100644
--- a/extensions/common/url_pattern_unittest.cc
+++ b/extensions/common/url_pattern_unittest.cc
@@ -810,4 +810,22 @@ TEST(ExtensionURLPatternTest, Subset) {
EXPECT_TRUE(StrictlyContains(pattern12, pattern13));
}
+TEST(ExtensionURLPatternTest, MatchesSingleOrigin) {
+ EXPECT_FALSE(URLPattern(URLPattern::SCHEME_ALL, "http://*/")
+ .MatchesSingleOrigin());
+ EXPECT_FALSE(URLPattern(URLPattern::SCHEME_ALL, "http://*.google.com/*")
not at google - send to devlin 2014/08/12 19:49:27 mix up the http and https in here?
gpdavis 2014/08/12 21:19:55 Sure.
+ .MatchesSingleOrigin());
+ EXPECT_TRUE(URLPattern(URLPattern::SCHEME_ALL, "http://www.google.com/")
not at google - send to devlin 2014/08/12 19:49:27 could you test http://google.com here as well?
gpdavis 2014/08/12 21:19:55 http://google.com doesn't parse due to an invalid
not at google - send to devlin 2014/08/12 23:13:18 Yes add http://google.com/ and/or http://google.co
gpdavis 2014/08/13 00:08:24 Gotcha.
+ .MatchesSingleOrigin());
+ EXPECT_FALSE(URLPattern(URLPattern::SCHEME_ALL, "*://www.google.com/")
+ .MatchesSingleOrigin());
not at google - send to devlin 2014/08/12 19:49:27 also test a wildcard port
gpdavis 2014/08/12 21:19:56 See previous comment about port issue. Calling po
+ EXPECT_FALSE(URLPattern(URLPattern::SCHEME_ALL, "http://*.com/")
+ .MatchesSingleOrigin());
+ EXPECT_FALSE(URLPattern(URLPattern::SCHEME_ALL, "http://*.google.com/foo/bar")
+ .MatchesSingleOrigin());
+ EXPECT_TRUE(URLPattern(URLPattern::SCHEME_ALL,
+ "http://www.google.com/foo/bar")
+ .MatchesSingleOrigin());
not at google - send to devlin 2014/08/12 19:49:27 also add a couple of tests with a URLPattern mask
gpdavis 2014/08/12 21:19:56 You mean like... EXPECT_FALSE(URLPattern(URLPatte
not at google - send to devlin 2014/08/12 23:13:18 No, I mean like EXPECT_FALSE(URLPattern(URLPatter
gpdavis 2014/08/13 00:08:24 Ahh, that's what you meant by URLPattern mask. Bu
not at google - send to devlin 2014/08/13 01:02:59 Oh yeah, I'm thinking of AddOrigin. Sorry!
gpdavis 2014/08/13 01:14:50 No problem!
+}
+
} // namespace

Powered by Google App Engine
This is Rietveld 408576698