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_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 bool DeleteCache(const base::FilePath& path) { | 58 bool DeleteCache(const base::FilePath& path) { |
59 disk_cache::DeleteCache(path, false); | 59 disk_cache::DeleteCache(path, false); |
60 return true; | 60 return true; |
61 } | 61 } |
62 | 62 |
63 bool CheckCacheIntegrity(const base::FilePath& path, bool new_eviction, | 63 bool CheckCacheIntegrity(const base::FilePath& path, bool new_eviction, |
64 uint32 mask) { | 64 uint32 mask) { |
65 scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl( | 65 scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl( |
66 path, mask, base::MessageLoopProxy::current(), NULL)); | 66 path, mask, base::MessageLoopProxy::current().get(), NULL)); |
67 if (!cache.get()) | 67 if (!cache.get()) |
68 return false; | 68 return false; |
69 if (new_eviction) | 69 if (new_eviction) |
70 cache->SetNewEviction(); | 70 cache->SetNewEviction(); |
71 cache->SetFlags(disk_cache::kNoRandom); | 71 cache->SetFlags(disk_cache::kNoRandom); |
72 if (cache->SyncInit() != net::OK) | 72 if (cache->SyncInit() != net::OK) |
73 return false; | 73 return false; |
74 return cache->SelfCheck() >= 0; | 74 return cache->SelfCheck() >= 0; |
75 } | 75 } |
76 | 76 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 if (reuse_) { | 138 if (reuse_) { |
139 DCHECK_EQ(1, reuse_); | 139 DCHECK_EQ(1, reuse_); |
140 if (2 == reuse_) | 140 if (2 == reuse_) |
141 helper_->set_callback_reused_error(true); | 141 helper_->set_callback_reused_error(true); |
142 reuse_++; | 142 reuse_++; |
143 } | 143 } |
144 | 144 |
145 helper_->CallbackWasCalled(); | 145 helper_->CallbackWasCalled(); |
146 } | 146 } |
OLD | NEW |