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 |