| 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" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "net/base/completion_callback.h" | 12 #include "net/base/completion_callback.h" |
| 13 #include "net/proxy/proxy_server.h" | 13 #include "net/proxy/proxy_server.h" |
| 14 #include "net/socket/ssl_client_socket.h" |
| 14 #include "net/spdy/spdy_http_utils.h" | 15 #include "net/spdy/spdy_http_utils.h" |
| 15 #include "net/spdy/spdy_protocol.h" | 16 #include "net/spdy/spdy_protocol.h" |
| 16 #include "net/spdy/spdy_session.h" | 17 #include "net/spdy/spdy_session.h" |
| 17 #include "net/spdy/spdy_test_util_spdy3.h" | 18 #include "net/spdy/spdy_test_util_spdy3.h" |
| 18 #include "net/spdy/spdy_websocket_test_util_spdy3.h" | 19 #include "net/spdy/spdy_websocket_test_util_spdy3.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 21 |
| 21 using namespace net::test_spdy3; | 22 using namespace net::test_spdy3; |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 void DoSync(SpdyWebSocketStreamEvent* event) { | 183 void DoSync(SpdyWebSocketStreamEvent* event) { |
| 183 sync_callback_.SetResult(OK); | 184 sync_callback_.SetResult(OK); |
| 184 } | 185 } |
| 185 | 186 |
| 186 protected: | 187 protected: |
| 187 SpdyWebSocketStreamSpdy3Test() {} | 188 SpdyWebSocketStreamSpdy3Test() {} |
| 188 virtual ~SpdyWebSocketStreamSpdy3Test() {} | 189 virtual ~SpdyWebSocketStreamSpdy3Test() {} |
| 189 | 190 |
| 190 virtual void SetUp() { | 191 virtual void SetUp() { |
| 191 EnableCompression(false); | 192 EnableCompression(false); |
| 193 SpdySession::set_default_protocol(SSLClientSocket::kProtoSPDY3); |
| 192 SpdySession::SetSSLMode(false); | 194 SpdySession::SetSSLMode(false); |
| 193 | 195 |
| 194 host_port_pair_.set_host("example.com"); | 196 host_port_pair_.set_host("example.com"); |
| 195 host_port_pair_.set_port(80); | 197 host_port_pair_.set_port(80); |
| 196 host_port_proxy_pair_.first = host_port_pair_; | 198 host_port_proxy_pair_.first = host_port_pair_; |
| 197 host_port_proxy_pair_.second = ProxyServer::Direct(); | 199 host_port_proxy_pair_.second = ProxyServer::Direct(); |
| 198 | 200 |
| 199 const size_t max_concurrent_streams = 1; | 201 const size_t max_concurrent_streams = 1; |
| 200 spdy::SettingsFlagsAndId id(0); | 202 spdy::SettingsFlagsAndId id(spdy::SETTINGS_FLAG_PLEASE_PERSIST, |
| 201 id.set_id(spdy::SETTINGS_MAX_CONCURRENT_STREAMS); | 203 spdy::SETTINGS_MAX_CONCURRENT_STREAMS); |
| 202 | |
| 203 id.set_flags(spdy::SETTINGS_FLAG_PLEASE_PERSIST); | |
| 204 spdy_settings_to_set_.push_back( | 204 spdy_settings_to_set_.push_back( |
| 205 spdy::SpdySetting(id, max_concurrent_streams)); | 205 spdy::SpdySetting(id, max_concurrent_streams)); |
| 206 | 206 |
| 207 id.set_flags(spdy::SETTINGS_FLAG_PERSISTED); | 207 spdy::SettingsFlagsAndId id1(spdy::SETTINGS_FLAG_PERSISTED, |
| 208 spdy::SETTINGS_MAX_CONCURRENT_STREAMS); |
| 208 spdy_settings_to_send_.push_back( | 209 spdy_settings_to_send_.push_back( |
| 209 spdy::SpdySetting(id, max_concurrent_streams)); | 210 spdy::SpdySetting(id1, max_concurrent_streams)); |
| 210 } | 211 } |
| 212 |
| 211 virtual void TearDown() { | 213 virtual void TearDown() { |
| 212 MessageLoop::current()->RunAllPending(); | 214 MessageLoop::current()->RunAllPending(); |
| 213 } | 215 } |
| 214 | 216 |
| 215 void EnableCompression(bool enabled) { | 217 void EnableCompression(bool enabled) { |
| 216 spdy::SpdyFramer::set_enable_compression_default(enabled); | 218 spdy::SpdyFramer::set_enable_compression_default(enabled); |
| 217 } | 219 } |
| 218 void Prepare(spdy::SpdyStreamId stream_id) { | 220 void Prepare(spdy::SpdyStreamId stream_id) { |
| 219 stream_id_ = stream_id; | 221 stream_id_ = stream_id; |
| 220 | 222 |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 EXPECT_EQ(OK, events[7].result); | 621 EXPECT_EQ(OK, events[7].result); |
| 620 | 622 |
| 621 // EOF close SPDY session. | 623 // EOF close SPDY session. |
| 622 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession( | 624 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession( |
| 623 host_port_proxy_pair_)); | 625 host_port_proxy_pair_)); |
| 624 EXPECT_TRUE(data()->at_read_eof()); | 626 EXPECT_TRUE(data()->at_read_eof()); |
| 625 EXPECT_TRUE(data()->at_write_eof()); | 627 EXPECT_TRUE(data()->at_write_eof()); |
| 626 } | 628 } |
| 627 | 629 |
| 628 } // namespace net | 630 } // namespace net |
| OLD | NEW |