Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: net/spdy/spdy_websocket_stream_unittest.cc

Issue 8230037: Send PING to check the status of the SPDY connection. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 sync_callback_.Run(OK); 173 sync_callback_.Run(OK);
174 } 174 }
175 175
176 protected: 176 protected:
177 SpdyWebSocketStreamTest() {} 177 SpdyWebSocketStreamTest() {}
178 virtual ~SpdyWebSocketStreamTest() {} 178 virtual ~SpdyWebSocketStreamTest() {}
179 179
180 virtual void SetUp() { 180 virtual void SetUp() {
181 EnableCompression(false); 181 EnableCompression(false);
182 SpdySession::SetSSLMode(false); 182 SpdySession::SetSSLMode(false);
183 // Disable sending PING.
184 SpdySession::set_enable_ping_based_connection_checking(false);
183 185
184 host_port_pair_.set_host("example.com"); 186 host_port_pair_.set_host("example.com");
185 host_port_pair_.set_port(80); 187 host_port_pair_.set_port(80);
186 host_port_proxy_pair_.first = host_port_pair_; 188 host_port_proxy_pair_.first = host_port_pair_;
187 host_port_proxy_pair_.second = ProxyServer::Direct(); 189 host_port_proxy_pair_.second = ProxyServer::Direct();
188 190
189 const size_t max_concurrent_streams = 1; 191 const size_t max_concurrent_streams = 1;
190 spdy::SettingsFlagsAndId id(0); 192 spdy::SettingsFlagsAndId id(0);
191 id.set_id(spdy::SETTINGS_MAX_CONCURRENT_STREAMS); 193 id.set_id(spdy::SETTINGS_MAX_CONCURRENT_STREAMS);
192 194
193 id.set_flags(spdy::SETTINGS_FLAG_PLEASE_PERSIST); 195 id.set_flags(spdy::SETTINGS_FLAG_PLEASE_PERSIST);
194 spdy_settings_to_set_.push_back( 196 spdy_settings_to_set_.push_back(
195 spdy::SpdySetting(id, max_concurrent_streams)); 197 spdy::SpdySetting(id, max_concurrent_streams));
196 198
197 id.set_flags(spdy::SETTINGS_FLAG_PERSISTED); 199 id.set_flags(spdy::SETTINGS_FLAG_PERSISTED);
198 spdy_settings_to_send_.push_back( 200 spdy_settings_to_send_.push_back(
199 spdy::SpdySetting(id, max_concurrent_streams)); 201 spdy::SpdySetting(id, max_concurrent_streams));
200 } 202 }
201 virtual void TearDown() { 203 virtual void TearDown() {
202 MessageLoop::current()->RunAllPending(); 204 MessageLoop::current()->RunAllPending();
205 // Enable sending PING.
206 SpdySession::set_enable_ping_based_connection_checking(true);
203 } 207 }
204 208
205 void EnableCompression(bool enabled) { 209 void EnableCompression(bool enabled) {
206 spdy::SpdyFramer::set_enable_compression_default(enabled); 210 spdy::SpdyFramer::set_enable_compression_default(enabled);
207 } 211 }
208 void Prepare(spdy::SpdyStreamId stream_id) { 212 void Prepare(spdy::SpdyStreamId stream_id) {
209 stream_id_ = stream_id; 213 stream_id_ = stream_id;
210 214
211 const char* const request_headers[] = { 215 const char* const request_headers[] = {
212 "url", "ws://example.com/echo", 216 "url", "ws://example.com/echo",
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 EXPECT_EQ(OK, events[7].result); 606 EXPECT_EQ(OK, events[7].result);
603 607
604 // EOF close SPDY session. 608 // EOF close SPDY session.
605 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession( 609 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession(
606 host_port_proxy_pair_)); 610 host_port_proxy_pair_));
607 EXPECT_TRUE(data()->at_read_eof()); 611 EXPECT_TRUE(data()->at_read_eof());
608 EXPECT_TRUE(data()->at_write_eof()); 612 EXPECT_TRUE(data()->at_write_eof());
609 } 613 }
610 614
611 } // namespace net 615 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698