From b43db5a635d2a4c1c245f2244a4058d99ccd8f31 Mon Sep 17 00:00:00 2001 From: "dmikurube@chromium.org" Date: Mon, 11 Apr 2011 06:14:09 +0000 Subject: Modify tests for FileSystemOperation to test directory-in-directory. BUG=none TEST=FileSystemOperationTest.Test*SuccessSrcDirRecursive Review URL: http://codereview.chromium.org/6816048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81071 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/fileapi/file_system_operation_unittest.cc | 26 ++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'webkit/fileapi') diff --git a/webkit/fileapi/file_system_operation_unittest.cc b/webkit/fileapi/file_system_operation_unittest.cc index 69a79fe..75c9d31 100644 --- a/webkit/fileapi/file_system_operation_unittest.cc +++ b/webkit/fileapi/file_system_operation_unittest.cc @@ -263,8 +263,11 @@ TEST_F(FileSystemOperationTest, TestMoveSuccessSrcDirAndNew) { TEST_F(FileSystemOperationTest, TestMoveSuccessSrcDirRecursive) { ScopedTempDir src_dir; ASSERT_TRUE(src_dir.CreateUniqueTempDir()); - FilePath child_file; - file_util::CreateTemporaryFileInDir(src_dir.path(), &child_file); + FilePath child_dir; + file_util::CreateTemporaryDirInDir(src_dir.path(), + FILE_PATH_LITERAL("prefix"), &child_dir); + FilePath grandchild_file; + file_util::CreateTemporaryFileInDir(child_dir, &grandchild_file); ScopedTempDir dest_dir; ASSERT_TRUE(dest_dir.CreateUniqueTempDir()); @@ -272,7 +275,11 @@ TEST_F(FileSystemOperationTest, TestMoveSuccessSrcDirRecursive) { operation()->Move(src_dir.path(), dest_dir.path()); MessageLoop::current()->RunAllPending(); EXPECT_EQ(kFileOperationSucceeded, status()); - EXPECT_TRUE(FileExists(dest_dir.path().Append(child_file.BaseName()))); + EXPECT_TRUE(file_util::DirectoryExists(dest_dir.path().Append( + child_dir.BaseName()))); + EXPECT_TRUE(FileExists(dest_dir.path().Append( + child_dir.BaseName()).Append( + grandchild_file.BaseName()))); } TEST_F(FileSystemOperationTest, TestCopyFailureSrcDoesntExist) { @@ -423,8 +430,11 @@ TEST_F(FileSystemOperationTest, TestCopySuccessSrcDirAndNew) { TEST_F(FileSystemOperationTest, TestCopySuccessSrcDirRecursive) { ScopedTempDir src_dir; ASSERT_TRUE(src_dir.CreateUniqueTempDir()); - FilePath child_file; - file_util::CreateTemporaryFileInDir(src_dir.path(), &child_file); + FilePath child_dir; + file_util::CreateTemporaryDirInDir(src_dir.path(), + FILE_PATH_LITERAL("prefix"), &child_dir); + FilePath grandchild_file; + file_util::CreateTemporaryFileInDir(child_dir, &grandchild_file); ScopedTempDir dest_dir; ASSERT_TRUE(dest_dir.CreateUniqueTempDir()); @@ -432,7 +442,11 @@ TEST_F(FileSystemOperationTest, TestCopySuccessSrcDirRecursive) { operation()->Copy(src_dir.path(), dest_dir.path()); MessageLoop::current()->RunAllPending(); EXPECT_EQ(kFileOperationSucceeded, status()); - EXPECT_TRUE(FileExists(dest_dir.path().Append(child_file.BaseName()))); + EXPECT_TRUE(file_util::DirectoryExists(dest_dir.path().Append( + child_dir.BaseName()))); + EXPECT_TRUE(FileExists(dest_dir.path().Append( + child_dir.BaseName()).Append( + grandchild_file.BaseName()))); } TEST_F(FileSystemOperationTest, TestCreateFileFailure) { -- cgit v1.1