diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-27 01:53:09 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-27 01:53:09 +0000 |
commit | 949f25a052e09392ef70b75bcda422dc13eeef45 (patch) | |
tree | 135512e13da7e59d8171d41f2f1ca48bb58611a8 /webkit/fileapi/file_system_file_util_unittest.cc | |
parent | 967dcfe12bf6fb2939407e9d883efb687ac5c031 (diff) | |
download | chromium_src-949f25a052e09392ef70b75bcda422dc13eeef45.zip chromium_src-949f25a052e09392ef70b75bcda422dc13eeef45.tar.gz chromium_src-949f25a052e09392ef70b75bcda422dc13eeef45.tar.bz2 |
Reduce the number of CrackFileSystemURL
- crack the filesystem URL as soon as we get it in FileAPIMessageFilter
- introduce a new class FileSystemURL for cracked URL information and use it everywhere
- deprecate FileSystemPath (this used to serve the similar role for *FileUtil classes)
Mechanical changes only except for fileapi_message_filter.cc and file_system_operation.cc.
This change reduces the # of CrackFileSystemURL roughly from 3~4 to 1 for each FileSystem operation.
BUG=none
TEST=existing tests
Review URL: https://chromiumcodereview.appspot.com/10566002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144368 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_system_file_util_unittest.cc')
-rw-r--r-- | webkit/fileapi/file_system_file_util_unittest.cc | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/webkit/fileapi/file_system_file_util_unittest.cc b/webkit/fileapi/file_system_file_util_unittest.cc index cd0057d..6ce5ee6 100644 --- a/webkit/fileapi/file_system_file_util_unittest.cc +++ b/webkit/fileapi/file_system_file_util_unittest.cc @@ -63,28 +63,29 @@ class FileSystemFileUtilTest : public testing::Test { // Set up all the source data. scoped_ptr<FileSystemOperationContext> context; - FileSystemPath src_root = src_helper.CreatePathFromUTF8("root directory"); + FileSystemURL src_root = src_helper.CreateURLFromUTF8("root directory"); for (size_t i = 0; i < test::kRegularTestCaseSize; ++i) { const test::TestCaseRecord& test_case = test::kRegularTestCases[i]; - FileSystemPath path = src_root.Append(test_case.path); + FileSystemURL url = src_root.WithPath( + src_root.path().Append(test_case.path)); if (test_case.is_directory) { context.reset(NewContext(&src_helper)); ASSERT_EQ(base::PLATFORM_FILE_OK, - file_util->CreateDirectory(context.get(), path, true, true)); + file_util->CreateDirectory(context.get(), url, true, true)); } else { context.reset(NewContext(&src_helper)); bool created = false; ASSERT_EQ(base::PLATFORM_FILE_OK, - file_util->EnsureFileExists(context.get(), path, &created)); + file_util->EnsureFileExists(context.get(), url, &created)); ASSERT_TRUE(created); context.reset(NewContext(&src_helper)); ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->Truncate( - context.get(), path, test_case.data_file_size)); + context.get(), url, test_case.data_file_size)); } } - FileSystemPath dest_root = dest_helper.CreatePathFromUTF8("root directory"); + FileSystemURL dest_root = dest_helper.CreateURLFromUTF8("root directory"); // Do the actual copy or move. scoped_ptr<FileSystemOperationContext> copy_context( @@ -110,14 +111,15 @@ class FileSystemFileUtilTest : public testing::Test { // Validate that the destination paths are correct. for (size_t i = 0; i < test::kRegularTestCaseSize; ++i) { const test::TestCaseRecord& test_case = test::kRegularTestCases[i]; - FileSystemPath path = dest_root.Append(test_case.path); + FileSystemURL url = dest_root.WithPath( + dest_root.path().Append(test_case.path)); base::PlatformFileInfo dest_file_info; FilePath data_path; context.reset(NewContext(&dest_helper)); EXPECT_EQ(base::PLATFORM_FILE_OK, file_util->GetFileInfo( - context.get(), path, &dest_file_info, &data_path)); + context.get(), url, &dest_file_info, &data_path)); if (test_case.is_directory) { EXPECT_TRUE(dest_file_info.is_directory); } else { @@ -134,7 +136,8 @@ class FileSystemFileUtilTest : public testing::Test { // a move]. for (size_t i = 0; i < test::kRegularTestCaseSize; ++i) { const test::TestCaseRecord& test_case = test::kRegularTestCases[i]; - FileSystemPath path = src_root.Append(test_case.path); + FileSystemURL url = src_root.WithPath( + src_root.path().Append(test_case.path)); base::PlatformFileInfo src_file_info; FilePath data_path; context.reset(NewContext(&src_helper)); @@ -145,7 +148,7 @@ class FileSystemFileUtilTest : public testing::Test { expected_result = base::PLATFORM_FILE_ERROR_NOT_FOUND; EXPECT_EQ(expected_result, file_util->GetFileInfo( - context.get(), path, &src_file_info, &data_path)); + context.get(), url, &src_file_info, &data_path)); } } |