| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 int rv = cache_->DoomEntriesSince(initial_time, cb.callback()); | 172 int rv = cache_->DoomEntriesSince(initial_time, cb.callback()); |
| 173 return cb.GetResult(rv); | 173 return cb.GetResult(rv); |
| 174 } | 174 } |
| 175 | 175 |
| 176 int DiskCacheTestWithCache::CalculateSizeOfAllEntries() { | 176 int DiskCacheTestWithCache::CalculateSizeOfAllEntries() { |
| 177 net::TestCompletionCallback cb; | 177 net::TestCompletionCallback cb; |
| 178 int rv = cache_->CalculateSizeOfAllEntries(cb.callback()); | 178 int rv = cache_->CalculateSizeOfAllEntries(cb.callback()); |
| 179 return cb.GetResult(rv); | 179 return cb.GetResult(rv); |
| 180 } | 180 } |
| 181 | 181 |
| 182 int DiskCacheTestWithCache::CalculateSizeOfEntriesBetween( |
| 183 const base::Time initial_time, |
| 184 const base::Time end_time) { |
| 185 net::TestCompletionCallback cb; |
| 186 int rv = cache_->CalculateSizeOfEntriesBetween(initial_time, end_time, |
| 187 cb.callback()); |
| 188 return cb.GetResult(rv); |
| 189 } |
| 190 |
| 182 std::unique_ptr<DiskCacheTestWithCache::TestIterator> | 191 std::unique_ptr<DiskCacheTestWithCache::TestIterator> |
| 183 DiskCacheTestWithCache::CreateIterator() { | 192 DiskCacheTestWithCache::CreateIterator() { |
| 184 return std::unique_ptr<TestIterator>( | 193 return std::unique_ptr<TestIterator>( |
| 185 new TestIterator(cache_->CreateIterator())); | 194 new TestIterator(cache_->CreateIterator())); |
| 186 } | 195 } |
| 187 | 196 |
| 188 void DiskCacheTestWithCache::FlushQueueForTest() { | 197 void DiskCacheTestWithCache::FlushQueueForTest() { |
| 189 if (memory_only_ || !cache_impl_) | 198 if (memory_only_ || !cache_impl_) |
| 190 return; | 199 return; |
| 191 | 200 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 if (size_) | 352 if (size_) |
| 344 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); | 353 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); |
| 345 if (new_eviction_) | 354 if (new_eviction_) |
| 346 cache_impl_->SetNewEviction(); | 355 cache_impl_->SetNewEviction(); |
| 347 cache_impl_->SetType(type_); | 356 cache_impl_->SetType(type_); |
| 348 cache_impl_->SetFlags(flags); | 357 cache_impl_->SetFlags(flags); |
| 349 net::TestCompletionCallback cb; | 358 net::TestCompletionCallback cb; |
| 350 int rv = cache_impl_->Init(cb.callback()); | 359 int rv = cache_impl_->Init(cb.callback()); |
| 351 ASSERT_THAT(cb.GetResult(rv), IsOk()); | 360 ASSERT_THAT(cb.GetResult(rv), IsOk()); |
| 352 } | 361 } |
| OLD | NEW |