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

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

Issue 542733002: Remove void** from disk_cache interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: narrower 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
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()) {}
rvargas (doing something else) 2014/09/18 02:32:12 nit: not a single line anymore
gavinp 2014/09/18 18:13:04 Done.
58
59 DiskCacheTestWithCache::TestIterator::~TestIterator() {}
60
61 int DiskCacheTestWithCache::TestIterator::OpenNextEntry(
62 disk_cache::Entry** next_entry) {
63 net::TestCompletionCallback cb;
64 int rv = iterator_->OpenNextEntry(next_entry, cb.callback());
65 return cb.GetResult(rv);
66 }
67
55 DiskCacheTestWithCache::DiskCacheTestWithCache() 68 DiskCacheTestWithCache::DiskCacheTestWithCache()
56 : cache_impl_(NULL), 69 : cache_impl_(NULL),
57 simple_cache_impl_(NULL), 70 simple_cache_impl_(NULL),
58 mem_cache_(NULL), 71 mem_cache_(NULL),
59 mask_(0), 72 mask_(0),
60 size_(0), 73 size_(0),
61 type_(net::DISK_CACHE), 74 type_(net::DISK_CACHE),
62 memory_only_(false), 75 memory_only_(false),
63 simple_cache_mode_(false), 76 simple_cache_mode_(false),
64 simple_cache_wait_for_index_(true), 77 simple_cache_wait_for_index_(true),
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 int rv = cache_->DoomEntriesBetween(initial_time, end_time, cb.callback()); 159 int rv = cache_->DoomEntriesBetween(initial_time, end_time, cb.callback());
147 return cb.GetResult(rv); 160 return cb.GetResult(rv);
148 } 161 }
149 162
150 int DiskCacheTestWithCache::DoomEntriesSince(const base::Time initial_time) { 163 int DiskCacheTestWithCache::DoomEntriesSince(const base::Time initial_time) {
151 net::TestCompletionCallback cb; 164 net::TestCompletionCallback cb;
152 int rv = cache_->DoomEntriesSince(initial_time, cb.callback()); 165 int rv = cache_->DoomEntriesSince(initial_time, cb.callback());
153 return cb.GetResult(rv); 166 return cb.GetResult(rv);
154 } 167 }
155 168
156 int DiskCacheTestWithCache::OpenNextEntry(void** iter, 169 scoped_ptr<DiskCacheTestWithCache::TestIterator>
157 disk_cache::Entry** next_entry) { 170 DiskCacheTestWithCache::CreateIterator() {
158 net::TestCompletionCallback cb; 171 return scoped_ptr<TestIterator>(new TestIterator(cache_->CreateIterator()));
159 int rv = cache_->OpenNextEntry(iter, next_entry, cb.callback());
160 return cb.GetResult(rv);
161 } 172 }
162 173
163 void DiskCacheTestWithCache::FlushQueueForTest() { 174 void DiskCacheTestWithCache::FlushQueueForTest() {
164 if (memory_only_ || !cache_impl_) 175 if (memory_only_ || !cache_impl_)
165 return; 176 return;
166 177
167 net::TestCompletionCallback cb; 178 net::TestCompletionCallback cb;
168 int rv = cache_impl_->FlushQueueForTest(cb.callback()); 179 int rv = cache_impl_->FlushQueueForTest(cb.callback());
169 EXPECT_EQ(net::OK, cb.GetResult(rv)); 180 EXPECT_EQ(net::OK, cb.GetResult(rv));
170 } 181 }
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 if (size_) 326 if (size_)
316 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); 327 EXPECT_TRUE(cache_impl_->SetMaxSize(size_));
317 if (new_eviction_) 328 if (new_eviction_)
318 cache_impl_->SetNewEviction(); 329 cache_impl_->SetNewEviction();
319 cache_impl_->SetType(type_); 330 cache_impl_->SetType(type_);
320 cache_impl_->SetFlags(flags); 331 cache_impl_->SetFlags(flags);
321 net::TestCompletionCallback cb; 332 net::TestCompletionCallback cb;
322 int rv = cache_impl_->Init(cb.callback()); 333 int rv = cache_impl_->Init(cb.callback());
323 ASSERT_EQ(net::OK, cb.GetResult(rv)); 334 ASSERT_EQ(net::OK, cb.GetResult(rv));
324 } 335 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698