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

Unified Diff: chrome/common/extensions/url_pattern_unittest.cc

Issue 7811006: Add full support for filesystem URLs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge errors Created 8 years, 9 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: 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..10dff3d66b4b6744257753e798a78272e58cdfa7 100644
--- a/chrome/common/extensions/url_pattern_unittest.cc
+++ b/chrome/common/extensions/url_pattern_unittest.cc
@@ -110,6 +110,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.set_partial_filesystem_support_hack(true);
+ EXPECT_TRUE(pattern.MatchesURL(
+ GURL("filesystem:https://www.google.com/foobar/bas")));
}
// subdomains
@@ -127,6 +132,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.set_partial_filesystem_support_hack(true);
+ EXPECT_FALSE(pattern.MatchesURL(
+ GURL("filesystem:http://google.com/temporary/foobar")));
}
// glob escaping
@@ -226,6 +236,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());
@@ -257,6 +268,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"));
@@ -368,6 +380,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.set_partial_filesystem_support_hack(true);
+ EXPECT_FALSE(pattern.MatchesURL(GURL("filesystem:http://www.example.com/f/foo")));
}
// Explicit port wildcard
@@ -384,6 +401,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 +421,11 @@ TEST(ExtensionURLPatternTest, Match19) {
EXPECT_TRUE(pattern.MatchesURL(
GURL("chrome-extension://ftw/https://google.com")));
EXPECT_FALSE(pattern.MatchesURL(GURL("chrome-extension://foobar")));
+ EXPECT_FALSE(pattern.MatchesURL(
+ GURL("filesystem:chrome-extension://ftw/t/file.txt")));
+ pattern.set_partial_filesystem_support_hack(true);
+ EXPECT_TRUE(pattern.MatchesURL(
+ GURL("filesystem:chrome-extension://ftw/t/file.txt")));
};
static const struct GetAsStringPatterns {
« no previous file with comments | « chrome/common/extensions/url_pattern.cc ('k') | chrome/test/data/extensions/api_test/filebrowser_component/main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698