| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 params.ssl_config_service = ssl_config_service_.get(); | 224 params.ssl_config_service = ssl_config_service_.get(); |
| 225 params.http_server_properties = http_server_properties_->GetWeakPtr(); | 225 params.http_server_properties = http_server_properties_->GetWeakPtr(); |
| 226 params.transport_security_state = transport_security_state_.get(); | 226 params.transport_security_state = transport_security_state_.get(); |
| 227 return new HttpNetworkSession(params); | 227 return new HttpNetworkSession(params); |
| 228 } | 228 } |
| 229 | 229 |
| 230 scoped_ptr<ProxyService> proxy_service_; | 230 scoped_ptr<ProxyService> proxy_service_; |
| 231 scoped_refptr<SSLConfigService> ssl_config_service_; | 231 scoped_refptr<SSLConfigService> ssl_config_service_; |
| 232 scoped_ptr<HttpServerPropertiesImpl> http_server_properties_; | 232 scoped_ptr<HttpServerPropertiesImpl> http_server_properties_; |
| 233 scoped_ptr<TransportSecurityState> transport_security_state_; | 233 scoped_ptr<TransportSecurityState> transport_security_state_; |
| 234 const scoped_ptr<HttpNetworkSession> session_; | 234 const scoped_refptr<HttpNetworkSession> session_; |
| 235 CloseResultWaiter result_waiter_; | 235 CloseResultWaiter result_waiter_; |
| 236 MockHttpStream* const mock_stream_; // Owned by |drainer_|. | 236 MockHttpStream* const mock_stream_; // Owned by |drainer_|. |
| 237 HttpResponseBodyDrainer* const drainer_; // Deletes itself. | 237 HttpResponseBodyDrainer* const drainer_; // Deletes itself. |
| 238 }; | 238 }; |
| 239 | 239 |
| 240 TEST_F(HttpResponseBodyDrainerTest, DrainBodySyncSingleOK) { | 240 TEST_F(HttpResponseBodyDrainerTest, DrainBodySyncSingleOK) { |
| 241 mock_stream_->set_num_chunks(1); | 241 mock_stream_->set_num_chunks(1); |
| 242 mock_stream_->set_sync(); | 242 mock_stream_->set_sync(); |
| 243 drainer_->Start(session_.get()); | 243 drainer_->Start(session_.get()); |
| 244 EXPECT_FALSE(result_waiter_.WaitForResult()); | 244 EXPECT_FALSE(result_waiter_.WaitForResult()); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 too_many_chunks += 1; // Now it's too large. | 302 too_many_chunks += 1; // Now it's too large. |
| 303 | 303 |
| 304 mock_stream_->set_num_chunks(too_many_chunks); | 304 mock_stream_->set_num_chunks(too_many_chunks); |
| 305 drainer_->Start(session_.get()); | 305 drainer_->Start(session_.get()); |
| 306 EXPECT_TRUE(result_waiter_.WaitForResult()); | 306 EXPECT_TRUE(result_waiter_.WaitForResult()); |
| 307 } | 307 } |
| 308 | 308 |
| 309 } // namespace | 309 } // namespace |
| 310 | 310 |
| 311 } // namespace net | 311 } // namespace net |
| OLD | NEW |