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

Unified Diff: content/common/fileapi/file_system_util_unittest.cc

Issue 312283002: [fsp] Fix incorrect handling of file system URLs when containing a %. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added regression tests. Created 6 years, 6 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
« no previous file with comments | « no previous file | webkit/common/fileapi/file_system_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/fileapi/file_system_util_unittest.cc
diff --git a/content/common/fileapi/file_system_util_unittest.cc b/content/common/fileapi/file_system_util_unittest.cc
index 61dac02933350fbfb491d1e2956a06e8830270ee..a82dc906f552a473894582393dd222756545d294 100644
--- a/content/common/fileapi/file_system_util_unittest.cc
+++ b/content/common/fileapi/file_system_util_unittest.cc
@@ -10,7 +10,9 @@
using fileapi::CrackIsolatedFileSystemName;
using fileapi::FileSystemType;
+using fileapi::GetExternalFileSystemRootURIString;
using fileapi::GetIsolatedFileSystemName;
+using fileapi::GetIsolatedFileSystemRootURIString;
using fileapi::ValidateIsolatedFileSystemId;
using fileapi::VirtualPath;
@@ -281,5 +283,26 @@ TEST_F(FileSystemUtilTest, ValidateIsolatedFileSystemId) {
EXPECT_FALSE(ValidateIsolatedFileSystemId(kSpaceId));
}
+TEST_F(FileSystemUtilTest, GetIsolatedFileSystemRootURIString) {
+ const GURL kOriginURL("http://foo");
+ // Percents must be escaped, otherwise they will be unintentionally unescaped.
+ const std::string kFileSystemId = "A%20B";
+ const std::string kRootName = "C%20D";
+
+ const std::string url_string =
+ GetIsolatedFileSystemRootURIString(kOriginURL, kFileSystemId, kRootName);
+ EXPECT_EQ("filesystem:http://foo/isolated/A%2520B/C%2520D/", url_string);
+}
+
+TEST_F(FileSystemUtilTest, GetExternalFileSystemRootURIString) {
+ const GURL kOriginURL("http://foo");
+ // Percents must be escaped, otherwise they will be unintentionally unescaped.
+ const std::string kMountName = "X%20Y";
+
+ const std::string url_string =
+ GetExternalFileSystemRootURIString(kOriginURL, kMountName);
+ EXPECT_EQ("filesystem:http://foo/external/X%2520Y/", url_string);
+}
+
} // namespace
} // namespace content
« no previous file with comments | « no previous file | webkit/common/fileapi/file_system_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698