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

Side by Side Diff: net/spdy/spdy_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 "base/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "net/spdy/spdy_stream.h" 6 #include "net/spdy/spdy_stream.h"
7 #include "net/spdy/spdy_http_utils.h" 7 #include "net/spdy/spdy_http_utils.h"
8 #include "net/spdy/spdy_session.h" 8 #include "net/spdy/spdy_session.h"
9 #include "net/spdy/spdy_test_util.h" 9 #include "net/spdy/spdy_test_util.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 scoped_refptr<SpdySession> CreateSpdySession() { 102 scoped_refptr<SpdySession> CreateSpdySession() {
103 spdy::SpdyFramer::set_enable_compression_default(false); 103 spdy::SpdyFramer::set_enable_compression_default(false);
104 HostPortPair host_port_pair("www.google.com", 80); 104 HostPortPair host_port_pair("www.google.com", 80);
105 HostPortProxyPair pair(host_port_pair, ProxyServer::Direct()); 105 HostPortProxyPair pair(host_port_pair, ProxyServer::Direct());
106 scoped_refptr<SpdySession> session( 106 scoped_refptr<SpdySession> session(
107 session_->spdy_session_pool()->Get(pair, BoundNetLog())); 107 session_->spdy_session_pool()->Get(pair, BoundNetLog()));
108 return session; 108 return session;
109 } 109 }
110 110
111 virtual void SetUp() OVERRIDE {
112 // Disable sending PING.
113 SpdySession::set_enable_ping_based_connection_checking(false);
114 }
115
111 virtual void TearDown() { 116 virtual void TearDown() {
112 MessageLoop::current()->RunAllPending(); 117 MessageLoop::current()->RunAllPending();
118 // Enable sending PING.
119 SpdySession::set_enable_ping_based_connection_checking(true);
113 } 120 }
114 121
115 scoped_refptr<HttpNetworkSession> session_; 122 scoped_refptr<HttpNetworkSession> session_;
116 }; 123 };
117 124
118 TEST_F(SpdyStreamTest, SendDataAfterOpen) { 125 TEST_F(SpdyStreamTest, SendDataAfterOpen) {
119 SpdySessionDependencies session_deps; 126 SpdySessionDependencies session_deps;
120 127
121 session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps); 128 session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps);
122 SpdySessionPoolPeer pool_peer_(session_->spdy_session_pool()); 129 SpdySessionPoolPeer pool_peer_(session_->spdy_session_pool());
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 stream->OnHeaders(headers); 268 stream->OnHeaders(headers);
262 269
263 stream->set_response_received(); 270 stream->set_response_received();
264 EXPECT_TRUE(stream->response_received()); 271 EXPECT_TRUE(stream->response_received());
265 EXPECT_TRUE(stream->HasUrl()); 272 EXPECT_TRUE(stream->HasUrl());
266 EXPECT_EQ(kStreamUrl, stream->GetUrl().spec()); 273 EXPECT_EQ(kStreamUrl, stream->GetUrl().spec());
267 } 274 }
268 275
269 276
270 } // namespace net 277 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698