OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_websocket_stream.h" | 5 #include "net/spdy/spdy_websocket_stream.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "net/base/completion_callback.h" | 10 #include "net/base/completion_callback.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // Set max concurrent streams to 1. | 257 // Set max concurrent streams to 1. |
258 spdy_session_pool->http_server_properties()->SetSpdySettings( | 258 spdy_session_pool->http_server_properties()->SetSpdySettings( |
259 host_port_pair_, spdy_settings_to_set_); | 259 host_port_pair_, spdy_settings_to_set_); |
260 } | 260 } |
261 | 261 |
262 EXPECT_FALSE(spdy_session_pool->HasSession(host_port_proxy_pair_)); | 262 EXPECT_FALSE(spdy_session_pool->HasSession(host_port_proxy_pair_)); |
263 session_ = spdy_session_pool->Get(host_port_proxy_pair_, BoundNetLog()); | 263 session_ = spdy_session_pool->Get(host_port_proxy_pair_, BoundNetLog()); |
264 EXPECT_TRUE(spdy_session_pool->HasSession(host_port_proxy_pair_)); | 264 EXPECT_TRUE(spdy_session_pool->HasSession(host_port_proxy_pair_)); |
265 transport_params_ = new TransportSocketParams(host_port_pair_, MEDIUM, | 265 transport_params_ = new TransportSocketParams(host_port_pair_, MEDIUM, |
266 false, false); | 266 false, false); |
267 TestOldCompletionCallback callback; | 267 TestCompletionCallback callback; |
268 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 268 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
269 EXPECT_EQ(ERR_IO_PENDING, | 269 EXPECT_EQ(ERR_IO_PENDING, |
270 connection->Init(host_port_pair_.ToString(), transport_params_, | 270 connection->Init(host_port_pair_.ToString(), transport_params_, |
271 MEDIUM, &callback, | 271 MEDIUM, callback.callback(), |
272 http_session_->GetTransportSocketPool(), | 272 http_session_->GetTransportSocketPool(), |
273 BoundNetLog())); | 273 BoundNetLog())); |
274 EXPECT_EQ(OK, callback.WaitForResult()); | 274 EXPECT_EQ(OK, callback.WaitForResult()); |
275 return session_->InitializeWithSocket(connection.release(), false, OK); | 275 return session_->InitializeWithSocket(connection.release(), false, OK); |
276 } | 276 } |
277 void SendRequest() { | 277 void SendRequest() { |
278 linked_ptr<spdy::SpdyHeaderBlock> headers(new spdy::SpdyHeaderBlock); | 278 linked_ptr<spdy::SpdyHeaderBlock> headers(new spdy::SpdyHeaderBlock); |
279 (*headers)["url"] = "ws://example.com/echo"; | 279 (*headers)["url"] = "ws://example.com/echo"; |
280 (*headers)["origin"] = "http://example.com/wsdemo"; | 280 (*headers)["origin"] = "http://example.com/wsdemo"; |
281 | 281 |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 EXPECT_EQ(OK, events[7].result); | 602 EXPECT_EQ(OK, events[7].result); |
603 | 603 |
604 // EOF close SPDY session. | 604 // EOF close SPDY session. |
605 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession( | 605 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession( |
606 host_port_proxy_pair_)); | 606 host_port_proxy_pair_)); |
607 EXPECT_TRUE(data()->at_read_eof()); | 607 EXPECT_TRUE(data()->at_read_eof()); |
608 EXPECT_TRUE(data()->at_write_eof()); | 608 EXPECT_TRUE(data()->at_write_eof()); |
609 } | 609 } |
610 | 610 |
611 } // namespace net | 611 } // namespace net |
OLD | NEW |