summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi/file_system_path_manager_unittest.cc
diff options
context:
space:
mode:
authorericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-09 02:12:35 +0000
committerericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-09 02:12:35 +0000
commitd232fcfd4193f66833fb60ade258c2dde7995329 (patch)
tree765ae2295d1c0bf06136bf39f64b9b216b81ff27 /webkit/fileapi/file_system_path_manager_unittest.cc
parente0cf664f805d83c64e648e011786de1dc29c9f21 (diff)
downloadchromium_src-d232fcfd4193f66833fb60ade258c2dde7995329.zip
chromium_src-d232fcfd4193f66833fb60ade258c2dde7995329.tar.gz
chromium_src-d232fcfd4193f66833fb60ade258c2dde7995329.tar.bz2
More filesystem cleanup: convert URL-encoded-as-FilePath to actual URL, where
possible without WebKit API changes. The WebKit changes will happen in another CL. This is a resubmit of http://codereview.chromium.org/6767010/, which bounced due to a recent checkin that required a merge. There are a few changes here that weren't there [in file_system_operation_write_unittest.cc and file_system_operation.cc], but they're pretty trivial build/test fixes. BUG=none TEST=none Review URL: http://codereview.chromium.org/6813066 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81028 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_system_path_manager_unittest.cc')
-rw-r--r--webkit/fileapi/file_system_path_manager_unittest.cc88
1 files changed, 0 insertions, 88 deletions
diff --git a/webkit/fileapi/file_system_path_manager_unittest.cc b/webkit/fileapi/file_system_path_manager_unittest.cc
index fee38c1..8a99b84 100644
--- a/webkit/fileapi/file_system_path_manager_unittest.cc
+++ b/webkit/fileapi/file_system_path_manager_unittest.cc
@@ -228,11 +228,6 @@ class FileSystemPathManagerTest : public testing::Test {
return root_path_callback_status_;
}
- bool CheckValidFileSystemPath(FileSystemPathManager* manager,
- const FilePath& path) {
- return manager->CrackFileSystemPath(path, NULL, NULL, NULL);
- }
-
FilePath data_path() { return data_dir_.path(); }
FilePath file_system_path() {
return data_dir_.path().Append(
@@ -367,89 +362,6 @@ TEST_F(FileSystemPathManagerTest, GetRootPathFileURIWithAllowFlag) {
}
}
-TEST_F(FileSystemPathManagerTest, VirtualPathFromFileSystemPathTest) {
- scoped_ptr<FileSystemPathManager> manager(NewPathManager(false, false));
- GURL root_url = GetFileSystemRootURI(
- GURL("http://foo.com/"), fileapi::kFileSystemTypeTemporary);
- FilePath root_path = FilePath().AppendASCII(root_url.spec());
-
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kPathToVirtualPathTestCases); ++i) {
- SCOPED_TRACE(testing::Message() << "PathToVirtualPath #"
- << i << " " << kPathToVirtualPathTestCases[i]);
- FilePath absolute_path;
- // TODO(ericu): Clean this up when we've got more sane path-handling.
- // This hack is necessary because root_path is actually a URL [ending with a
- // forward slash], and AppendASCII("") on Windows will delete the trailing
- // slash, making the path invalid as far as CrackFileSystemPath is
- // concerned.
- if (strlen(kPathToVirtualPathTestCases[i]))
- absolute_path = root_path.AppendASCII(
- kPathToVirtualPathTestCases[i]);
- else
- absolute_path = root_path;
- FilePath virtual_path;
- EXPECT_TRUE(manager->CrackFileSystemPath(absolute_path, NULL, NULL,
- &virtual_path));
-
- FilePath test_case_path;
- test_case_path = test_case_path.AppendASCII(
- kPathToVirtualPathTestCases[i]);
- EXPECT_EQ(test_case_path.value(), virtual_path.value());
- }
-}
-
-TEST_F(FileSystemPathManagerTest, TypeFromFileSystemPathTest) {
- scoped_ptr<FileSystemPathManager> manager(NewPathManager(false, false));
-
- fileapi::FileSystemType type;
-
- GURL root_url = GetFileSystemRootURI(
- GURL("http://foo.com/"), fileapi::kFileSystemTypeTemporary);
- FilePath root_path = FilePath().AppendASCII(root_url.spec());
- FilePath path = root_path.AppendASCII("test");
- EXPECT_TRUE(manager->CrackFileSystemPath(path, NULL, &type, NULL));
- EXPECT_EQ(fileapi::kFileSystemTypeTemporary, type);
-
- root_url = GetFileSystemRootURI(
- GURL("http://foo.com/"), fileapi::kFileSystemTypePersistent);
- root_path = FilePath().AppendASCII(root_url.spec());
- path = root_path.AppendASCII("test");
- EXPECT_TRUE(manager->CrackFileSystemPath(path, NULL, &type, NULL));
- EXPECT_EQ(fileapi::kFileSystemTypePersistent, type);
-}
-
-TEST_F(FileSystemPathManagerTest, CheckValidPath) {
- scoped_ptr<FileSystemPathManager> manager(NewPathManager(false, false));
- GURL root_url = GetFileSystemRootURI(
- GURL("http://foo.com/"), fileapi::kFileSystemTypePersistent);
- FilePath root_path = FilePath().AppendASCII(root_url.spec());
-
- // The root path must be valid, but upper directories or directories
- // that are not in our temporary or persistent directory must be
- // evaluated invalid.
- EXPECT_TRUE(CheckValidFileSystemPath(manager.get(), root_path));
- EXPECT_FALSE(CheckValidFileSystemPath(manager.get(), root_path.DirName()));
- EXPECT_FALSE(CheckValidFileSystemPath(manager.get(),
- root_path.DirName().DirName()));
- EXPECT_FALSE(CheckValidFileSystemPath(manager.get(),
- root_path.DirName().DirName()
- .AppendASCII("ArbitraryName")
- .AppendASCII("chrome-dummy")));
-
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kCheckValidPathTestCases); ++i) {
- SCOPED_TRACE(testing::Message() << "CheckValidPath #" << i << " "
- << kCheckValidPathTestCases[i].path);
- FilePath path(kCheckValidPathTestCases[i].path);
-#ifdef FILE_PATH_USES_WIN_SEPARATORS
- path = path.NormalizeWindowsPathSeparators();
-#endif
- if (!path.IsAbsolute())
- path = root_path.Append(path);
- EXPECT_EQ(kCheckValidPathTestCases[i].expected_valid,
- CheckValidFileSystemPath(manager.get(), path));
- }
-}
-
TEST_F(FileSystemPathManagerTest, IsRestrictedName) {
scoped_ptr<FileSystemPathManager> manager(NewPathManager(false, false));
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kIsRestrictedNameTestCases); ++i) {