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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 MockNetworkLayer* network_layer() { | 188 MockNetworkLayer* network_layer() { |
189 return static_cast<MockNetworkLayer*>(http_cache_.network_layer()); | 189 return static_cast<MockNetworkLayer*>(http_cache_.network_layer()); |
190 } | 190 } |
191 disk_cache::Backend* backend(); | 191 disk_cache::Backend* backend(); |
192 MockDiskCache* disk_cache(); | 192 MockDiskCache* disk_cache(); |
193 | 193 |
194 // Wrapper around http_cache()->CreateTransaction(DEFAULT_PRIORITY...) | 194 // Wrapper around http_cache()->CreateTransaction(DEFAULT_PRIORITY...) |
195 int CreateTransaction(std::unique_ptr<HttpTransaction>* trans); | 195 int CreateTransaction(std::unique_ptr<HttpTransaction>* trans); |
196 | 196 |
197 // Wrapper to bypass the cache lock for new transactions. | 197 // Wrapper to simulate cache lock timeout for new transactions. |
198 void BypassCacheLock(); | 198 void SimulateCacheLockTimeout(); |
199 | 199 |
200 // Wrapper to fail request conditionalization for new transactions. | 200 // Wrapper to fail request conditionalization for new transactions. |
201 void FailConditionalizations(); | 201 void FailConditionalizations(); |
202 | 202 |
203 // Helper function for reading response info from the disk cache. | 203 // Helper function for reading response info from the disk cache. |
204 static bool ReadResponseInfo(disk_cache::Entry* disk_entry, | 204 static bool ReadResponseInfo(disk_cache::Entry* disk_entry, |
205 HttpResponseInfo* response_info, | 205 HttpResponseInfo* response_info, |
206 bool* response_truncated); | 206 bool* response_truncated); |
207 | 207 |
208 // Helper function for writing response info into the disk cache. | 208 // Helper function for writing response info into the disk cache. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 268 |
269 std::unique_ptr<disk_cache::Backend>* backend_; | 269 std::unique_ptr<disk_cache::Backend>* backend_; |
270 CompletionCallback callback_; | 270 CompletionCallback callback_; |
271 bool block_; | 271 bool block_; |
272 bool fail_; | 272 bool fail_; |
273 }; | 273 }; |
274 | 274 |
275 } // namespace net | 275 } // namespace net |
276 | 276 |
277 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ | 277 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ |
OLD | NEW |