summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/disk_cache_test_base.cc
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-16 20:59:29 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-16 20:59:29 +0000
commit65188eb51c19157f9b360c84acbfa66543f0d781 (patch)
tree28d1816af4f58cd77fdaec56ab40a3c6c1dc8f95 /net/disk_cache/disk_cache_test_base.cc
parentf7fcceefed4e4817f3fca6fdd2156136662ae39b (diff)
downloadchromium_src-65188eb51c19157f9b360c84acbfa66543f0d781.zip
chromium_src-65188eb51c19157f9b360c84acbfa66543f0d781.tar.gz
chromium_src-65188eb51c19157f9b360c84acbfa66543f0d781.tar.bz2
Disk cache: Fix the order in which we delete data
from the block files. Stress testing the cache reveals a problem with the deletion of some data from an entry: it is possible to crash in a way that the block file thinks a block is free and an entry thinks the block is in use. This CL corrects that issue. There is also some new tests and a bunch of DCHECKS added while looking for the problem, as well as adding tests to make sure that a block file is accessed only from one thread (there is no problem with the current code in that regard) BUG=55605 TEST=netunittests Review URL: http://codereview.chromium.org/3430004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59711 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/disk_cache_test_base.cc')
-rw-r--r--net/disk_cache/disk_cache_test_base.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/net/disk_cache/disk_cache_test_base.cc b/net/disk_cache/disk_cache_test_base.cc
index 3edfffd..cffe3fa 100644
--- a/net/disk_cache/disk_cache_test_base.cc
+++ b/net/disk_cache/disk_cache_test_base.cc
@@ -193,6 +193,18 @@ void DiskCacheTestWithCache::FlushQueueForTest() {
EXPECT_EQ(net::OK, cb.GetResult(rv));
}
+void DiskCacheTestWithCache::RunTaskForTest(Task* task) {
+ if (memory_only_ || !cache_impl_) {
+ task->Run();
+ delete task;
+ return;
+ }
+
+ TestCompletionCallback cb;
+ int rv = cache_impl_->RunTaskForTest(task, &cb);
+ EXPECT_EQ(net::OK, cb.GetResult(rv));
+}
+
int DiskCacheTestWithCache::ReadData(disk_cache::Entry* entry, int index,
int offset, net::IOBuffer* buf, int len) {
TestCompletionCallback cb;