| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/spdy/spdy_test_util_common.h" | 5 #include "net/spdy/spdy_test_util_common.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 base::WeakPtr<SpdySession> CreateSpdySessionHelper( | 493 base::WeakPtr<SpdySession> CreateSpdySessionHelper( |
| 494 HttpNetworkSession* http_session, | 494 HttpNetworkSession* http_session, |
| 495 const SpdySessionKey& key, | 495 const SpdySessionKey& key, |
| 496 const BoundNetLog& net_log, | 496 const BoundNetLog& net_log, |
| 497 Error expected_status, | 497 Error expected_status, |
| 498 bool is_secure) { | 498 bool is_secure) { |
| 499 EXPECT_FALSE(HasSpdySession(http_session->spdy_session_pool(), key)); | 499 EXPECT_FALSE(HasSpdySession(http_session->spdy_session_pool(), key)); |
| 500 | 500 |
| 501 scoped_refptr<TransportSocketParams> transport_params( | 501 scoped_refptr<TransportSocketParams> transport_params( |
| 502 new TransportSocketParams( | 502 new TransportSocketParams( |
| 503 key.host_port_pair(), false, false, OnHostResolutionCallback(), | 503 key.host_port_pair(), false, OnHostResolutionCallback(), |
| 504 TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DEFAULT)); | 504 TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DEFAULT)); |
| 505 | 505 |
| 506 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 506 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
| 507 TestCompletionCallback callback; | 507 TestCompletionCallback callback; |
| 508 | 508 |
| 509 int rv = ERR_UNEXPECTED; | 509 int rv = ERR_UNEXPECTED; |
| 510 if (is_secure) { | 510 if (is_secure) { |
| 511 SSLConfig ssl_config; | 511 SSLConfig ssl_config; |
| 512 scoped_refptr<SSLSocketParams> ssl_params( | 512 scoped_refptr<SSLSocketParams> ssl_params( |
| 513 new SSLSocketParams(transport_params, | 513 new SSLSocketParams(transport_params, |
| 514 NULL, | 514 NULL, |
| 515 NULL, | 515 NULL, |
| 516 key.host_port_pair(), | 516 key.host_port_pair(), |
| 517 ssl_config, | 517 ssl_config, |
| 518 key.privacy_mode(), | 518 key.privacy_mode(), |
| 519 0, | 519 0, |
| 520 false)); | 520 false)); |
| 521 rv = connection->Init(key.host_port_pair().ToString(), | 521 rv = connection->Init( |
| 522 ssl_params, | 522 key.host_port_pair().ToString(), ssl_params, MEDIUM, false, |
| 523 MEDIUM, | 523 callback.callback(), |
| 524 callback.callback(), | 524 http_session->GetSSLSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL), |
| 525 http_session->GetSSLSocketPool( | 525 net_log); |
| 526 HttpNetworkSession::NORMAL_SOCKET_POOL), | |
| 527 net_log); | |
| 528 } else { | 526 } else { |
| 529 rv = connection->Init(key.host_port_pair().ToString(), | 527 rv = connection->Init(key.host_port_pair().ToString(), transport_params, |
| 530 transport_params, | 528 MEDIUM, false, callback.callback(), |
| 531 MEDIUM, | |
| 532 callback.callback(), | |
| 533 http_session->GetTransportSocketPool( | 529 http_session->GetTransportSocketPool( |
| 534 HttpNetworkSession::NORMAL_SOCKET_POOL), | 530 HttpNetworkSession::NORMAL_SOCKET_POOL), |
| 535 net_log); | 531 net_log); |
| 536 } | 532 } |
| 537 | 533 |
| 538 if (rv == ERR_IO_PENDING) | 534 if (rv == ERR_IO_PENDING) |
| 539 rv = callback.WaitForResult(); | 535 rv = callback.WaitForResult(); |
| 540 | 536 |
| 541 EXPECT_EQ(OK, rv); | 537 EXPECT_EQ(OK, rv); |
| 542 | 538 |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1341 } | 1337 } |
| 1342 } | 1338 } |
| 1343 | 1339 |
| 1344 void SpdyTestUtil::SetPriority(RequestPriority priority, | 1340 void SpdyTestUtil::SetPriority(RequestPriority priority, |
| 1345 SpdySynStreamIR* ir) const { | 1341 SpdySynStreamIR* ir) const { |
| 1346 ir->set_priority(ConvertRequestPriorityToSpdyPriority( | 1342 ir->set_priority(ConvertRequestPriorityToSpdyPriority( |
| 1347 priority, spdy_version())); | 1343 priority, spdy_version())); |
| 1348 } | 1344 } |
| 1349 | 1345 |
| 1350 } // namespace net | 1346 } // namespace net |
| OLD | NEW |