| 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 "net/base/host_cache.h" | 7 #include "net/base/host_cache.h" |
| 8 #include "net/base/ip_endpoint.h" | 8 #include "net/base/ip_endpoint.h" |
| 9 #include "net/base/net_log_unittest.h" | 9 #include "net/base/net_log_unittest.h" |
| 10 #include "net/spdy/spdy_io_buffer.h" | 10 #include "net/spdy/spdy_io_buffer.h" |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 803 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
| 804 EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(), | 804 EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(), |
| 805 transport_params, MEDIUM, CompletionCallback(), | 805 transport_params, MEDIUM, CompletionCallback(), |
| 806 http_session->GetTransportSocketPool( | 806 http_session->GetTransportSocketPool( |
| 807 HttpNetworkSession::NORMAL_SOCKET_POOL), | 807 HttpNetworkSession::NORMAL_SOCKET_POOL), |
| 808 BoundNetLog())); | 808 BoundNetLog())); |
| 809 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); | 809 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); |
| 810 | 810 |
| 811 // TODO(rtenneti): MockClientSocket::GetPeerAddress return's 0 as the port | 811 // TODO(rtenneti): MockClientSocket::GetPeerAddress return's 0 as the port |
| 812 // number. Fix it to return port 80 and then use GetPeerAddress to AddAlias. | 812 // number. Fix it to return port 80 and then use GetPeerAddress to AddAlias. |
| 813 const addrinfo* address = test_hosts[0].addresses.head(); | |
| 814 SpdySessionPoolPeer pool_peer(spdy_session_pool); | 813 SpdySessionPoolPeer pool_peer(spdy_session_pool); |
| 815 pool_peer.AddAlias(address, test_hosts[0].pair); | 814 pool_peer.AddAlias(test_hosts[0].addresses.front(), test_hosts[0].pair); |
| 816 | 815 |
| 817 // Flush the SpdySession::OnReadComplete() task. | 816 // Flush the SpdySession::OnReadComplete() task. |
| 818 MessageLoop::current()->RunAllPending(); | 817 MessageLoop::current()->RunAllPending(); |
| 819 | 818 |
| 820 // The third host has no overlap with the first, so it can't pool IPs. | 819 // The third host has no overlap with the first, so it can't pool IPs. |
| 821 EXPECT_FALSE(spdy_session_pool->HasSession(test_hosts[2].pair)); | 820 EXPECT_FALSE(spdy_session_pool->HasSession(test_hosts[2].pair)); |
| 822 | 821 |
| 823 // The second host overlaps with the first, and should IP pool. | 822 // The second host overlaps with the first, and should IP pool. |
| 824 EXPECT_TRUE(spdy_session_pool->HasSession(test_hosts[1].pair)); | 823 EXPECT_TRUE(spdy_session_pool->HasSession(test_hosts[1].pair)); |
| 825 | 824 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 net::NetLog::PHASE_NONE); | 1036 net::NetLog::PHASE_NONE); |
| 1038 | 1037 |
| 1039 CapturingNetLog::Entry entry = entries[pos]; | 1038 CapturingNetLog::Entry entry = entries[pos]; |
| 1040 NetLogSpdySessionCloseParameter* request_params = | 1039 NetLogSpdySessionCloseParameter* request_params = |
| 1041 static_cast<NetLogSpdySessionCloseParameter*>( | 1040 static_cast<NetLogSpdySessionCloseParameter*>( |
| 1042 entry.extra_parameters.get()); | 1041 entry.extra_parameters.get()); |
| 1043 EXPECT_EQ(ERR_CONNECTION_CLOSED, request_params->status()); | 1042 EXPECT_EQ(ERR_CONNECTION_CLOSED, request_params->status()); |
| 1044 } | 1043 } |
| 1045 | 1044 |
| 1046 } // namespace net | 1045 } // namespace net |
| OLD | NEW |