| Index: chrome/common/extensions/url_pattern_unittest.cc
|
| diff --git a/chrome/common/extensions/url_pattern_unittest.cc b/chrome/common/extensions/url_pattern_unittest.cc
|
| index 3996b999380fe39cf6ff3aa33c4819fbfd32ed3c..6a1c3f65547e4adbc782428055eb721bb54741c0 100644
|
| --- a/chrome/common/extensions/url_pattern_unittest.cc
|
| +++ b/chrome/common/extensions/url_pattern_unittest.cc
|
| @@ -95,6 +95,8 @@ TEST(ExtensionURLPatternTest, Match1) {
|
| EXPECT_TRUE(pattern.MatchesURL(GURL("http://google.com/foo")));
|
| EXPECT_FALSE(pattern.MatchesURL(GURL("https://google.com")));
|
| EXPECT_TRUE(pattern.MatchesURL(GURL("http://74.125.127.100/search")));
|
| + EXPECT_TRUE(pattern.MatchesURL(GURL("filesystem:http://foo.com/t/")));
|
| + EXPECT_TRUE(pattern.MatchesURL(GURL("filesystem:http://foo.com/t/s")));
|
| }
|
|
|
| // all domains
|
| @@ -110,6 +112,11 @@ TEST(ExtensionURLPatternTest, Match2) {
|
| EXPECT_TRUE(pattern.MatchesURL(GURL("https://www.google.com/foobar")));
|
| EXPECT_FALSE(pattern.MatchesURL(GURL("http://www.google.com/foo")));
|
| EXPECT_FALSE(pattern.MatchesURL(GURL("https://www.google.com/")));
|
| + EXPECT_FALSE(pattern.MatchesURL(
|
| + GURL("filesystem:https://www.google.com/foobar/")));
|
| + pattern.SetMatchNestedURLPath(true);
|
| + EXPECT_TRUE(pattern.MatchesURL(
|
| + GURL("filesystem:https://www.google.com/foobar/bas")));
|
| }
|
|
|
| // subdomains
|
| @@ -127,6 +134,11 @@ TEST(URLPatternTest, Match3) {
|
| EXPECT_TRUE(pattern.MatchesURL(
|
| GURL("http://monkey.images.google.com/foooobar")));
|
| EXPECT_FALSE(pattern.MatchesURL(GURL("http://yahoo.com/foobar")));
|
| + EXPECT_FALSE(pattern.MatchesURL(
|
| + GURL("filesystem:http://google.com/foobar/")));
|
| + pattern.SetMatchNestedURLPath(true);
|
| + EXPECT_FALSE(pattern.MatchesURL(
|
| + GURL("filesystem:http://google.com/temporary/foobar")));
|
| }
|
|
|
| // glob escaping
|
| @@ -226,6 +238,7 @@ TEST(ExtensionURLPatternTest, Match11) {
|
| EXPECT_TRUE(pattern.MatchesScheme("http"));
|
| EXPECT_TRUE(pattern.MatchesScheme("https"));
|
| EXPECT_TRUE(pattern.MatchesScheme("file"));
|
| + EXPECT_TRUE(pattern.MatchesScheme("filesystem"));
|
| EXPECT_TRUE(pattern.MatchesScheme("chrome-extension"));
|
| EXPECT_TRUE(pattern.match_subdomains());
|
| EXPECT_TRUE(pattern.match_all_urls());
|
| @@ -234,6 +247,8 @@ TEST(ExtensionURLPatternTest, Match11) {
|
| EXPECT_TRUE(pattern.MatchesURL(GURL("http://127.0.0.1")));
|
| EXPECT_TRUE(pattern.MatchesURL(GURL("file:///foo/bar")));
|
| EXPECT_TRUE(pattern.MatchesURL(GURL("file://localhost/foo/bar")));
|
| + EXPECT_TRUE(pattern.MatchesURL(GURL("filesystem:http://a.com/t/b")));
|
| + EXPECT_TRUE(pattern.MatchesURL(GURL("filesystem:file:///t/b")));
|
|
|
| // Make sure the properties are the same when creating an <all_urls> pattern
|
| // via SetMatchAllURLs and by parsing <all_urls>.
|
| @@ -257,6 +272,7 @@ TEST(ExtensionURLPatternTest, Match12) {
|
| EXPECT_TRUE(pattern.MatchesScheme("http"));
|
| EXPECT_TRUE(pattern.MatchesScheme("https"));
|
| EXPECT_TRUE(pattern.MatchesScheme("file"));
|
| + EXPECT_TRUE(pattern.MatchesScheme("filesystem"));
|
| EXPECT_TRUE(pattern.MatchesScheme("javascript"));
|
| EXPECT_TRUE(pattern.MatchesScheme("data"));
|
| EXPECT_TRUE(pattern.MatchesScheme("about"));
|
| @@ -273,6 +289,8 @@ TEST(ExtensionURLPatternTest, Match12) {
|
| EXPECT_TRUE(pattern.MatchesURL(GURL("about:version")));
|
| EXPECT_TRUE(pattern.MatchesURL(
|
| GURL("data:text/html;charset=utf-8,<html>asdf</html>")));
|
| + EXPECT_TRUE(pattern.MatchesURL(GURL("filesystem:http://a.com/t/b")));
|
| + EXPECT_TRUE(pattern.MatchesURL(GURL("filesystem:file:///t/b")));
|
| };
|
|
|
| static const struct MatchPatterns {
|
| @@ -285,6 +303,7 @@ static const struct MatchPatterns {
|
| {"chrome-extension://*/*", "chrome-extension://FTW"},
|
| {"data:*", "data:monkey"},
|
| {"javascript:*", "javascript:atemyhomework"},
|
| + {"chrome-extension://*/*", "filesystem:chrome-extension://id/p/f"},
|
| };
|
|
|
| // SCHEME_ALL and specific schemes.
|
| @@ -368,6 +387,11 @@ TEST(ExtensionURLPatternTest, Match17) {
|
| EXPECT_TRUE(pattern.MatchesURL(GURL("http://www.example.com:80/foo")));
|
| EXPECT_TRUE(pattern.MatchesURL(GURL("http://www.example.com/foo")));
|
| EXPECT_FALSE(pattern.MatchesURL(GURL("http://www.example.com:8080/foo")));
|
| + EXPECT_FALSE(pattern.MatchesURL(
|
| + GURL("filesystem:http://www.example.com:8080/foo/")));
|
| + EXPECT_FALSE(pattern.MatchesURL(GURL("filesystem:http://www.example.com/f/foo")));
|
| + pattern.SetMatchNestedURLPath(true);
|
| + EXPECT_FALSE(pattern.MatchesURL(GURL("filesystem:http://www.example.com/f/foo")));
|
| }
|
|
|
| // Explicit port wildcard
|
| @@ -384,6 +408,8 @@ TEST(ExtensionURLPatternTest, Match18) {
|
| EXPECT_TRUE(pattern.MatchesURL(GURL("http://www.example.com:80/foo")));
|
| EXPECT_TRUE(pattern.MatchesURL(GURL("http://www.example.com/foo")));
|
| EXPECT_TRUE(pattern.MatchesURL(GURL("http://www.example.com:8080/foo")));
|
| + EXPECT_FALSE(pattern.MatchesURL(
|
| + GURL("filesystem:http://www.example.com:8080/foo/")));
|
| }
|
|
|
| // chrome-extension://
|
| @@ -402,6 +428,11 @@ TEST(ExtensionURLPatternTest, Match19) {
|
| EXPECT_TRUE(pattern.MatchesURL(
|
| GURL("chrome-extension://ftw/https://google.com")));
|
| EXPECT_FALSE(pattern.MatchesURL(GURL("chrome-extension://foobar")));
|
| + EXPECT_TRUE(pattern.MatchesURL(
|
| + GURL("filesystem:chrome-extension://ftw/f/")));
|
| + pattern.SetMatchNestedURLPath(true);
|
| + EXPECT_TRUE(pattern.MatchesURL(
|
| + GURL("filesystem:chrome-extension://ftw/t/file.txt")));
|
| };
|
|
|
| static const struct GetAsStringPatterns {
|
|
|