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 |