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

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: lint 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
« no previous file with comments | « no previous file | 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/backend_unittest.cc
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc
index 4f4a442aa1ee95e2be79a8a6a78b4628e03e996b..c3f2cfaf54c87962de6d08489335391214ddceec 100644
--- a/net/disk_cache/backend_unittest.cc
+++ b/net/disk_cache/backend_unittest.cc
@@ -3473,4 +3473,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698