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/spdy/spdy_session.h" | 5 #include "net/spdy/spdy_session.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 | 1346 |
1347 scoped_refptr<SpdySession> session = GetSession(pair_); | 1347 scoped_refptr<SpdySession> session = GetSession(pair_); |
1348 | 1348 |
1349 SSLConfig ssl_config; | 1349 SSLConfig ssl_config; |
1350 scoped_refptr<TransportSocketParams> transport_params( | 1350 scoped_refptr<TransportSocketParams> transport_params( |
1351 new TransportSocketParams(test_host_port_pair_, | 1351 new TransportSocketParams(test_host_port_pair_, |
1352 MEDIUM, | 1352 MEDIUM, |
1353 false, | 1353 false, |
1354 false, | 1354 false, |
1355 OnHostResolutionCallback())); | 1355 OnHostResolutionCallback())); |
1356 scoped_refptr<SOCKSSocketParams> socks_params; | 1356 scoped_refptr<SSLSocketParams> ssl_params = |
1357 scoped_refptr<HttpProxySocketParams> http_proxy_params; | 1357 SSLSocketParams::CreateForDirectConnection( |
1358 scoped_refptr<SSLSocketParams> ssl_params( | 1358 transport_params, |
1359 new SSLSocketParams(transport_params, | 1359 test_host_port_pair_, |
1360 socks_params, | 1360 ssl_config, |
1361 http_proxy_params, | 1361 0, |
1362 ProxyServer::SCHEME_DIRECT, | 1362 false, |
1363 test_host_port_pair_, | 1363 false); |
1364 ssl_config, | |
1365 0, | |
1366 false, | |
1367 false)); | |
1368 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 1364 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
1369 EXPECT_EQ(OK, connection->Init(test_host_port_pair_.ToString(), | 1365 EXPECT_EQ(OK, connection->Init(test_host_port_pair_.ToString(), |
1370 ssl_params, MEDIUM, CompletionCallback(), | 1366 ssl_params, MEDIUM, CompletionCallback(), |
1371 http_session_->GetSSLSocketPool( | 1367 http_session_->GetSSLSocketPool( |
1372 HttpNetworkSession::NORMAL_SOCKET_POOL), | 1368 HttpNetworkSession::NORMAL_SOCKET_POOL), |
1373 BoundNetLog())); | 1369 BoundNetLog())); |
1374 | 1370 |
1375 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); | 1371 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); |
1376 EXPECT_TRUE(session->VerifyDomainAuthentication("www.example.org")); | 1372 EXPECT_TRUE(session->VerifyDomainAuthentication("www.example.org")); |
1377 EXPECT_TRUE(session->VerifyDomainAuthentication("mail.example.org")); | 1373 EXPECT_TRUE(session->VerifyDomainAuthentication("mail.example.org")); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1415 | 1411 |
1416 scoped_refptr<SpdySession> session = GetSession(pair_); | 1412 scoped_refptr<SpdySession> session = GetSession(pair_); |
1417 | 1413 |
1418 SSLConfig ssl_config; | 1414 SSLConfig ssl_config; |
1419 scoped_refptr<TransportSocketParams> transport_params( | 1415 scoped_refptr<TransportSocketParams> transport_params( |
1420 new TransportSocketParams(test_host_port_pair_, | 1416 new TransportSocketParams(test_host_port_pair_, |
1421 MEDIUM, | 1417 MEDIUM, |
1422 false, | 1418 false, |
1423 false, | 1419 false, |
1424 OnHostResolutionCallback())); | 1420 OnHostResolutionCallback())); |
1425 scoped_refptr<SOCKSSocketParams> socks_params; | 1421 scoped_refptr<SSLSocketParams> ssl_params = |
1426 scoped_refptr<HttpProxySocketParams> http_proxy_params; | 1422 SSLSocketParams::CreateForDirectConnection( |
1427 scoped_refptr<SSLSocketParams> ssl_params( | 1423 transport_params, |
1428 new SSLSocketParams(transport_params, | 1424 test_host_port_pair_, |
1429 socks_params, | 1425 ssl_config, |
1430 http_proxy_params, | 1426 0, |
1431 ProxyServer::SCHEME_DIRECT, | 1427 false, |
1432 test_host_port_pair_, | 1428 false); |
1433 ssl_config, | |
1434 0, | |
1435 false, | |
1436 false)); | |
1437 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 1429 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
1438 EXPECT_EQ(OK, connection->Init(test_host_port_pair_.ToString(), | 1430 EXPECT_EQ(OK, connection->Init(test_host_port_pair_.ToString(), |
1439 ssl_params, MEDIUM, CompletionCallback(), | 1431 ssl_params, MEDIUM, CompletionCallback(), |
1440 http_session_->GetSSLSocketPool( | 1432 http_session_->GetSSLSocketPool( |
1441 HttpNetworkSession::NORMAL_SOCKET_POOL), | 1433 HttpNetworkSession::NORMAL_SOCKET_POOL), |
1442 BoundNetLog())); | 1434 BoundNetLog())); |
1443 | 1435 |
1444 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); | 1436 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); |
1445 EXPECT_TRUE(session->VerifyDomainAuthentication("www.example.org")); | 1437 EXPECT_TRUE(session->VerifyDomainAuthentication("www.example.org")); |
1446 EXPECT_TRUE(session->VerifyDomainAuthentication("mail.example.org")); | 1438 EXPECT_TRUE(session->VerifyDomainAuthentication("mail.example.org")); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 | 1653 |
1662 scoped_refptr<SpdySession> session = GetSession(pair); | 1654 scoped_refptr<SpdySession> session = GetSession(pair); |
1663 | 1655 |
1664 SSLConfig ssl_config; | 1656 SSLConfig ssl_config; |
1665 scoped_refptr<TransportSocketParams> transport_params( | 1657 scoped_refptr<TransportSocketParams> transport_params( |
1666 new TransportSocketParams(test_host_port_pair, | 1658 new TransportSocketParams(test_host_port_pair, |
1667 MEDIUM, | 1659 MEDIUM, |
1668 false, | 1660 false, |
1669 false, | 1661 false, |
1670 OnHostResolutionCallback())); | 1662 OnHostResolutionCallback())); |
1671 scoped_refptr<SOCKSSocketParams> socks_params; | 1663 scoped_refptr<SSLSocketParams> ssl_params = |
1672 scoped_refptr<HttpProxySocketParams> http_proxy_params; | 1664 SSLSocketParams::CreateForDirectConnection( |
1673 scoped_refptr<SSLSocketParams> ssl_params( | 1665 transport_params, |
1674 new SSLSocketParams(transport_params, | 1666 test_host_port_pair, |
1675 socks_params, | 1667 ssl_config, |
1676 http_proxy_params, | 1668 0, |
1677 ProxyServer::SCHEME_DIRECT, | 1669 false, |
1678 test_host_port_pair, | 1670 false); |
1679 ssl_config, | |
1680 0, | |
1681 false, | |
1682 false)); | |
1683 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 1671 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
1684 EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(), | 1672 EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(), |
1685 ssl_params, MEDIUM, CompletionCallback(), | 1673 ssl_params, MEDIUM, CompletionCallback(), |
1686 http_session_->GetSSLSocketPool( | 1674 http_session_->GetSSLSocketPool( |
1687 HttpNetworkSession::NORMAL_SOCKET_POOL), | 1675 HttpNetworkSession::NORMAL_SOCKET_POOL), |
1688 BoundNetLog())); | 1676 BoundNetLog())); |
1689 | 1677 |
1690 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), true, OK)); | 1678 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), true, OK)); |
1691 | 1679 |
1692 EXPECT_TRUE(session->NeedsCredentials()); | 1680 EXPECT_TRUE(session->NeedsCredentials()); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1727 | 1715 |
1728 SSLConfig ssl_config; | 1716 SSLConfig ssl_config; |
1729 scoped_refptr<TransportSocketParams> transport_params( | 1717 scoped_refptr<TransportSocketParams> transport_params( |
1730 new TransportSocketParams(test_host_port_pair, | 1718 new TransportSocketParams(test_host_port_pair, |
1731 MEDIUM, | 1719 MEDIUM, |
1732 false, | 1720 false, |
1733 false, | 1721 false, |
1734 OnHostResolutionCallback())); | 1722 OnHostResolutionCallback())); |
1735 scoped_refptr<SOCKSSocketParams> socks_params; | 1723 scoped_refptr<SOCKSSocketParams> socks_params; |
1736 scoped_refptr<HttpProxySocketParams> http_proxy_params; | 1724 scoped_refptr<HttpProxySocketParams> http_proxy_params; |
1737 scoped_refptr<SSLSocketParams> ssl_params( | 1725 scoped_refptr<SSLSocketParams> ssl_params = |
1738 new SSLSocketParams(transport_params, | 1726 SSLSocketParams::CreateForDirectConnection( |
1739 socks_params, | 1727 transport_params, |
1740 http_proxy_params, | 1728 test_host_port_pair, |
1741 ProxyServer::SCHEME_DIRECT, | 1729 ssl_config, |
1742 test_host_port_pair, | 1730 0, |
1743 ssl_config, | 1731 false, |
1744 0, | 1732 false); |
1745 false, | |
1746 false)); | |
1747 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 1733 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
1748 EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(), | 1734 EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(), |
1749 ssl_params, MEDIUM, CompletionCallback(), | 1735 ssl_params, MEDIUM, CompletionCallback(), |
1750 http_session_->GetSSLSocketPool( | 1736 http_session_->GetSSLSocketPool( |
1751 HttpNetworkSession::NORMAL_SOCKET_POOL), | 1737 HttpNetworkSession::NORMAL_SOCKET_POOL), |
1752 BoundNetLog())); | 1738 BoundNetLog())); |
1753 | 1739 |
1754 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), true, OK)); | 1740 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), true, OK)); |
1755 EXPECT_TRUE(session->NeedsCredentials()); | 1741 EXPECT_TRUE(session->NeedsCredentials()); |
1756 | 1742 |
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3352 EXPECT_EQ(0, delegate1.body_data_sent()); | 3338 EXPECT_EQ(0, delegate1.body_data_sent()); |
3353 | 3339 |
3354 EXPECT_TRUE(delegate2.send_headers_completed()); | 3340 EXPECT_TRUE(delegate2.send_headers_completed()); |
3355 EXPECT_EQ("200", delegate2.GetResponseHeaderValue(":status")); | 3341 EXPECT_EQ("200", delegate2.GetResponseHeaderValue(":status")); |
3356 EXPECT_EQ("HTTP/1.1", delegate2.GetResponseHeaderValue(":version")); | 3342 EXPECT_EQ("HTTP/1.1", delegate2.GetResponseHeaderValue(":version")); |
3357 EXPECT_EQ(std::string(), delegate2.TakeReceivedData()); | 3343 EXPECT_EQ(std::string(), delegate2.TakeReceivedData()); |
3358 EXPECT_EQ(0, delegate2.body_data_sent()); | 3344 EXPECT_EQ(0, delegate2.body_data_sent()); |
3359 } | 3345 } |
3360 | 3346 |
3361 } // namespace net | 3347 } // namespace net |
OLD | NEW |