| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 178 |
| 179 void DoSync(SpdyWebSocketStreamEvent* event) { | 179 void DoSync(SpdyWebSocketStreamEvent* event) { |
| 180 sync_callback_.callback().Run(OK); | 180 sync_callback_.callback().Run(OK); |
| 181 } | 181 } |
| 182 | 182 |
| 183 protected: | 183 protected: |
| 184 SpdyWebSocketStreamSpdy3Test() {} | 184 SpdyWebSocketStreamSpdy3Test() {} |
| 185 virtual ~SpdyWebSocketStreamSpdy3Test() {} | 185 virtual ~SpdyWebSocketStreamSpdy3Test() {} |
| 186 | 186 |
| 187 virtual void SetUp() { | 187 virtual void SetUp() { |
| 188 SpdySession::set_default_protocol(kProtoSPDY3); | |
| 189 | |
| 190 host_port_pair_.set_host("example.com"); | 188 host_port_pair_.set_host("example.com"); |
| 191 host_port_pair_.set_port(80); | 189 host_port_pair_.set_port(80); |
| 192 host_port_proxy_pair_.first = host_port_pair_; | 190 host_port_proxy_pair_.first = host_port_pair_; |
| 193 host_port_proxy_pair_.second = ProxyServer::Direct(); | 191 host_port_proxy_pair_.second = ProxyServer::Direct(); |
| 194 | 192 |
| 195 spdy_settings_id_to_set_ = SETTINGS_MAX_CONCURRENT_STREAMS; | 193 spdy_settings_id_to_set_ = SETTINGS_MAX_CONCURRENT_STREAMS; |
| 196 spdy_settings_flags_to_set_ = SETTINGS_FLAG_PLEASE_PERSIST; | 194 spdy_settings_flags_to_set_ = SETTINGS_FLAG_PLEASE_PERSIST; |
| 197 spdy_settings_value_to_set_ = 1; | 195 spdy_settings_value_to_set_ = 1; |
| 198 | 196 |
| 199 spdy_settings_to_send_[spdy_settings_id_to_set_] = | 197 spdy_settings_to_send_[spdy_settings_id_to_set_] = |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 scoped_ptr<SpdyFrame> closing_frame_; | 292 scoped_ptr<SpdyFrame> closing_frame_; |
| 295 HostPortPair host_port_pair_; | 293 HostPortPair host_port_pair_; |
| 296 HostPortProxyPair host_port_proxy_pair_; | 294 HostPortProxyPair host_port_proxy_pair_; |
| 297 TestCompletionCallback completion_callback_; | 295 TestCompletionCallback completion_callback_; |
| 298 TestCompletionCallback sync_callback_; | 296 TestCompletionCallback sync_callback_; |
| 299 | 297 |
| 300 static const char kMessageFrame[]; | 298 static const char kMessageFrame[]; |
| 301 static const char kClosingFrame[]; | 299 static const char kClosingFrame[]; |
| 302 static const size_t kMessageFrameLength; | 300 static const size_t kMessageFrameLength; |
| 303 static const size_t kClosingFrameLength; | 301 static const size_t kClosingFrameLength; |
| 304 | |
| 305 private: | |
| 306 SpdyTestStateHelper spdy_state_; | |
| 307 }; | 302 }; |
| 308 | 303 |
| 309 // TODO(toyoshim): Replace old framing data to new one, then use HEADERS and | 304 // TODO(toyoshim): Replace old framing data to new one, then use HEADERS and |
| 310 // data frames. | 305 // data frames. |
| 311 const char SpdyWebSocketStreamSpdy3Test::kMessageFrame[] = "\x81\x05hello"; | 306 const char SpdyWebSocketStreamSpdy3Test::kMessageFrame[] = "\x81\x05hello"; |
| 312 const char SpdyWebSocketStreamSpdy3Test::kClosingFrame[] = "\x88\0"; | 307 const char SpdyWebSocketStreamSpdy3Test::kClosingFrame[] = "\x88\0"; |
| 313 const size_t SpdyWebSocketStreamSpdy3Test::kMessageFrameLength = | 308 const size_t SpdyWebSocketStreamSpdy3Test::kMessageFrameLength = |
| 314 arraysize(SpdyWebSocketStreamSpdy3Test::kMessageFrame) - 1; | 309 arraysize(SpdyWebSocketStreamSpdy3Test::kMessageFrame) - 1; |
| 315 const size_t SpdyWebSocketStreamSpdy3Test::kClosingFrameLength = | 310 const size_t SpdyWebSocketStreamSpdy3Test::kClosingFrameLength = |
| 316 arraysize(SpdyWebSocketStreamSpdy3Test::kClosingFrame) - 1; | 311 arraysize(SpdyWebSocketStreamSpdy3Test::kClosingFrame) - 1; |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 EXPECT_EQ(OK, events[7].result); | 606 EXPECT_EQ(OK, events[7].result); |
| 612 | 607 |
| 613 // EOF close SPDY session. | 608 // EOF close SPDY session. |
| 614 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession( | 609 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession( |
| 615 host_port_proxy_pair_)); | 610 host_port_proxy_pair_)); |
| 616 EXPECT_TRUE(data()->at_read_eof()); | 611 EXPECT_TRUE(data()->at_read_eof()); |
| 617 EXPECT_TRUE(data()->at_write_eof()); | 612 EXPECT_TRUE(data()->at_write_eof()); |
| 618 } | 613 } |
| 619 | 614 |
| 620 } // namespace net | 615 } // namespace net |
| OLD | NEW |