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

Unified Diff: net/disk_cache/entry_unittest.cc

Issue 22859060: Fix race condition for non-open/create operations happening after a doom. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 3 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 | net/disk_cache/simple/simple_entry_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/entry_unittest.cc
diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc
index a7e6d9ea5f282e7e3c7dac321dc4b04cd4cfe786..0043352b90be8b258da78b4819b4fcd719d0b22e 100644
--- a/net/disk_cache/entry_unittest.cc
+++ b/net/disk_cache/entry_unittest.cc
@@ -2874,9 +2874,7 @@ TEST_F(DiskCacheEntryTest, SimpleCacheOptimistic4) {
entry2->Close();
}
-// This test is flaky because of the race of Create followed by a Doom.
-// See test SimpleCacheCreateDoomRace.
-TEST_F(DiskCacheEntryTest, DISABLED_SimpleCacheOptimistic5) {
+TEST_F(DiskCacheEntryTest, SimpleCacheOptimistic5) {
// Test sequence:
// Create, Doom, Write, Read, Close.
SetSimpleCacheMode();
@@ -2945,10 +2943,6 @@ TEST_F(DiskCacheEntryTest, SimpleCacheOptimistic6) {
EXPECT_EQ(0, memcmp(buffer1->data(), buffer1_read->data(), kSize1));
entry->Doom();
-
- // Check that we are not leaking.
- EXPECT_TRUE(
- static_cast<disk_cache::SimpleEntryImpl*>(entry)->HasOneRef());
}
// Confirm that IO buffers are not referenced by the Simple Cache after a write
@@ -2987,7 +2981,7 @@ TEST_F(DiskCacheEntryTest, SimpleCacheOptimisticWriteReleases) {
EXPECT_TRUE(buffer1->HasOneRef());
}
-TEST_F(DiskCacheEntryTest, DISABLED_SimpleCacheCreateDoomRace) {
+TEST_F(DiskCacheEntryTest, SimpleCacheCreateDoomRace) {
// Test sequence:
// Create, Doom, Write, Close, Check files are not on disk anymore.
SetSimpleCacheMode();
@@ -3008,17 +3002,10 @@ TEST_F(DiskCacheEntryTest, DISABLED_SimpleCacheCreateDoomRace) {
cache_->DoomEntry(key, cb.callback());
EXPECT_EQ(net::OK, cb.GetResult(net::ERR_IO_PENDING));
- // Lets do a Write so we block until all operations are done, so we can check
- // the HasOneRef() below. This call can't be optimistic and we are checking
- // that here.
EXPECT_EQ(
- net::ERR_IO_PENDING,
+ kSize1,
entry->WriteData(0, 0, buffer1.get(), kSize1, cb.callback(), false));
- EXPECT_EQ(kSize1, cb.GetResult(net::ERR_IO_PENDING));
- // Check that we are not leaking.
- EXPECT_TRUE(
- static_cast<disk_cache::SimpleEntryImpl*>(entry)->HasOneRef());
entry->Close();
// Finish running the pending tasks so that we fully complete the close
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_entry_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698