OLD | NEW |
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_proxy_client_socket.h" | 5 #include "net/spdy/spdy_proxy_client_socket.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "net/base/address_list.h" | 8 #include "net/base/address_list.h" |
9 #include "net/base/net_log.h" | 9 #include "net/base/net_log.h" |
10 #include "net/base/net_log_unittest.h" | 10 #include "net/base/net_log_unittest.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 static const int kLen333 = kLen3 + kLen3 + kLen3; | 50 static const int kLen333 = kLen3 + kLen3 + kLen3; |
51 | 51 |
52 } // anonymous namespace | 52 } // anonymous namespace |
53 | 53 |
54 namespace net { | 54 namespace net { |
55 | 55 |
56 class SpdyProxyClientSocketTest : public PlatformTest { | 56 class SpdyProxyClientSocketTest : public PlatformTest { |
57 public: | 57 public: |
58 SpdyProxyClientSocketTest(); | 58 SpdyProxyClientSocketTest(); |
59 | 59 |
| 60 virtual void SetUp(); |
| 61 |
60 virtual void TearDown(); | 62 virtual void TearDown(); |
61 | 63 |
62 protected: | 64 protected: |
63 void Initialize(MockRead* reads, size_t reads_count, MockWrite* writes, | 65 void Initialize(MockRead* reads, size_t reads_count, MockWrite* writes, |
64 size_t writes_count); | 66 size_t writes_count); |
65 spdy::SpdyFrame* ConstructConnectRequestFrame(); | 67 spdy::SpdyFrame* ConstructConnectRequestFrame(); |
66 spdy::SpdyFrame* ConstructConnectAuthRequestFrame(); | 68 spdy::SpdyFrame* ConstructConnectAuthRequestFrame(); |
67 spdy::SpdyFrame* ConstructConnectReplyFrame(); | 69 spdy::SpdyFrame* ConstructConnectReplyFrame(); |
68 spdy::SpdyFrame* ConstructConnectAuthReplyFrame(); | 70 spdy::SpdyFrame* ConstructConnectAuthReplyFrame(); |
69 spdy::SpdyFrame* ConstructConnectErrorReplyFrame(); | 71 spdy::SpdyFrame* ConstructConnectErrorReplyFrame(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 endpoint_host_port_pair_(kOriginHost, kOriginPort), | 144 endpoint_host_port_pair_(kOriginHost, kOriginPort), |
143 proxy_(ProxyServer::SCHEME_HTTPS, proxy_host_port_), | 145 proxy_(ProxyServer::SCHEME_HTTPS, proxy_host_port_), |
144 endpoint_host_port_proxy_pair_(endpoint_host_port_pair_, proxy_), | 146 endpoint_host_port_proxy_pair_(endpoint_host_port_pair_, proxy_), |
145 transport_params_(new TransportSocketParams(proxy_host_port_, | 147 transport_params_(new TransportSocketParams(proxy_host_port_, |
146 LOWEST, | 148 LOWEST, |
147 url_, | 149 url_, |
148 false, | 150 false, |
149 false)) { | 151 false)) { |
150 } | 152 } |
151 | 153 |
| 154 void SpdyProxyClientSocketTest::SetUp() { |
| 155 // Disable sending PING. |
| 156 SpdySession::set_enable_ping_based_connection_checking(false); |
| 157 } |
| 158 |
152 void SpdyProxyClientSocketTest::TearDown() { | 159 void SpdyProxyClientSocketTest::TearDown() { |
153 if (session_ != NULL) | 160 if (session_ != NULL) |
154 session_->spdy_session_pool()->CloseAllSessions(); | 161 session_->spdy_session_pool()->CloseAllSessions(); |
155 | 162 |
156 spdy::SpdyFramer::set_enable_compression_default(true); | 163 spdy::SpdyFramer::set_enable_compression_default(true); |
157 // Empty the current queue. | 164 // Empty the current queue. |
158 MessageLoop::current()->RunAllPending(); | 165 MessageLoop::current()->RunAllPending(); |
159 PlatformTest::TearDown(); | 166 PlatformTest::TearDown(); |
| 167 // Enable sending PING. |
| 168 SpdySession::set_enable_ping_based_connection_checking(true); |
160 } | 169 } |
161 | 170 |
162 void SpdyProxyClientSocketTest::Initialize(MockRead* reads, | 171 void SpdyProxyClientSocketTest::Initialize(MockRead* reads, |
163 size_t reads_count, | 172 size_t reads_count, |
164 MockWrite* writes, | 173 MockWrite* writes, |
165 size_t writes_count) { | 174 size_t writes_count) { |
166 data_ = new DeterministicSocketData(reads, reads_count, writes, writes_count); | 175 data_ = new DeterministicSocketData(reads, reads_count, writes, writes_count); |
167 data_->set_connect_data(connect_data_); | 176 data_->set_connect_data(connect_data_); |
168 data_->SetStop(2); | 177 data_->SetStop(2); |
169 | 178 |
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 scoped_refptr<IOBuffer> buf(new IOBuffer(kLen1)); | 1173 scoped_refptr<IOBuffer> buf(new IOBuffer(kLen1)); |
1165 ASSERT_EQ(ERR_IO_PENDING, sock_->Read(buf, kLen1, &read_callback_)); | 1174 ASSERT_EQ(ERR_IO_PENDING, sock_->Read(buf, kLen1, &read_callback_)); |
1166 | 1175 |
1167 sock_->Disconnect(); | 1176 sock_->Disconnect(); |
1168 | 1177 |
1169 EXPECT_FALSE(sock_->IsConnected()); | 1178 EXPECT_FALSE(sock_->IsConnected()); |
1170 EXPECT_FALSE(read_callback_.have_result()); | 1179 EXPECT_FALSE(read_callback_.have_result()); |
1171 } | 1180 } |
1172 | 1181 |
1173 } // namespace net | 1182 } // namespace net |
OLD | NEW |