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

Side by Side Diff: net/spdy/spdy_http_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_http_stream.h" 5 #include "net/spdy/spdy_http_stream.h"
6 #include "net/spdy/spdy_session.h" 6 #include "net/spdy/spdy_session.h"
7 #include "net/spdy/spdy_test_util.h" 7 #include "net/spdy/spdy_test_util.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 class SpdyHttpStreamTest : public testing::Test { 12 class SpdyHttpStreamTest : public testing::Test {
13 public: 13 public:
14 OrderedSocketData* data() { return data_; } 14 OrderedSocketData* data() { return data_; }
15 protected: 15 protected:
16 SpdyHttpStreamTest() {} 16 SpdyHttpStreamTest() {}
17 17
18 void EnableCompression(bool enabled) { 18 void EnableCompression(bool enabled) {
19 spdy::SpdyFramer::set_enable_compression_default(enabled); 19 spdy::SpdyFramer::set_enable_compression_default(enabled);
20 } 20 }
21 21
22 virtual void SetUp() {
23 // Disable sending PING.
24 SpdySession::set_enable_ping_based_connection_checking(false);
25 }
26
22 virtual void TearDown() { 27 virtual void TearDown() {
23 MessageLoop::current()->RunAllPending(); 28 MessageLoop::current()->RunAllPending();
29 // Enable sending PING.
30 SpdySession::set_enable_ping_based_connection_checking(true);
24 } 31 }
25 int InitSession(MockRead* reads, size_t reads_count, 32 int InitSession(MockRead* reads, size_t reads_count,
26 MockWrite* writes, size_t writes_count, 33 MockWrite* writes, size_t writes_count,
27 HostPortPair& host_port_pair) { 34 HostPortPair& host_port_pair) {
28 HostPortProxyPair pair(host_port_pair, ProxyServer::Direct()); 35 HostPortProxyPair pair(host_port_pair, ProxyServer::Direct());
29 data_ = new OrderedSocketData(reads, reads_count, writes, writes_count); 36 data_ = new OrderedSocketData(reads, reads_count, writes, writes_count);
30 session_deps_.socket_factory->AddSocketDataProvider(data_.get()); 37 session_deps_.socket_factory->AddSocketDataProvider(data_.get());
31 http_session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_); 38 http_session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_);
32 session_ = http_session_->spdy_session_pool()->Get(pair, BoundNetLog()); 39 session_ = http_session_->spdy_session_pool()->Get(pair, BoundNetLog());
33 transport_params_ = new TransportSocketParams(host_port_pair, 40 transport_params_ = new TransportSocketParams(host_port_pair,
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // pool anymore. 224 // pool anymore.
218 EXPECT_FALSE(http_session_->spdy_session_pool()->HasSession(pair)); 225 EXPECT_FALSE(http_session_->spdy_session_pool()->HasSession(pair));
219 EXPECT_TRUE(data()->at_read_eof()); 226 EXPECT_TRUE(data()->at_read_eof());
220 EXPECT_TRUE(data()->at_write_eof()); 227 EXPECT_TRUE(data()->at_write_eof());
221 } 228 }
222 229
223 // TODO(willchan): Write a longer test for SpdyStream that exercises all 230 // TODO(willchan): Write a longer test for SpdyStream that exercises all
224 // methods. 231 // methods.
225 232
226 } // namespace net 233 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698