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