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

Unified Diff: net/disk_cache/entry_unittest.cc

Issue 23486006: Track entries pending Doom in SimpleCache backend. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add TODO 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 | « net/disk_cache/backend_unittest.cc ('k') | net/disk_cache/simple/simple_backend_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 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;
+ 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();
« no previous file with comments | « net/disk_cache/backend_unittest.cc ('k') | net/disk_cache/simple/simple_backend_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698