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

Unified Diff: content/browser/download/base_file_unittest.cc

Issue 296933016: Avoid trying to delete a non-existent file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « content/browser/download/base_file.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/base_file_unittest.cc
diff --git a/content/browser/download/base_file_unittest.cc b/content/browser/download/base_file_unittest.cc
index 3788c613ecf909cca584041c3e28081e082cdbc0..8b45ce9ca0f672b5624f41210b204403e20e2367 100644
--- a/content/browser/download/base_file_unittest.cc
+++ b/content/browser/download/base_file_unittest.cc
@@ -619,4 +619,21 @@ TEST_F(BaseFileTest, CreatedInDefaultDirectory) {
base_file_->Finish();
}
+TEST_F(BaseFileTest, NoDoubleDeleteAfterCancel) {
+ ASSERT_TRUE(InitializeFile());
+ base::FilePath full_path = base_file_->full_path();
+ ASSERT_FALSE(full_path.empty());
+ ASSERT_TRUE(base::PathExists(full_path));
+
+ base_file_->Cancel();
+ ASSERT_FALSE(base::PathExists(full_path));
+
+ const char kData[] = "hello";
+ const int kDataLength = static_cast<int>(arraysize(kData) - 1);
+ ASSERT_EQ(kDataLength, base::WriteFile(full_path, kData, kDataLength));
+ // The file that we created here should stick around when the BaseFile is
+ // destroyed during TearDown.
+ expect_file_survives_ = true;
+}
+
} // namespace content
« no previous file with comments | « content/browser/download/base_file.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698