Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1857)

Unified Diff: base/file_util_unittest.cc

Issue 296113003: Make DeleteFile succeed on Windows 7 even if the path contains a nonexistent directory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed formatting, added unit test Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/file_util_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_unittest.cc
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index 175e9cdc39cf3bdee6799e63c9cb148534871d1a..83f211f5e95218e3acf184d4b5a0d4766bacdfff 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -632,6 +632,17 @@ TEST_F(FileUtilTest, DeleteNonExistent) {
ASSERT_FALSE(PathExists(non_existent));
}
+TEST_F(FileUtilTest, DeleteNonExistentWithNonExistentParent) {
+ FilePath non_existent = temp_dir_.path().AppendASCII("bogus_topdir");
+ non_existent = non_existent.AppendASCII("bogus_subdir");
+ ASSERT_FALSE(PathExists(non_existent));
+
+ EXPECT_TRUE(DeleteFile(non_existent, false));
+ ASSERT_FALSE(PathExists(non_existent));
+ EXPECT_TRUE(DeleteFile(non_existent, true));
+ ASSERT_FALSE(PathExists(non_existent));
+}
+
TEST_F(FileUtilTest, DeleteFile) {
// Create a file
FilePath file_name = temp_dir_.path().Append(FPL("Test DeleteFile 1.txt"));
« no previous file with comments | « no previous file | base/file_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698