| OLD | NEW |
| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 int rv = cache_->DoomEntriesBetween(initial_time, end_time, cb.callback()); | 160 int rv = cache_->DoomEntriesBetween(initial_time, end_time, cb.callback()); |
| 161 return cb.GetResult(rv); | 161 return cb.GetResult(rv); |
| 162 } | 162 } |
| 163 | 163 |
| 164 int DiskCacheTestWithCache::DoomEntriesSince(const base::Time initial_time) { | 164 int DiskCacheTestWithCache::DoomEntriesSince(const base::Time initial_time) { |
| 165 net::TestCompletionCallback cb; | 165 net::TestCompletionCallback cb; |
| 166 int rv = cache_->DoomEntriesSince(initial_time, cb.callback()); | 166 int rv = cache_->DoomEntriesSince(initial_time, cb.callback()); |
| 167 return cb.GetResult(rv); | 167 return cb.GetResult(rv); |
| 168 } | 168 } |
| 169 | 169 |
| 170 int DiskCacheTestWithCache::CalculateSizeOfAllEntries() { |
| 171 net::TestCompletionCallback cb; |
| 172 int rv = cache_->CalculateSizeOfAllEntries(cb.callback()); |
| 173 return cb.GetResult(rv); |
| 174 } |
| 175 |
| 170 scoped_ptr<DiskCacheTestWithCache::TestIterator> | 176 scoped_ptr<DiskCacheTestWithCache::TestIterator> |
| 171 DiskCacheTestWithCache::CreateIterator() { | 177 DiskCacheTestWithCache::CreateIterator() { |
| 172 return scoped_ptr<TestIterator>(new TestIterator(cache_->CreateIterator())); | 178 return scoped_ptr<TestIterator>(new TestIterator(cache_->CreateIterator())); |
| 173 } | 179 } |
| 174 | 180 |
| 175 void DiskCacheTestWithCache::FlushQueueForTest() { | 181 void DiskCacheTestWithCache::FlushQueueForTest() { |
| 176 if (memory_only_ || !cache_impl_) | 182 if (memory_only_ || !cache_impl_) |
| 177 return; | 183 return; |
| 178 | 184 |
| 179 net::TestCompletionCallback cb; | 185 net::TestCompletionCallback cb; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 if (size_) | 333 if (size_) |
| 328 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); | 334 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); |
| 329 if (new_eviction_) | 335 if (new_eviction_) |
| 330 cache_impl_->SetNewEviction(); | 336 cache_impl_->SetNewEviction(); |
| 331 cache_impl_->SetType(type_); | 337 cache_impl_->SetType(type_); |
| 332 cache_impl_->SetFlags(flags); | 338 cache_impl_->SetFlags(flags); |
| 333 net::TestCompletionCallback cb; | 339 net::TestCompletionCallback cb; |
| 334 int rv = cache_impl_->Init(cb.callback()); | 340 int rv = cache_impl_->Init(cb.callback()); |
| 335 ASSERT_EQ(net::OK, cb.GetResult(rv)); | 341 ASSERT_EQ(net::OK, cb.GetResult(rv)); |
| 336 } | 342 } |
| OLD | NEW |