summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/backend_unittest.cc
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-17 21:34:17 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-17 21:34:17 +0000
commit7abcaea438b6205b44c1c4a51ebc4fa15ca74f9c (patch)
tree4547d7c2fafca13c3358dfb73014704326ecd8de /net/disk_cache/backend_unittest.cc
parent8893724b83008c83c89a87c2aa33157e8b012cb0 (diff)
downloadchromium_src-7abcaea438b6205b44c1c4a51ebc4fa15ca74f9c.zip
chromium_src-7abcaea438b6205b44c1c4a51ebc4fa15ca74f9c.tar.gz
chromium_src-7abcaea438b6205b44c1c4a51ebc4fa15ca74f9c.tar.bz2
Disk cache: A dirty entry can point to a list that
is not the actual list where the entry is stored. This CL recognizes that case and hanldes removing that entry from the lists, without saying that there is critical corruption. BUG=38859 TEST=net_unittests Review URL: http://codereview.chromium.org/5119001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66518 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/backend_unittest.cc')
-rw-r--r--net/disk_cache/backend_unittest.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc
index 4298456..bfb78b6 100644
--- a/net/disk_cache/backend_unittest.cc
+++ b/net/disk_cache/backend_unittest.cc
@@ -1313,6 +1313,26 @@ TEST_F(DiskCacheBackendTest, NewEvictionInvalidEntry2) {
BackendInvalidEntry2();
}
+TEST_F(DiskCacheBackendTest, NewEvictionInvalidEntry3) {
+ ASSERT_TRUE(CopyTestCache("bad_rankings3"));
+ DisableFirstCleanup();
+ SetNewEviction();
+ InitCache();
+
+ // The second entry is dirty, but removing it should not corrupt the list.
+ disk_cache::Entry* entry;
+ ASSERT_NE(net::OK, OpenEntry("the second key", &entry));
+ ASSERT_EQ(net::OK, OpenEntry("the first key", &entry));
+
+ // This should not delete the cache.
+ entry->Doom();
+ FlushQueueForTest();
+ entry->Close();
+
+ ASSERT_EQ(net::OK, OpenEntry("some other key", &entry));
+ entry->Close();
+}
+
// We want to be able to deal with abnormal dirty entries.
void DiskCacheBackendTest::BackendNotMarkedButDirty(const std::string& name) {
ASSERT_TRUE(CopyTestCache(name));