diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-18 23:58:17 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-18 23:58:17 +0000 |
commit | bc4fb8e849ccfd850680d3d402ed18765df7fe11 (patch) | |
tree | ebd43e81798813cef227fa0f31356aba9185f92b /net/disk_cache/disk_cache_test_base.cc | |
parent | a2495a45f4bc8861261238c20944767a8de8d11e (diff) | |
download | chromium_src-bc4fb8e849ccfd850680d3d402ed18765df7fe11.zip chromium_src-bc4fb8e849ccfd850680d3d402ed18765df7fe11.tar.gz chromium_src-bc4fb8e849ccfd850680d3d402ed18765df7fe11.tar.bz2 |
Disk cache" Convert some of the unit tests to the new
disk cache interface (async)
BUG=26730
TEST=unit tests
Review URL: http://codereview.chromium.org/1135002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42031 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.cc | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/net/disk_cache/disk_cache_test_base.cc b/net/disk_cache/disk_cache_test_base.cc index 21352a2..2738674 100644 --- a/net/disk_cache/disk_cache_test_base.cc +++ b/net/disk_cache/disk_cache_test_base.cc @@ -1,9 +1,10 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "net/disk_cache/disk_cache_test_base.h" +#include "net/base/test_completion_callback.h" #include "net/disk_cache/backend_impl.h" #include "net/disk_cache/disk_cache_test_util.h" #include "net/disk_cache/mem_backend_impl.h" @@ -111,3 +112,49 @@ void DiskCacheTestWithCache::SetTestMode() { ASSERT_TRUE(implementation_ && !memory_only_); cache_impl_->SetUnitTestMode(); } + +int DiskCacheTestWithCache::OpenEntry(const std::string& key, + disk_cache::Entry** entry) { + TestCompletionCallback cb; + int rv = cache_->OpenEntry(key, entry, &cb); + return cb.GetResult(rv); +} + +int DiskCacheTestWithCache::CreateEntry(const std::string& key, + disk_cache::Entry** entry) { + TestCompletionCallback cb; + int rv = cache_->CreateEntry(key, entry, &cb); + return cb.GetResult(rv); +} + +int DiskCacheTestWithCache::DoomEntry(const std::string& key) { + TestCompletionCallback cb; + int rv = cache_->DoomEntry(key, &cb); + return cb.GetResult(rv); +} + +int DiskCacheTestWithCache::DoomAllEntries() { + TestCompletionCallback cb; + int rv = cache_->DoomAllEntries(&cb); + return cb.GetResult(rv); +} + +int DiskCacheTestWithCache::DoomEntriesBetween(const base::Time initial_time, + const base::Time end_time) { + TestCompletionCallback cb; + int rv = cache_->DoomEntriesBetween(initial_time, end_time, &cb); + return cb.GetResult(rv); +} + +int DiskCacheTestWithCache::DoomEntriesSince(const base::Time initial_time) { + TestCompletionCallback cb; + int rv = cache_->DoomEntriesSince(initial_time, &cb); + return cb.GetResult(rv); +} + +int DiskCacheTestWithCache::OpenNextEntry(void** iter, + disk_cache::Entry** next_entry) { + TestCompletionCallback cb; + int rv = cache_->OpenNextEntry(iter, next_entry, &cb); + return cb.GetResult(rv); +} |