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) { |
- // 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); |
+ 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)); |