OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_util.h" | 5 #include "net/disk_cache/disk_cache_test_util.h" |
6 | 6 |
7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 file.SetLength(4 * 1024 * 1024); | 52 file.SetLength(4 * 1024 * 1024); |
53 return true; | 53 return true; |
54 } | 54 } |
55 | 55 |
56 bool DeleteCache(const base::FilePath& path) { | 56 bool DeleteCache(const base::FilePath& path) { |
57 disk_cache::DeleteCache(path, false); | 57 disk_cache::DeleteCache(path, false); |
58 return true; | 58 return true; |
59 } | 59 } |
60 | 60 |
61 bool CheckCacheIntegrity(const base::FilePath& path, bool new_eviction, | 61 bool CheckCacheIntegrity(const base::FilePath& path, |
62 uint32 mask) { | 62 bool new_eviction, |
| 63 uint32_t mask) { |
63 scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl( | 64 scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl( |
64 path, mask, base::ThreadTaskRunnerHandle::Get(), NULL)); | 65 path, mask, base::ThreadTaskRunnerHandle::Get(), NULL)); |
65 if (!cache.get()) | 66 if (!cache.get()) |
66 return false; | 67 return false; |
67 if (new_eviction) | 68 if (new_eviction) |
68 cache->SetNewEviction(); | 69 cache->SetNewEviction(); |
69 cache->SetFlags(disk_cache::kNoRandom); | 70 cache->SetFlags(disk_cache::kNoRandom); |
70 if (cache->SyncInit() != net::OK) | 71 if (cache->SyncInit() != net::OK) |
71 return false; | 72 return false; |
72 return cache->SelfCheck() >= 0; | 73 return cache->SelfCheck() >= 0; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 136 |
136 if (reuse_) { | 137 if (reuse_) { |
137 DCHECK_EQ(1, reuse_); | 138 DCHECK_EQ(1, reuse_); |
138 if (2 == reuse_) | 139 if (2 == reuse_) |
139 helper_->set_callback_reused_error(true); | 140 helper_->set_callback_reused_error(true); |
140 reuse_++; | 141 reuse_++; |
141 } | 142 } |
142 | 143 |
143 helper_->CallbackWasCalled(); | 144 helper_->CallbackWasCalled(); |
144 } | 145 } |
OLD | NEW |