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

Unified Diff: net/disk_cache/entry_unittest.cc

Issue 478573003: Connect SimpleCache Backend active_entries_ more closely to Entry lifetime. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove inline destructor Created 6 years, 4 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
Index: net/disk_cache/entry_unittest.cc
diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc
index a26ecaaa9bedd4d67b8270596d19b3c604180772..5d4f5fb70eecc40d65b2e92281bb6e4649a10f42 100644
--- a/net/disk_cache/entry_unittest.cc
+++ b/net/disk_cache/entry_unittest.cc
@@ -3206,6 +3206,38 @@ TEST_F(DiskCacheEntryTest, SimpleCacheDoomCreateDoom) {
// This test passes if it doesn't crash.
}
+TEST_F(DiskCacheEntryTest, SimpleCacheDoomCloseCreateCloseOpen) {
+ // Test sequence: Create, Doom, Close, Create, Close, Open.
+ SetSimpleCacheMode();
+ InitCache();
+
+ disk_cache::Entry* null = NULL;
+
+ const char key[] = "this is a key";
+
+ disk_cache::Entry* entry1 = NULL;
+ ASSERT_EQ(net::OK, CreateEntry(key, &entry1));
+ ScopedEntryPtr entry1_closer(entry1);
+ EXPECT_NE(null, entry1);
+
+ entry1->Doom();
+ entry1_closer.reset();
+ entry1 = NULL;
+
+ disk_cache::Entry* entry2 = NULL;
+ ASSERT_EQ(net::OK, CreateEntry(key, &entry2));
+ ScopedEntryPtr entry2_closer(entry2);
+ EXPECT_NE(null, entry2);
+
+ entry2_closer.reset();
+ entry2 = NULL;
+
+ disk_cache::Entry* entry3 = NULL;
+ ASSERT_EQ(net::OK, OpenEntry(key, &entry3));
+ ScopedEntryPtr entry3_closer(entry3);
+ EXPECT_NE(null, entry3);
+}
+
// Checks that an optimistic Create would fail later on a racing Open.
TEST_F(DiskCacheEntryTest, SimpleCacheOptimisticCreateFailsOnOpen) {
SetSimpleCacheMode();
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_backend_impl.h » ('j') | net/disk_cache/simple/simple_backend_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698