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

Unified Diff: net/disk_cache/backend_unittest.cc

Issue 57024: Disk Cache: Make sure that an entry that pretends to be... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 9 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/data/cache_tests/dirty_entry/index ('k') | net/disk_cache/entry_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/backend_unittest.cc
===================================================================
--- net/disk_cache/backend_unittest.cc (revision 12694)
+++ net/disk_cache/backend_unittest.cc (working copy)
@@ -817,6 +817,23 @@
delete cache;
}
+// We want to be able to deal with abnormal dirty entries.
+TEST_F(DiskCacheTest, Backend_NotMarkedButDirty) {
+ ASSERT_TRUE(CopyTestCache(L"dirty_entry"));
+ std::wstring path = GetCachePath();
+ disk_cache::Backend* cache = disk_cache::CreateCacheBackend(path, false, 0,
+ net::DISK_CACHE);
+ ASSERT_TRUE(NULL != cache);
+
+ disk_cache::Entry *entry1, *entry2;
+ ASSERT_TRUE(cache->OpenEntry("the first key", &entry1));
+ EXPECT_FALSE(cache->OpenEntry("some other key", &entry2));
+ entry1->Close();
+
+ delete cache;
+ EXPECT_TRUE(CheckCacheIntegrity(path));
+}
+
// We want to be able to deal with messed up entries on disk.
TEST_F(DiskCacheTest, Backend_InvalidRankings) {
ASSERT_TRUE(CopyTestCache(L"bad_rankings"));
« no previous file with comments | « net/data/cache_tests/dirty_entry/index ('k') | net/disk_cache/entry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698