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

Unified Diff: net/disk_cache/disk_cache_test_base.cc

Issue 2739007: Disk cache: Update the disk cache tools and tests to use... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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/disk_cache/disk_cache_test_base.h ('k') | net/disk_cache/disk_cache_test_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/disk_cache_test_base.cc
===================================================================
--- net/disk_cache/disk_cache_test_base.cc (revision 49603)
+++ net/disk_cache/disk_cache_test_base.cc (working copy)
@@ -38,7 +38,7 @@
void DiskCacheTestWithCache::InitMemoryCache() {
if (!implementation_) {
- cache_ = disk_cache::CreateInMemoryCacheBackend(size_);
+ cache_ = disk_cache::MemBackendImpl::CreateBackend(size_);
return;
}
@@ -57,19 +57,30 @@
if (first_cleanup_)
ASSERT_TRUE(DeleteCache(path));
+ if (!cache_thread_.IsRunning()) {
+ EXPECT_TRUE(cache_thread_.StartWithOptions(
+ base::Thread::Options(MessageLoop::TYPE_IO, 0)));
+ }
+ ASSERT_TRUE(cache_thread_.message_loop() != NULL);
+
if (implementation_)
return InitDiskCacheImpl(path);
- cache_ = disk_cache::BackendImpl::CreateBackend(path, force_creation_, size_,
- net::DISK_CACHE,
- disk_cache::kNoRandom);
+ TestCompletionCallback cb;
+ int rv = disk_cache::BackendImpl::CreateBackend(
+ path, force_creation_, size_, net::DISK_CACHE,
+ disk_cache::kNoRandom, cache_thread_.message_loop_proxy(),
+ &cache_, &cb);
+ ASSERT_EQ(net::OK, cb.GetResult(rv));
}
void DiskCacheTestWithCache::InitDiskCacheImpl(const FilePath& path) {
if (mask_)
- cache_impl_ = new disk_cache::BackendImpl(path, mask_);
+ cache_impl_ = new disk_cache::BackendImpl(
+ path, mask_, cache_thread_.message_loop_proxy());
else
- cache_impl_ = new disk_cache::BackendImpl(path);
+ cache_impl_ = new disk_cache::BackendImpl(
+ path, cache_thread_.message_loop_proxy());
cache_ = cache_impl_;
ASSERT_TRUE(NULL != cache_);
@@ -87,6 +98,8 @@
void DiskCacheTestWithCache::TearDown() {
MessageLoop::current()->RunAllPending();
delete cache_;
+ if (cache_thread_.IsRunning())
+ cache_thread_.Stop();
if (!memory_only_ && integrity_) {
FilePath path = GetCacheFilePath();
« no previous file with comments | « net/disk_cache/disk_cache_test_base.h ('k') | net/disk_cache/disk_cache_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698