Chromium Code Reviews| Index: base/file_util_unittest.cc |
| =================================================================== |
| --- base/file_util_unittest.cc (revision 68690) |
| +++ base/file_util_unittest.cc (working copy) |
| @@ -692,57 +692,6 @@ |
| EXPECT_FALSE(file_util::PathExists(file_name)); |
| } |
| -#if defined(OS_WIN) |
| -// Tests that the Delete function works for wild cards, especially |
| -// with the recursion flag. Also coincidentally tests PathExists. |
| -// TODO(erikkay): see if anyone's actually using this feature of the API |
| -TEST_F(FileUtilTest, DeleteWildCard) { |
|
Erik does not do reviews
2010/12/16 18:34:54
Are you sure nobody's using this feature? Should
Kavita Kanetkar
2010/12/17 00:59:32
I think so. I will email chromium-dev for heads-up
|
| - // Create a file and a directory |
| - FilePath file_name = temp_dir_.path().Append(FPL("Test DeleteWildCard.txt")); |
| - CreateTextFile(file_name, bogus_content); |
| - ASSERT_TRUE(file_util::PathExists(file_name)); |
| - |
| - FilePath subdir_path = temp_dir_.path().Append(FPL("DeleteWildCardDir")); |
| - file_util::CreateDirectory(subdir_path); |
| - ASSERT_TRUE(file_util::PathExists(subdir_path)); |
| - |
| - // Create the wildcard path |
| - FilePath directory_contents = temp_dir_.path(); |
| - directory_contents = directory_contents.Append(FPL("*")); |
| - |
| - // Delete non-recursively and check that only the file is deleted |
| - EXPECT_TRUE(file_util::Delete(directory_contents, false)); |
| - EXPECT_FALSE(file_util::PathExists(file_name)); |
| - EXPECT_TRUE(file_util::PathExists(subdir_path)); |
| - |
| - // Delete recursively and make sure all contents are deleted |
| - EXPECT_TRUE(file_util::Delete(directory_contents, true)); |
| - EXPECT_FALSE(file_util::PathExists(file_name)); |
| - EXPECT_FALSE(file_util::PathExists(subdir_path)); |
| -} |
| - |
| -// TODO(erikkay): see if anyone's actually using this feature of the API |
| -TEST_F(FileUtilTest, DeleteNonExistantWildCard) { |
| - // Create a file and a directory |
| - FilePath subdir_path = |
| - temp_dir_.path().Append(FPL("DeleteNonExistantWildCard")); |
| - file_util::CreateDirectory(subdir_path); |
| - ASSERT_TRUE(file_util::PathExists(subdir_path)); |
| - |
| - // Create the wildcard path |
| - FilePath directory_contents = subdir_path; |
| - directory_contents = directory_contents.Append(FPL("*")); |
| - |
| - // Delete non-recursively and check nothing got deleted |
| - EXPECT_TRUE(file_util::Delete(directory_contents, false)); |
| - EXPECT_TRUE(file_util::PathExists(subdir_path)); |
| - |
| - // Delete recursively and check nothing got deleted |
| - EXPECT_TRUE(file_util::Delete(directory_contents, true)); |
| - EXPECT_TRUE(file_util::PathExists(subdir_path)); |
| -} |
| -#endif |
| - |
| // Tests non-recursive Delete() for a directory. |
| TEST_F(FileUtilTest, DeleteDirNonRecursive) { |
| // Create a subdirectory and put a file and two directories inside. |
| @@ -788,6 +737,15 @@ |
| file_util::CreateDirectory(subdir_path1); |
| ASSERT_TRUE(file_util::PathExists(subdir_path1)); |
| + FilePath sub_subdir_path1 = subdir_path1.Append(FPL("TestSubSubDir1")); |
| + file_util::CreateDirectory(sub_subdir_path1); |
|
Paweł Hajdan Jr.
2010/12/16 08:58:40
nit: Should you check return value of this?
Erik does not do reviews
2010/12/16 18:34:54
doesn't the next assert effectively do this?
|
| + ASSERT_TRUE(file_util::PathExists(sub_subdir_path1)); |
| + |
| + FilePath subdir_file_name = |
| + sub_subdir_path1.Append(FPL("DeleteDirRecursiveSubDir.txt")); |
| + CreateTextFile(subdir_file_name, bogus_content); |
| + ASSERT_TRUE(file_util::PathExists(subdir_file_name)); |
| + |
| FilePath subdir_path2 = test_subdir.Append(FPL("TestSubDir2")); |
| file_util::CreateDirectory(subdir_path2); |
| ASSERT_TRUE(file_util::PathExists(subdir_path2)); |