| 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 // This is a mock of the http cache and related testing classes. To be fair, it | 5 // This is a mock of the http cache and related testing classes. To be fair, it |
| 6 // is not really a mock http cache given that it uses the real implementation of | 6 // is not really a mock http cache given that it uses the real implementation of |
| 7 // the http cache, but it has fake implementations of all required components, | 7 // the http cache, but it has fake implementations of all required components, |
| 8 // so it is useful for unit tests at the http layer. | 8 // so it is useful for unit tests at the http layer. |
| 9 | 9 |
| 10 #ifndef NET_HTTP_MOCK_HTTP_CACHE_H_ | 10 #ifndef NET_HTTP_MOCK_HTTP_CACHE_H_ |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 int DoomAllEntries(const CompletionCallback& callback) override; | 127 int DoomAllEntries(const CompletionCallback& callback) override; |
| 128 int DoomEntriesBetween(base::Time initial_time, | 128 int DoomEntriesBetween(base::Time initial_time, |
| 129 base::Time end_time, | 129 base::Time end_time, |
| 130 const CompletionCallback& callback) override; | 130 const CompletionCallback& callback) override; |
| 131 int DoomEntriesSince(base::Time initial_time, | 131 int DoomEntriesSince(base::Time initial_time, |
| 132 const CompletionCallback& callback) override; | 132 const CompletionCallback& callback) override; |
| 133 int CalculateSizeOfAllEntries(const CompletionCallback& callback) override; | 133 int CalculateSizeOfAllEntries(const CompletionCallback& callback) override; |
| 134 std::unique_ptr<Iterator> CreateIterator() override; | 134 std::unique_ptr<Iterator> CreateIterator() override; |
| 135 void GetStats(base::StringPairs* stats) override; | 135 void GetStats(base::StringPairs* stats) override; |
| 136 void OnExternalCacheHit(const std::string& key) override; | 136 void OnExternalCacheHit(const std::string& key) override; |
| 137 size_t EstimateMemoryUsage() const override; | 137 size_t DumpMemoryStats( |
| 138 base::trace_event::ProcessMemoryDump* pmd, |
| 139 const std::string& parent_absolute_name) const override; |
| 138 | 140 |
| 139 // Returns number of times a cache entry was successfully opened. | 141 // Returns number of times a cache entry was successfully opened. |
| 140 int open_count() const { return open_count_; } | 142 int open_count() const { return open_count_; } |
| 141 | 143 |
| 142 // Returns number of times a cache entry was successfully created. | 144 // Returns number of times a cache entry was successfully created. |
| 143 int create_count() const { return create_count_; } | 145 int create_count() const { return create_count_; } |
| 144 | 146 |
| 145 // Fail any subsequent CreateEntry and OpenEntry. | 147 // Fail any subsequent CreateEntry and OpenEntry. |
| 146 void set_fail_requests() { fail_requests_ = true; } | 148 void set_fail_requests() { fail_requests_ = true; } |
| 147 | 149 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 276 |
| 275 std::unique_ptr<disk_cache::Backend>* backend_; | 277 std::unique_ptr<disk_cache::Backend>* backend_; |
| 276 CompletionCallback callback_; | 278 CompletionCallback callback_; |
| 277 bool block_; | 279 bool block_; |
| 278 bool fail_; | 280 bool fail_; |
| 279 }; | 281 }; |
| 280 | 282 |
| 281 } // namespace net | 283 } // namespace net |
| 282 | 284 |
| 283 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ | 285 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ |
| OLD | NEW |