summaryrefslogtreecommitdiffstats
path: root/content/common
diff options
context:
space:
mode:
Diffstat (limited to 'content/common')
-rw-r--r--content/common/fileapi/file_system_util_unittest.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/content/common/fileapi/file_system_util_unittest.cc b/content/common/fileapi/file_system_util_unittest.cc
index 61dac02..a82dc90 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