| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 return static_cast<MockNetworkLayer*>(http_cache_.network_layer()); | 182 return static_cast<MockNetworkLayer*>(http_cache_.network_layer()); |
| 183 } | 183 } |
| 184 MockDiskCache* disk_cache(); | 184 MockDiskCache* disk_cache(); |
| 185 | 185 |
| 186 // Wrapper around http_cache()->CreateTransaction(net::DEFAULT_PRIORITY...) | 186 // Wrapper around http_cache()->CreateTransaction(net::DEFAULT_PRIORITY...) |
| 187 int CreateTransaction(scoped_ptr<net::HttpTransaction>* trans); | 187 int CreateTransaction(scoped_ptr<net::HttpTransaction>* trans); |
| 188 | 188 |
| 189 // Wrapper to bypass the cache lock for new transactions. | 189 // Wrapper to bypass the cache lock for new transactions. |
| 190 void BypassCacheLock(); | 190 void BypassCacheLock(); |
| 191 | 191 |
| 192 // Wrapper to fail request conditionalization for new transactions. |
| 193 void FailConditionalizations(); |
| 194 |
| 192 // Helper function for reading response info from the disk cache. | 195 // Helper function for reading response info from the disk cache. |
| 193 static bool ReadResponseInfo(disk_cache::Entry* disk_entry, | 196 static bool ReadResponseInfo(disk_cache::Entry* disk_entry, |
| 194 net::HttpResponseInfo* response_info, | 197 net::HttpResponseInfo* response_info, |
| 195 bool* response_truncated); | 198 bool* response_truncated); |
| 196 | 199 |
| 197 // Helper function for writing response info into the disk cache. | 200 // Helper function for writing response info into the disk cache. |
| 198 static bool WriteResponseInfo(disk_cache::Entry* disk_entry, | 201 static bool WriteResponseInfo(disk_cache::Entry* disk_entry, |
| 199 const net::HttpResponseInfo* response_info, | 202 const net::HttpResponseInfo* response_info, |
| 200 bool skip_transient_headers, | 203 bool skip_transient_headers, |
| 201 bool response_truncated); | 204 bool response_truncated); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 private: | 257 private: |
| 255 int Result() { return fail_ ? net::ERR_FAILED : net::OK; } | 258 int Result() { return fail_ ? net::ERR_FAILED : net::OK; } |
| 256 | 259 |
| 257 scoped_ptr<disk_cache::Backend>* backend_; | 260 scoped_ptr<disk_cache::Backend>* backend_; |
| 258 net::CompletionCallback callback_; | 261 net::CompletionCallback callback_; |
| 259 bool block_; | 262 bool block_; |
| 260 bool fail_; | 263 bool fail_; |
| 261 }; | 264 }; |
| 262 | 265 |
| 263 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ | 266 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ |
| OLD | NEW |