| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 int CreateBackend(NetLog* net_log, | 175 int CreateBackend(NetLog* net_log, |
| 176 std::unique_ptr<disk_cache::Backend>* backend, | 176 std::unique_ptr<disk_cache::Backend>* backend, |
| 177 const CompletionCallback& callback) override; | 177 const CompletionCallback& callback) override; |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 class MockHttpCache { | 180 class MockHttpCache { |
| 181 public: | 181 public: |
| 182 MockHttpCache(); | 182 MockHttpCache(); |
| 183 explicit MockHttpCache( | 183 explicit MockHttpCache( |
| 184 std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory); | 184 std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory); |
| 185 // |set_up_quic_server_info| if set, will set a quic server info factory | 185 // |set_up_quic_server_info| if set, will set a quic server info factory. |
| 186 // adptor. | |
| 187 explicit MockHttpCache(bool set_up_quic_server_info); | 186 explicit MockHttpCache(bool set_up_quic_server_info); |
| 188 | 187 |
| 189 MockHttpCache(std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory, | 188 MockHttpCache(std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory, |
| 190 bool set_up_quic_server_info); | 189 bool set_up_quic_server_info); |
| 191 | 190 |
| 192 HttpCache* http_cache() { return &http_cache_; } | 191 HttpCache* http_cache() { return &http_cache_; } |
| 193 | 192 |
| 194 MockNetworkLayer* network_layer() { | 193 MockNetworkLayer* network_layer() { |
| 195 return static_cast<MockNetworkLayer*>(http_cache_.network_layer()); | 194 return static_cast<MockNetworkLayer*>(http_cache_.network_layer()); |
| 196 } | 195 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 273 |
| 275 std::unique_ptr<disk_cache::Backend>* backend_; | 274 std::unique_ptr<disk_cache::Backend>* backend_; |
| 276 CompletionCallback callback_; | 275 CompletionCallback callback_; |
| 277 bool block_; | 276 bool block_; |
| 278 bool fail_; | 277 bool fail_; |
| 279 }; | 278 }; |
| 280 | 279 |
| 281 } // namespace net | 280 } // namespace net |
| 282 | 281 |
| 283 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ | 282 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ |
| OLD | NEW |