| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } | 200 } |
| 201 disk_cache::Backend* backend(); | 201 disk_cache::Backend* backend(); |
| 202 MockDiskCache* disk_cache(); | 202 MockDiskCache* disk_cache(); |
| 203 | 203 |
| 204 // Wrapper around http_cache()->CreateTransaction(DEFAULT_PRIORITY...) | 204 // Wrapper around http_cache()->CreateTransaction(DEFAULT_PRIORITY...) |
| 205 int CreateTransaction(std::unique_ptr<HttpTransaction>* trans); | 205 int CreateTransaction(std::unique_ptr<HttpTransaction>* trans); |
| 206 | 206 |
| 207 // Wrapper to simulate cache lock timeout for new transactions. | 207 // Wrapper to simulate cache lock timeout for new transactions. |
| 208 void SimulateCacheLockTimeout(); | 208 void SimulateCacheLockTimeout(); |
| 209 | 209 |
| 210 // Wrapper to simulate cache lock timeout for new transactions. |
| 211 void SimulateCacheLockTimeoutAfterHeaders(); |
| 212 |
| 210 // Wrapper to fail request conditionalization for new transactions. | 213 // Wrapper to fail request conditionalization for new transactions. |
| 211 void FailConditionalizations(); | 214 void FailConditionalizations(); |
| 212 | 215 |
| 213 // Helper function for reading response info from the disk cache. | 216 // Helper function for reading response info from the disk cache. |
| 214 static bool ReadResponseInfo(disk_cache::Entry* disk_entry, | 217 static bool ReadResponseInfo(disk_cache::Entry* disk_entry, |
| 215 HttpResponseInfo* response_info, | 218 HttpResponseInfo* response_info, |
| 216 bool* response_truncated); | 219 bool* response_truncated); |
| 217 | 220 |
| 218 // Helper function for writing response info into the disk cache. | 221 // Helper function for writing response info into the disk cache. |
| 219 static bool WriteResponseInfo(disk_cache::Entry* disk_entry, | 222 static bool WriteResponseInfo(disk_cache::Entry* disk_entry, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 289 |
| 287 std::unique_ptr<disk_cache::Backend>* backend_; | 290 std::unique_ptr<disk_cache::Backend>* backend_; |
| 288 CompletionCallback callback_; | 291 CompletionCallback callback_; |
| 289 bool block_; | 292 bool block_; |
| 290 bool fail_; | 293 bool fail_; |
| 291 }; | 294 }; |
| 292 | 295 |
| 293 } // namespace net | 296 } // namespace net |
| 294 | 297 |
| 295 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ | 298 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ |
| OLD | NEW |