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_proxy_client_socket.h" | 5 #include "net/spdy/spdy_proxy_client_socket.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "net/base/address_list.h" | 10 #include "net/base/address_list.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 scoped_refptr<SpdyStream> spdy_stream_; | 121 scoped_refptr<SpdyStream> spdy_stream_; |
122 spdy::BufferedSpdyFramer framer_; | 122 spdy::BufferedSpdyFramer framer_; |
123 | 123 |
124 std::string user_agent_; | 124 std::string user_agent_; |
125 GURL url_; | 125 GURL url_; |
126 HostPortPair proxy_host_port_; | 126 HostPortPair proxy_host_port_; |
127 HostPortPair endpoint_host_port_pair_; | 127 HostPortPair endpoint_host_port_pair_; |
128 ProxyServer proxy_; | 128 ProxyServer proxy_; |
129 HostPortProxyPair endpoint_host_port_proxy_pair_; | 129 HostPortProxyPair endpoint_host_port_proxy_pair_; |
130 scoped_refptr<TransportSocketParams> transport_params_; | 130 scoped_refptr<TransportSocketParams> transport_params_; |
| 131 SpdyTestStateHelper spdy_state_; |
131 | 132 |
132 DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocketSpdy3Test); | 133 DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocketSpdy3Test); |
133 }; | 134 }; |
134 | 135 |
135 SpdyProxyClientSocketSpdy3Test::SpdyProxyClientSocketSpdy3Test() | 136 SpdyProxyClientSocketSpdy3Test::SpdyProxyClientSocketSpdy3Test() |
136 : sock_(NULL), | 137 : sock_(NULL), |
137 data_(NULL), | 138 data_(NULL), |
138 session_(NULL), | 139 session_(NULL), |
139 read_buf_(NULL), | 140 read_buf_(NULL), |
140 session_deps_(), | 141 session_deps_(), |
(...skipping 11 matching lines...) Expand all Loading... |
152 LOWEST, | 153 LOWEST, |
153 false, | 154 false, |
154 false)) { | 155 false)) { |
155 } | 156 } |
156 | 157 |
157 void SpdyProxyClientSocketSpdy3Test::TearDown() { | 158 void SpdyProxyClientSocketSpdy3Test::TearDown() { |
158 sock_.reset(NULL); | 159 sock_.reset(NULL); |
159 if (session_ != NULL) | 160 if (session_ != NULL) |
160 session_->spdy_session_pool()->CloseAllSessions(); | 161 session_->spdy_session_pool()->CloseAllSessions(); |
161 | 162 |
162 spdy::SpdyFramer::set_enable_compression_default(true); | |
163 // Empty the current queue. | 163 // Empty the current queue. |
164 MessageLoop::current()->RunAllPending(); | 164 MessageLoop::current()->RunAllPending(); |
165 PlatformTest::TearDown(); | 165 PlatformTest::TearDown(); |
166 } | 166 } |
167 | 167 |
168 void SpdyProxyClientSocketSpdy3Test::Initialize(MockRead* reads, | 168 void SpdyProxyClientSocketSpdy3Test::Initialize(MockRead* reads, |
169 size_t reads_count, | 169 size_t reads_count, |
170 MockWrite* writes, | 170 MockWrite* writes, |
171 size_t writes_count) { | 171 size_t writes_count) { |
172 data_ = new DeterministicSocketData(reads, reads_count, writes, writes_count); | 172 data_ = new DeterministicSocketData(reads, reads_count, writes, writes_count); |
173 data_->set_connect_data(connect_data_); | 173 data_->set_connect_data(connect_data_); |
174 data_->SetStop(2); | 174 data_->SetStop(2); |
175 | 175 |
176 session_deps_.deterministic_socket_factory->AddSocketDataProvider( | 176 session_deps_.deterministic_socket_factory->AddSocketDataProvider( |
177 data_.get()); | 177 data_.get()); |
178 session_deps_.host_resolver->set_synchronous_mode(true); | 178 session_deps_.host_resolver->set_synchronous_mode(true); |
179 | 179 |
180 session_ = SpdySessionDependencies::SpdyCreateSessionDeterministic( | 180 session_ = SpdySessionDependencies::SpdyCreateSessionDeterministic( |
181 &session_deps_); | 181 &session_deps_); |
182 spdy::SpdyFramer::set_enable_compression_default(false); | |
183 | 182 |
184 // Creates a new spdy session | 183 // Creates a new spdy session |
185 spdy_session_ = | 184 spdy_session_ = |
186 session_->spdy_session_pool()->Get(endpoint_host_port_proxy_pair_, | 185 session_->spdy_session_pool()->Get(endpoint_host_port_proxy_pair_, |
187 BoundNetLog()); | 186 BoundNetLog()); |
188 | 187 |
189 // Perform the TCP connect | 188 // Perform the TCP connect |
190 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 189 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
191 EXPECT_EQ(OK, | 190 EXPECT_EQ(OK, |
192 connection->Init(endpoint_host_port_pair_.ToString(), | 191 connection->Init(endpoint_host_port_pair_.ToString(), |
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 write_callback_.callback())); | 1307 write_callback_.callback())); |
1309 | 1308 |
1310 Run(2); | 1309 Run(2); |
1311 | 1310 |
1312 EXPECT_FALSE(sock_.get()); | 1311 EXPECT_FALSE(sock_.get()); |
1313 EXPECT_TRUE(read_callback.have_result()); | 1312 EXPECT_TRUE(read_callback.have_result()); |
1314 EXPECT_FALSE(write_callback_.have_result()); | 1313 EXPECT_FALSE(write_callback_.have_result()); |
1315 } | 1314 } |
1316 | 1315 |
1317 } // namespace net | 1316 } // namespace net |
OLD | NEW |