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

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

Issue 585833002: Revert of Remove void** from disk_cache interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 bool DiskCacheTest::CleanupCacheDir() { 47 bool DiskCacheTest::CleanupCacheDir() {
48 return DeleteCache(cache_path_); 48 return DeleteCache(cache_path_);
49 } 49 }
50 50
51 void DiskCacheTest::TearDown() { 51 void DiskCacheTest::TearDown() {
52 base::RunLoop().RunUntilIdle(); 52 base::RunLoop().RunUntilIdle();
53 } 53 }
54 54
55 DiskCacheTestWithCache::TestIterator::TestIterator(
56 scoped_ptr<disk_cache::Backend::Iterator> iterator)
57 : iterator_(iterator.Pass()) {
58 }
59
60 DiskCacheTestWithCache::TestIterator::~TestIterator() {}
61
62 int DiskCacheTestWithCache::TestIterator::OpenNextEntry(
63 disk_cache::Entry** next_entry) {
64 net::TestCompletionCallback cb;
65 int rv = iterator_->OpenNextEntry(next_entry, cb.callback());
66 return cb.GetResult(rv);
67 }
68
69 DiskCacheTestWithCache::DiskCacheTestWithCache() 55 DiskCacheTestWithCache::DiskCacheTestWithCache()
70 : cache_impl_(NULL), 56 : cache_impl_(NULL),
71 simple_cache_impl_(NULL), 57 simple_cache_impl_(NULL),
72 mem_cache_(NULL), 58 mem_cache_(NULL),
73 mask_(0), 59 mask_(0),
74 size_(0), 60 size_(0),
75 type_(net::DISK_CACHE), 61 type_(net::DISK_CACHE),
76 memory_only_(false), 62 memory_only_(false),
77 simple_cache_mode_(false), 63 simple_cache_mode_(false),
78 simple_cache_wait_for_index_(true), 64 simple_cache_wait_for_index_(true),
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 int rv = cache_->DoomEntriesBetween(initial_time, end_time, cb.callback()); 146 int rv = cache_->DoomEntriesBetween(initial_time, end_time, cb.callback());
161 return cb.GetResult(rv); 147 return cb.GetResult(rv);
162 } 148 }
163 149
164 int DiskCacheTestWithCache::DoomEntriesSince(const base::Time initial_time) { 150 int DiskCacheTestWithCache::DoomEntriesSince(const base::Time initial_time) {
165 net::TestCompletionCallback cb; 151 net::TestCompletionCallback cb;
166 int rv = cache_->DoomEntriesSince(initial_time, cb.callback()); 152 int rv = cache_->DoomEntriesSince(initial_time, cb.callback());
167 return cb.GetResult(rv); 153 return cb.GetResult(rv);
168 } 154 }
169 155
170 scoped_ptr<DiskCacheTestWithCache::TestIterator> 156 int DiskCacheTestWithCache::OpenNextEntry(void** iter,
171 DiskCacheTestWithCache::CreateIterator() { 157 disk_cache::Entry** next_entry) {
172 return scoped_ptr<TestIterator>(new TestIterator(cache_->CreateIterator())); 158 net::TestCompletionCallback cb;
159 int rv = cache_->OpenNextEntry(iter, next_entry, cb.callback());
160 return cb.GetResult(rv);
173 } 161 }
174 162
175 void DiskCacheTestWithCache::FlushQueueForTest() { 163 void DiskCacheTestWithCache::FlushQueueForTest() {
176 if (memory_only_ || !cache_impl_) 164 if (memory_only_ || !cache_impl_)
177 return; 165 return;
178 166
179 net::TestCompletionCallback cb; 167 net::TestCompletionCallback cb;
180 int rv = cache_impl_->FlushQueueForTest(cb.callback()); 168 int rv = cache_impl_->FlushQueueForTest(cb.callback());
181 EXPECT_EQ(net::OK, cb.GetResult(rv)); 169 EXPECT_EQ(net::OK, cb.GetResult(rv));
182 } 170 }
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 if (size_) 315 if (size_)
328 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); 316 EXPECT_TRUE(cache_impl_->SetMaxSize(size_));
329 if (new_eviction_) 317 if (new_eviction_)
330 cache_impl_->SetNewEviction(); 318 cache_impl_->SetNewEviction();
331 cache_impl_->SetType(type_); 319 cache_impl_->SetType(type_);
332 cache_impl_->SetFlags(flags); 320 cache_impl_->SetFlags(flags);
333 net::TestCompletionCallback cb; 321 net::TestCompletionCallback cb;
334 int rv = cache_impl_->Init(cb.callback()); 322 int rv = cache_impl_->Init(cb.callback());
335 ASSERT_EQ(net::OK, cb.GetResult(rv)); 323 ASSERT_EQ(net::OK, cb.GetResult(rv));
336 } 324 }
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