diff options
author | asanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-24 12:54:20 +0000 |
---|---|---|
committer | asanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-24 12:54:20 +0000 |
commit | 9c7aeb26f5095e77e945353d869ad61ba2209150 (patch) | |
tree | eb9c3d64b893f75b8eccb824eebab6cd76a887b7 /content/browser/download/base_file_unittest.cc | |
parent | 82952dfb79f49f8275477bb453bb7a739ed435ce (diff) | |
download | chromium_src-9c7aeb26f5095e77e945353d869ad61ba2209150.zip chromium_src-9c7aeb26f5095e77e945353d869ad61ba2209150.tar.gz chromium_src-9c7aeb26f5095e77e945353d869ad61ba2209150.tar.bz2 |
Avoid trying to delete a non-existent file.
BUG=368455
Review URL: https://codereview.chromium.org/296933016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272726 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/download/base_file_unittest.cc')
-rw-r--r-- | content/browser/download/base_file_unittest.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/content/browser/download/base_file_unittest.cc b/content/browser/download/base_file_unittest.cc index 3788c61..8b45ce9 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 |