Chromium Code Reviews| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 | 172 |
| 173 class MockBackendFactory : public HttpCache::BackendFactory { | 173 class MockBackendFactory : public HttpCache::BackendFactory { |
| 174 public: | 174 public: |
| 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(bool set_up_quic_server_info); |
|
Ryan Hamilton
2017/01/31 01:32:26
nit: can you comment what this param means? Also,
Zhongyi Shi
2017/02/02 01:05:12
Done.
| |
| 183 explicit MockHttpCache( | 183 explicit MockHttpCache( |
|
Ryan Hamilton
2017/01/31 01:32:26
explicit is no longer needed.
Zhongyi Shi
2017/02/02 01:05:12
Done.
| |
| 184 std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory); | 184 std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory, |
| 185 bool set_up_quic_server_info); | |
| 185 | 186 |
| 186 HttpCache* http_cache() { return &http_cache_; } | 187 HttpCache* http_cache() { return &http_cache_; } |
| 187 | 188 |
| 188 MockNetworkLayer* network_layer() { | 189 MockNetworkLayer* network_layer() { |
| 189 return static_cast<MockNetworkLayer*>(http_cache_.network_layer()); | 190 return static_cast<MockNetworkLayer*>(http_cache_.network_layer()); |
| 190 } | 191 } |
| 191 disk_cache::Backend* backend(); | 192 disk_cache::Backend* backend(); |
| 192 MockDiskCache* disk_cache(); | 193 MockDiskCache* disk_cache(); |
| 193 | 194 |
| 194 // Wrapper around http_cache()->CreateTransaction(DEFAULT_PRIORITY...) | 195 // Wrapper around http_cache()->CreateTransaction(DEFAULT_PRIORITY...) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 | 269 |
| 269 std::unique_ptr<disk_cache::Backend>* backend_; | 270 std::unique_ptr<disk_cache::Backend>* backend_; |
| 270 CompletionCallback callback_; | 271 CompletionCallback callback_; |
| 271 bool block_; | 272 bool block_; |
| 272 bool fail_; | 273 bool fail_; |
| 273 }; | 274 }; |
| 274 | 275 |
| 275 } // namespace net | 276 } // namespace net |
| 276 | 277 |
| 277 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ | 278 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ |
| OLD | NEW |