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_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 "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 189 |
190 host_port_pair_.set_host("example.com"); | 190 host_port_pair_.set_host("example.com"); |
191 host_port_pair_.set_port(80); | 191 host_port_pair_.set_port(80); |
192 host_port_proxy_pair_.first = host_port_pair_; | 192 host_port_proxy_pair_.first = host_port_pair_; |
193 host_port_proxy_pair_.second = ProxyServer::Direct(); | 193 host_port_proxy_pair_.second = ProxyServer::Direct(); |
194 | 194 |
195 spdy_settings_id_to_set_ = SETTINGS_MAX_CONCURRENT_STREAMS; | 195 spdy_settings_id_to_set_ = SETTINGS_MAX_CONCURRENT_STREAMS; |
196 spdy_settings_flags_to_set_ = SETTINGS_FLAG_PLEASE_PERSIST; | 196 spdy_settings_flags_to_set_ = SETTINGS_FLAG_PLEASE_PERSIST; |
197 spdy_settings_value_to_set_ = 1; | 197 spdy_settings_value_to_set_ = 1; |
198 | 198 |
199 SettingsFlagsAndId id1(SETTINGS_FLAG_PERSISTED, spdy_settings_id_to_set_); | 199 spdy_settings_to_send_[spdy_settings_id_to_set_] = |
200 spdy_settings_to_send_.push_back( | 200 SettingsFlagsAndValue( |
201 SpdySetting(id1, spdy_settings_value_to_set_)); | 201 SETTINGS_FLAG_PERSISTED, spdy_settings_value_to_set_); |
202 } | 202 } |
203 | 203 |
204 virtual void TearDown() { | 204 virtual void TearDown() { |
205 MessageLoop::current()->RunAllPending(); | 205 MessageLoop::current()->RunAllPending(); |
206 } | 206 } |
207 | 207 |
208 void Prepare(SpdyStreamId stream_id) { | 208 void Prepare(SpdyStreamId stream_id) { |
209 stream_id_ = stream_id; | 209 stream_id_ = stream_id; |
210 | 210 |
211 const char* const request_headers[] = { | 211 const char* const request_headers[] = { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 linked_ptr<SpdyHeaderBlock> headers(new SpdyHeaderBlock); | 283 linked_ptr<SpdyHeaderBlock> headers(new SpdyHeaderBlock); |
284 (*headers)["url"] = "ws://example.com/echo"; | 284 (*headers)["url"] = "ws://example.com/echo"; |
285 (*headers)["origin"] = "http://example.com/wsdemo"; | 285 (*headers)["origin"] = "http://example.com/wsdemo"; |
286 | 286 |
287 websocket_stream_->SendRequest(headers); | 287 websocket_stream_->SendRequest(headers); |
288 } | 288 } |
289 | 289 |
290 SpdySettingsIds spdy_settings_id_to_set_; | 290 SpdySettingsIds spdy_settings_id_to_set_; |
291 SpdySettingsFlags spdy_settings_flags_to_set_; | 291 SpdySettingsFlags spdy_settings_flags_to_set_; |
292 uint32 spdy_settings_value_to_set_; | 292 uint32 spdy_settings_value_to_set_; |
293 SpdySettings spdy_settings_to_send_; | 293 SettingsMap spdy_settings_to_send_; |
294 SpdySessionDependencies session_deps_; | 294 SpdySessionDependencies session_deps_; |
295 scoped_ptr<OrderedSocketData> data_; | 295 scoped_ptr<OrderedSocketData> data_; |
296 scoped_refptr<HttpNetworkSession> http_session_; | 296 scoped_refptr<HttpNetworkSession> http_session_; |
297 scoped_refptr<SpdySession> session_; | 297 scoped_refptr<SpdySession> session_; |
298 scoped_refptr<TransportSocketParams> transport_params_; | 298 scoped_refptr<TransportSocketParams> transport_params_; |
299 scoped_ptr<SpdyWebSocketStream> websocket_stream_; | 299 scoped_ptr<SpdyWebSocketStream> websocket_stream_; |
300 SpdyStreamId stream_id_; | 300 SpdyStreamId stream_id_; |
301 scoped_ptr<SpdyFrame> request_frame_; | 301 scoped_ptr<SpdyFrame> request_frame_; |
302 scoped_ptr<SpdyFrame> response_frame_; | 302 scoped_ptr<SpdyFrame> response_frame_; |
303 scoped_ptr<SpdyFrame> message_frame_; | 303 scoped_ptr<SpdyFrame> message_frame_; |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 EXPECT_EQ(OK, events[7].result); | 618 EXPECT_EQ(OK, events[7].result); |
619 | 619 |
620 // EOF close SPDY session. | 620 // EOF close SPDY session. |
621 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession( | 621 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession( |
622 host_port_proxy_pair_)); | 622 host_port_proxy_pair_)); |
623 EXPECT_TRUE(data()->at_read_eof()); | 623 EXPECT_TRUE(data()->at_read_eof()); |
624 EXPECT_TRUE(data()->at_write_eof()); | 624 EXPECT_TRUE(data()->at_write_eof()); |
625 } | 625 } |
626 | 626 |
627 } // namespace net | 627 } // namespace net |
OLD | NEW |