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

Unified Diff: net/disk_cache/backend_unittest.cc

Issue 533293002: Delete enumerations at Simple Cache backend deletion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: get really explicit about sizes Created 6 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
Index: net/disk_cache/backend_unittest.cc
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc
index 65f8cb0bae6ee75ca4bb1298fd98018878447a17..52dee0b3ed1cd4f80478283d172978878132092f 100644
--- a/net/disk_cache/backend_unittest.cc
+++ b/net/disk_cache/backend_unittest.cc
@@ -3516,4 +3516,22 @@ TEST_F(DiskCacheBackendTest, SimpleCacheEnumerationCorruption) {
EXPECT_TRUE(keys_to_match.empty());
}
+// Tests that enumerations don't leak memory when the backend is destructed
+// mid-enumeration.
+TEST_F(DiskCacheBackendTest, SimpleCacheEnumerationDestruction) {
+ SetSimpleCacheMode();
+ InitCache();
+ std::set<std::string> key_pool;
+ ASSERT_TRUE(CreateSetOfRandomEntries(&key_pool));
+
+ void* iter = NULL;
+ disk_cache::Entry* entry = NULL;
+ ASSERT_EQ(net::OK, OpenNextEntry(&iter, &entry));
+ EXPECT_TRUE(entry);
+ disk_cache::ScopedEntryPtr entry_closer(entry);
+
+ cache_.reset();
+ // This test passes if we don't leak memory.
+}
+
#endif // defined(OS_POSIX)
« 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