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

Side by Side Diff: net/disk_cache/disk_cache_test_base.cc

Issue 1135002: Disk cache" Convert some of the unit tests to the new... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/disk_cache_test_base.h ('k') | net/disk_cache/entry_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/disk_cache/disk_cache_test_base.h" 5 #include "net/disk_cache/disk_cache_test_base.h"
6 6
7 #include "net/base/test_completion_callback.h"
7 #include "net/disk_cache/backend_impl.h" 8 #include "net/disk_cache/backend_impl.h"
8 #include "net/disk_cache/disk_cache_test_util.h" 9 #include "net/disk_cache/disk_cache_test_util.h"
9 #include "net/disk_cache/mem_backend_impl.h" 10 #include "net/disk_cache/mem_backend_impl.h"
10 11
11 void DiskCacheTest::TearDown() { 12 void DiskCacheTest::TearDown() {
12 MessageLoop::current()->RunAllPending(); 13 MessageLoop::current()->RunAllPending();
13 } 14 }
14 15
15 void DiskCacheTestWithCache::SetMaxSize(int size) { 16 void DiskCacheTestWithCache::SetMaxSize(int size) {
16 size_ = size; 17 size_ = size;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 FilePath path = GetCacheFilePath(); 105 FilePath path = GetCacheFilePath();
105 EXPECT_TRUE(CheckCacheIntegrity(path, new_eviction_)); 106 EXPECT_TRUE(CheckCacheIntegrity(path, new_eviction_));
106 107
107 InitDiskCacheImpl(path); 108 InitDiskCacheImpl(path);
108 } 109 }
109 110
110 void DiskCacheTestWithCache::SetTestMode() { 111 void DiskCacheTestWithCache::SetTestMode() {
111 ASSERT_TRUE(implementation_ && !memory_only_); 112 ASSERT_TRUE(implementation_ && !memory_only_);
112 cache_impl_->SetUnitTestMode(); 113 cache_impl_->SetUnitTestMode();
113 } 114 }
115
116 int DiskCacheTestWithCache::OpenEntry(const std::string& key,
117 disk_cache::Entry** entry) {
118 TestCompletionCallback cb;
119 int rv = cache_->OpenEntry(key, entry, &cb);
120 return cb.GetResult(rv);
121 }
122
123 int DiskCacheTestWithCache::CreateEntry(const std::string& key,
124 disk_cache::Entry** entry) {
125 TestCompletionCallback cb;
126 int rv = cache_->CreateEntry(key, entry, &cb);
127 return cb.GetResult(rv);
128 }
129
130 int DiskCacheTestWithCache::DoomEntry(const std::string& key) {
131 TestCompletionCallback cb;
132 int rv = cache_->DoomEntry(key, &cb);
133 return cb.GetResult(rv);
134 }
135
136 int DiskCacheTestWithCache::DoomAllEntries() {
137 TestCompletionCallback cb;
138 int rv = cache_->DoomAllEntries(&cb);
139 return cb.GetResult(rv);
140 }
141
142 int DiskCacheTestWithCache::DoomEntriesBetween(const base::Time initial_time,
143 const base::Time end_time) {
144 TestCompletionCallback cb;
145 int rv = cache_->DoomEntriesBetween(initial_time, end_time, &cb);
146 return cb.GetResult(rv);
147 }
148
149 int DiskCacheTestWithCache::DoomEntriesSince(const base::Time initial_time) {
150 TestCompletionCallback cb;
151 int rv = cache_->DoomEntriesSince(initial_time, &cb);
152 return cb.GetResult(rv);
153 }
154
155 int DiskCacheTestWithCache::OpenNextEntry(void** iter,
156 disk_cache::Entry** next_entry) {
157 TestCompletionCallback cb;
158 int rv = cache_->OpenNextEntry(iter, next_entry, &cb);
159 return cb.GetResult(rv);
160 }
OLDNEW
« no previous file with comments | « net/disk_cache/disk_cache_test_base.h ('k') | net/disk_cache/entry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698