Index: net/disk_cache/entry_unittest.cc |
diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc |
index 0043352b90be8b258da78b4819b4fcd719d0b22e..56371437da3dbbd6950d7819d9c0b028f3cfdf65 100644 |
--- a/net/disk_cache/entry_unittest.cc |
+++ b/net/disk_cache/entry_unittest.cc |
@@ -2908,7 +2908,9 @@ TEST_F(DiskCacheEntryTest, SimpleCacheOptimistic5) { |
static_cast<disk_cache::SimpleEntryImpl*>(entry)->HasOneRef()); |
} |
-TEST_F(DiskCacheEntryTest, SimpleCacheOptimistic6) { |
+// TODO(gavinp): Fix this, perhaps by landing |
+// https://codereview.chromium.org/23823002/ |
+TEST_F(DiskCacheEntryTest, DISABLED_SimpleCacheOptimistic6) { |
// Test sequence: |
// Create, Write, Doom, Doom, Read, Doom, Close. |
SetSimpleCacheMode(); |
@@ -2999,7 +3001,7 @@ TEST_F(DiskCacheEntryTest, SimpleCacheCreateDoomRace) { |
cache_->CreateEntry(key, &entry, net::CompletionCallback())); |
EXPECT_NE(null, entry); |
- cache_->DoomEntry(key, cb.callback()); |
+ EXPECT_EQ(net::ERR_IO_PENDING, cache_->DoomEntry(key, cb.callback())); |
EXPECT_EQ(net::OK, cb.GetResult(net::ERR_IO_PENDING)); |
EXPECT_EQ( |
@@ -3020,6 +3022,37 @@ TEST_F(DiskCacheEntryTest, SimpleCacheCreateDoomRace) { |
} |
} |
+TEST_F(DiskCacheEntryTest, SimpleCacheDoomCreateRace) { |
+ // This test runs as APP_CACHE to make operations more synchronous. Test |
+ // sequence: |
+ // Create, Doom, Create. |
+ SetCacheType(net::APP_CACHE); |
+ SetSimpleCacheMode(); |
+ InitCache(); |
+ disk_cache::Entry* null = NULL; |
Deprecated (see juliatuttle)
2013/09/11 19:03:21
Is there a reason you're not just comparing direct
|
+ const char key[] = "the first key"; |
+ |
+ net::TestCompletionCallback create_callback; |
+ |
+ disk_cache::Entry* entry1 = NULL; |
+ ASSERT_EQ(net::OK, |
+ create_callback.GetResult( |
+ cache_->CreateEntry(key, &entry1, create_callback.callback()))); |
+ ScopedEntryPtr entry1_closer(entry1); |
+ EXPECT_NE(null, entry1); |
+ |
+ net::TestCompletionCallback doom_callback; |
+ EXPECT_EQ(net::ERR_IO_PENDING, |
+ cache_->DoomEntry(key, doom_callback.callback())); |
+ |
+ disk_cache::Entry* entry2 = NULL; |
+ ASSERT_EQ(net::OK, |
+ create_callback.GetResult( |
+ cache_->CreateEntry(key, &entry2, create_callback.callback()))); |
+ ScopedEntryPtr entry2_closer(entry2); |
+ EXPECT_EQ(net::OK, doom_callback.GetResult(net::ERR_IO_PENDING)); |
+} |
+ |
// Checks that an optimistic Create would fail later on a racing Open. |
TEST_F(DiskCacheEntryTest, SimpleCacheOptimisticCreateFailsOnOpen) { |
SetSimpleCacheMode(); |