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-07-08 19:12:15 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-08 19:12:15 +0000
commit3fd7933a5e06cc4c64bea3e61d1114cb895e3d0e (patch)
treec5edd75ad837ac0ce2f9a3cbc53a9b1d961bcfee /net/disk_cache/disk_cache_test_base.cc
parenta74aa93cf049d625875d215c8cbea46313f827c5 (diff)
downloadchromium_src-3fd7933a5e06cc4c64bea3e61d1114cb895e3d0e.zip
chromium_src-3fd7933a5e06cc4c64bea3e61d1114cb895e3d0e.tar.gz
chromium_src-3fd7933a5e06cc4c64bea3e61d1114cb895e3d0e.tar.bz2
Revert 51858 - Disk cache: Switch the disk cache to use the cache_thread.
Add an InFlightBackendIO class that handles posting of cacheoperations back and forth between the IO thread and the cachethread. BUG=26730 TEST=unit tests Review URL: http://codereview.chromium.org/2827043 TBR=rvargas@google.com Review URL: http://codereview.chromium.org/2944002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51874 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.cc33
1 files changed, 7 insertions, 26 deletions
diff --git a/net/disk_cache/disk_cache_test_base.cc b/net/disk_cache/disk_cache_test_base.cc
index 0add3c7..7b0cc8e 100644
--- a/net/disk_cache/disk_cache_test_base.cc
+++ b/net/disk_cache/disk_cache_test_base.cc
@@ -4,7 +4,6 @@
#include "net/disk_cache/disk_cache_test_base.h"
-#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/disk_cache/backend_impl.h"
#include "net/disk_cache/disk_cache_test_util.h"
@@ -67,25 +66,21 @@ void DiskCacheTestWithCache::InitDiskCache() {
if (implementation_)
return InitDiskCacheImpl(path);
- scoped_refptr<base::MessageLoopProxy> thread =
- use_current_thread_ ? base::MessageLoopProxy::CreateForCurrentThread() :
- cache_thread_.message_loop_proxy();
-
TestCompletionCallback cb;
int rv = disk_cache::BackendImpl::CreateBackend(
path, force_creation_, size_, net::DISK_CACHE,
- disk_cache::kNoRandom, thread, &cache_, &cb);
+ disk_cache::kNoRandom, cache_thread_.message_loop_proxy(),
+ &cache_, &cb);
ASSERT_EQ(net::OK, cb.GetResult(rv));
}
void DiskCacheTestWithCache::InitDiskCacheImpl(const FilePath& path) {
- scoped_refptr<base::MessageLoopProxy> thread =
- use_current_thread_ ? base::MessageLoopProxy::CreateForCurrentThread() :
- cache_thread_.message_loop_proxy();
if (mask_)
- cache_impl_ = new disk_cache::BackendImpl(path, mask_, thread);
+ cache_impl_ = new disk_cache::BackendImpl(
+ path, mask_, cache_thread_.message_loop_proxy());
else
- cache_impl_ = new disk_cache::BackendImpl(path, thread);
+ cache_impl_ = new disk_cache::BackendImpl(
+ path, cache_thread_.message_loop_proxy());
cache_ = cache_impl_;
ASSERT_TRUE(NULL != cache_);
@@ -97,9 +92,7 @@ void DiskCacheTestWithCache::InitDiskCacheImpl(const FilePath& path) {
cache_impl_->SetNewEviction();
cache_impl_->SetFlags(disk_cache::kNoRandom);
- TestCompletionCallback cb;
- int rv = cache_impl_->Init(&cb);
- ASSERT_EQ(net::OK, cb.GetResult(rv));
+ ASSERT_TRUE(cache_impl_->Init());
}
void DiskCacheTestWithCache::TearDown() {
@@ -119,9 +112,6 @@ void DiskCacheTestWithCache::TearDown() {
// We are expected to leak memory when simulating crashes.
void DiskCacheTestWithCache::SimulateCrash() {
ASSERT_TRUE(implementation_ && !memory_only_);
- TestCompletionCallback cb;
- int rv = cache_impl_->FlushQueueForTest(&cb);
- ASSERT_EQ(net::OK, cb.GetResult(rv));
cache_impl_->ClearRefCountForTest();
delete cache_impl_;
@@ -181,12 +171,3 @@ int DiskCacheTestWithCache::OpenNextEntry(void** iter,
int rv = cache_->OpenNextEntry(iter, next_entry, &cb);
return cb.GetResult(rv);
}
-
-void DiskCacheTestWithCache::FlushQueueForTest() {
- if (memory_only_ || !cache_impl_)
- return;
-
- TestCompletionCallback cb;
- int rv = cache_impl_->FlushQueueForTest(&cb);
- EXPECT_EQ(net::OK, cb.GetResult(rv));
-}