OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "net/http/http_response_body_drainer.h" | 5 #include "net/http/http_response_body_drainer.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <cstring> | 9 #include <cstring> |
10 | 10 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 session_(CreateNetworkSession()), | 234 session_(CreateNetworkSession()), |
235 mock_stream_(new MockHttpStream(&result_waiter_)), | 235 mock_stream_(new MockHttpStream(&result_waiter_)), |
236 drainer_(new HttpResponseBodyDrainer(mock_stream_)) {} | 236 drainer_(new HttpResponseBodyDrainer(mock_stream_)) {} |
237 | 237 |
238 ~HttpResponseBodyDrainerTest() override {} | 238 ~HttpResponseBodyDrainerTest() override {} |
239 | 239 |
240 HttpNetworkSession* CreateNetworkSession() const { | 240 HttpNetworkSession* CreateNetworkSession() const { |
241 HttpNetworkSession::Params params; | 241 HttpNetworkSession::Params params; |
242 params.proxy_service = proxy_service_.get(); | 242 params.proxy_service = proxy_service_.get(); |
243 params.ssl_config_service = ssl_config_service_.get(); | 243 params.ssl_config_service = ssl_config_service_.get(); |
244 params.http_server_properties = http_server_properties_->GetWeakPtr(); | 244 params.http_server_properties = http_server_properties_.get(); |
245 params.transport_security_state = transport_security_state_.get(); | 245 params.transport_security_state = transport_security_state_.get(); |
246 return new HttpNetworkSession(params); | 246 return new HttpNetworkSession(params); |
247 } | 247 } |
248 | 248 |
249 std::unique_ptr<ProxyService> proxy_service_; | 249 std::unique_ptr<ProxyService> proxy_service_; |
250 scoped_refptr<SSLConfigService> ssl_config_service_; | 250 scoped_refptr<SSLConfigService> ssl_config_service_; |
251 std::unique_ptr<HttpServerPropertiesImpl> http_server_properties_; | 251 std::unique_ptr<HttpServerPropertiesImpl> http_server_properties_; |
252 std::unique_ptr<TransportSecurityState> transport_security_state_; | 252 std::unique_ptr<TransportSecurityState> transport_security_state_; |
253 const std::unique_ptr<HttpNetworkSession> session_; | 253 const std::unique_ptr<HttpNetworkSession> session_; |
254 CloseResultWaiter result_waiter_; | 254 CloseResultWaiter result_waiter_; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 TEST_F(HttpResponseBodyDrainerTest, DrainBodyCantReuse) { | 328 TEST_F(HttpResponseBodyDrainerTest, DrainBodyCantReuse) { |
329 mock_stream_->set_num_chunks(1); | 329 mock_stream_->set_num_chunks(1); |
330 mock_stream_->set_can_reuse_connection(false); | 330 mock_stream_->set_can_reuse_connection(false); |
331 drainer_->Start(session_.get()); | 331 drainer_->Start(session_.get()); |
332 EXPECT_TRUE(result_waiter_.WaitForResult()); | 332 EXPECT_TRUE(result_waiter_.WaitForResult()); |
333 } | 333 } |
334 | 334 |
335 } // namespace | 335 } // namespace |
336 | 336 |
337 } // namespace net | 337 } // namespace net |
OLD | NEW |