OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/spdy/spdy_io_buffer.h" | 7 #include "net/spdy/spdy_io_buffer.h" |
8 #include "net/spdy/spdy_stream.h" | 8 #include "net/spdy/spdy_stream.h" |
9 #include "net/spdy/spdy_test_util.h" | 9 #include "net/spdy/spdy_test_util.h" |
10 #include "testing/platform_test.h" | 10 #include "testing/platform_test.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 HostPortPair test_host_port_pair(kTestHost, kTestPort); | 84 HostPortPair test_host_port_pair(kTestHost, kTestPort); |
85 HostPortProxyPair pair(test_host_port_pair, ProxyServer::Direct()); | 85 HostPortProxyPair pair(test_host_port_pair, ProxyServer::Direct()); |
86 | 86 |
87 SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool()); | 87 SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool()); |
88 EXPECT_FALSE(spdy_session_pool->HasSession(pair)); | 88 EXPECT_FALSE(spdy_session_pool->HasSession(pair)); |
89 scoped_refptr<SpdySession> session = | 89 scoped_refptr<SpdySession> session = |
90 spdy_session_pool->Get(pair, http_session->mutable_spdy_settings(), | 90 spdy_session_pool->Get(pair, http_session->mutable_spdy_settings(), |
91 BoundNetLog()); | 91 BoundNetLog()); |
92 EXPECT_TRUE(spdy_session_pool->HasSession(pair)); | 92 EXPECT_TRUE(spdy_session_pool->HasSession(pair)); |
93 | 93 |
94 scoped_refptr<TCPSocketParams> tcp_params = | 94 scoped_refptr<TCPSocketParams> tcp_params( |
95 new TCPSocketParams(kTestHost, kTestPort, MEDIUM, GURL(), false); | 95 new TCPSocketParams(kTestHost, kTestPort, MEDIUM, GURL(), false)); |
96 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 96 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
97 EXPECT_EQ(OK, | 97 EXPECT_EQ(OK, |
98 connection->Init(test_host_port_pair.ToString(), tcp_params, MEDIUM, | 98 connection->Init(test_host_port_pair.ToString(), tcp_params, MEDIUM, |
99 NULL, http_session->tcp_socket_pool(), | 99 NULL, http_session->tcp_socket_pool(), |
100 BoundNetLog())); | 100 BoundNetLog())); |
101 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); | 101 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); |
102 | 102 |
103 // Flush the SpdySession::OnReadComplete() task. | 103 // Flush the SpdySession::OnReadComplete() task. |
104 MessageLoop::current()->RunAllPending(); | 104 MessageLoop::current()->RunAllPending(); |
105 | 105 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 test_host_port_pair, old_settings); | 193 test_host_port_pair, old_settings); |
194 | 194 |
195 // Create a session. | 195 // Create a session. |
196 SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool()); | 196 SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool()); |
197 EXPECT_FALSE(spdy_session_pool->HasSession(pair)); | 197 EXPECT_FALSE(spdy_session_pool->HasSession(pair)); |
198 scoped_refptr<SpdySession> session = | 198 scoped_refptr<SpdySession> session = |
199 spdy_session_pool->Get(pair, http_session->mutable_spdy_settings(), | 199 spdy_session_pool->Get(pair, http_session->mutable_spdy_settings(), |
200 BoundNetLog()); | 200 BoundNetLog()); |
201 ASSERT_TRUE(spdy_session_pool->HasSession(pair)); | 201 ASSERT_TRUE(spdy_session_pool->HasSession(pair)); |
202 | 202 |
203 scoped_refptr<TCPSocketParams> tcp_params = | 203 scoped_refptr<TCPSocketParams> tcp_params( |
204 new TCPSocketParams(kTestHost, kTestPort, MEDIUM, GURL(), false); | 204 new TCPSocketParams(kTestHost, kTestPort, MEDIUM, GURL(), false)); |
205 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 205 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
206 EXPECT_EQ(OK, | 206 EXPECT_EQ(OK, |
207 connection->Init(test_host_port_pair.ToString(), tcp_params, MEDIUM, | 207 connection->Init(test_host_port_pair.ToString(), tcp_params, MEDIUM, |
208 NULL, http_session->tcp_socket_pool(), | 208 NULL, http_session->tcp_socket_pool(), |
209 BoundNetLog())); | 209 BoundNetLog())); |
210 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); | 210 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); |
211 | 211 |
212 // Create 2 streams. First will succeed. Second will be pending. | 212 // Create 2 streams. First will succeed. Second will be pending. |
213 scoped_refptr<SpdyStream> spdy_stream1; | 213 scoped_refptr<SpdyStream> spdy_stream1; |
214 TestCompletionCallback callback1; | 214 TestCompletionCallback callback1; |
(...skipping 17 matching lines...) Expand all Loading... |
232 // Make sure |stream_releaser| holds the last refs. | 232 // Make sure |stream_releaser| holds the last refs. |
233 session = NULL; | 233 session = NULL; |
234 spdy_stream1 = NULL; | 234 spdy_stream1 = NULL; |
235 | 235 |
236 EXPECT_EQ(OK, stream_releaser.WaitForResult()); | 236 EXPECT_EQ(OK, stream_releaser.WaitForResult()); |
237 } | 237 } |
238 | 238 |
239 } // namespace | 239 } // namespace |
240 | 240 |
241 } // namespace net | 241 } // namespace net |
OLD | NEW |