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

Side by Side Diff: net/socket/ssl_client_socket_pool_unittest.cc

Issue 1006643002: Plumb connection attempts from (non-proxy) ConnectJobs to HttpNetworkTransaction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, resolve conflict Created 5 years, 7 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
« no previous file with comments | « net/socket/ssl_client_socket_pool.cc ('k') | net/socket/transport_client_socket_pool.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/http/http_proxy_client_socket_pool.h" 5 #include "net/http/http_proxy_client_socket_pool.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 scoped_refptr<SSLSocketParams> params = SSLParams(ProxyServer::SCHEME_DIRECT, 220 scoped_refptr<SSLSocketParams> params = SSLParams(ProxyServer::SCHEME_DIRECT,
221 false); 221 false);
222 222
223 ClientSocketHandle handle; 223 ClientSocketHandle handle;
224 int rv = handle.Init("a", params, MEDIUM, CompletionCallback(), pool_.get(), 224 int rv = handle.Init("a", params, MEDIUM, CompletionCallback(), pool_.get(),
225 BoundNetLog()); 225 BoundNetLog());
226 EXPECT_EQ(ERR_CONNECTION_FAILED, rv); 226 EXPECT_EQ(ERR_CONNECTION_FAILED, rv);
227 EXPECT_FALSE(handle.is_initialized()); 227 EXPECT_FALSE(handle.is_initialized());
228 EXPECT_FALSE(handle.socket()); 228 EXPECT_FALSE(handle.socket());
229 EXPECT_FALSE(handle.is_ssl_error()); 229 EXPECT_FALSE(handle.is_ssl_error());
230 ASSERT_EQ(1u, handle.connection_attempts().size());
231 EXPECT_EQ(ERR_CONNECTION_FAILED, handle.connection_attempts()[0].result);
230 } 232 }
231 233
232 TEST_P(SSLClientSocketPoolTest, TCPFailAsync) { 234 TEST_P(SSLClientSocketPoolTest, TCPFailAsync) {
233 StaticSocketDataProvider data; 235 StaticSocketDataProvider data;
234 data.set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_FAILED)); 236 data.set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_FAILED));
235 socket_factory_.AddSocketDataProvider(&data); 237 socket_factory_.AddSocketDataProvider(&data);
236 238
237 CreatePool(true /* tcp pool */, false, false); 239 CreatePool(true /* tcp pool */, false, false);
238 scoped_refptr<SSLSocketParams> params = SSLParams(ProxyServer::SCHEME_DIRECT, 240 scoped_refptr<SSLSocketParams> params = SSLParams(ProxyServer::SCHEME_DIRECT,
239 false); 241 false);
240 242
241 ClientSocketHandle handle; 243 ClientSocketHandle handle;
242 TestCompletionCallback callback; 244 TestCompletionCallback callback;
243 int rv = handle.Init( 245 int rv = handle.Init(
244 "a", params, MEDIUM, callback.callback(), pool_.get(), BoundNetLog()); 246 "a", params, MEDIUM, callback.callback(), pool_.get(), BoundNetLog());
245 EXPECT_EQ(ERR_IO_PENDING, rv); 247 EXPECT_EQ(ERR_IO_PENDING, rv);
246 EXPECT_FALSE(handle.is_initialized()); 248 EXPECT_FALSE(handle.is_initialized());
247 EXPECT_FALSE(handle.socket()); 249 EXPECT_FALSE(handle.socket());
248 250
249 EXPECT_EQ(ERR_CONNECTION_FAILED, callback.WaitForResult()); 251 EXPECT_EQ(ERR_CONNECTION_FAILED, callback.WaitForResult());
250 EXPECT_FALSE(handle.is_initialized()); 252 EXPECT_FALSE(handle.is_initialized());
251 EXPECT_FALSE(handle.socket()); 253 EXPECT_FALSE(handle.socket());
252 EXPECT_FALSE(handle.is_ssl_error()); 254 EXPECT_FALSE(handle.is_ssl_error());
255 ASSERT_EQ(1u, handle.connection_attempts().size());
256 EXPECT_EQ(ERR_CONNECTION_FAILED, handle.connection_attempts()[0].result);
253 } 257 }
254 258
255 TEST_P(SSLClientSocketPoolTest, BasicDirect) { 259 TEST_P(SSLClientSocketPoolTest, BasicDirect) {
256 StaticSocketDataProvider data; 260 StaticSocketDataProvider data;
257 data.set_connect_data(MockConnect(SYNCHRONOUS, OK)); 261 data.set_connect_data(MockConnect(SYNCHRONOUS, OK));
258 socket_factory_.AddSocketDataProvider(&data); 262 socket_factory_.AddSocketDataProvider(&data);
259 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); 263 SSLSocketDataProvider ssl(SYNCHRONOUS, OK);
260 socket_factory_.AddSSLSocketDataProvider(&ssl); 264 socket_factory_.AddSSLSocketDataProvider(&ssl);
261 265
262 CreatePool(true /* tcp pool */, false, false); 266 CreatePool(true /* tcp pool */, false, false);
263 scoped_refptr<SSLSocketParams> params = SSLParams(ProxyServer::SCHEME_DIRECT, 267 scoped_refptr<SSLSocketParams> params = SSLParams(ProxyServer::SCHEME_DIRECT,
264 false); 268 false);
265 269
266 ClientSocketHandle handle; 270 ClientSocketHandle handle;
267 TestCompletionCallback callback; 271 TestCompletionCallback callback;
268 int rv = handle.Init( 272 int rv = handle.Init(
269 "a", params, MEDIUM, callback.callback(), pool_.get(), BoundNetLog()); 273 "a", params, MEDIUM, callback.callback(), pool_.get(), BoundNetLog());
270 EXPECT_EQ(OK, rv); 274 EXPECT_EQ(OK, rv);
271 EXPECT_TRUE(handle.is_initialized()); 275 EXPECT_TRUE(handle.is_initialized());
272 EXPECT_TRUE(handle.socket()); 276 EXPECT_TRUE(handle.socket());
273 TestLoadTimingInfo(handle); 277 TestLoadTimingInfo(handle);
278 EXPECT_EQ(0u, handle.connection_attempts().size());
274 } 279 }
275 280
276 // Make sure that SSLConnectJob passes on its priority to its 281 // Make sure that SSLConnectJob passes on its priority to its
277 // socket request on Init (for the DIRECT case). 282 // socket request on Init (for the DIRECT case).
278 TEST_P(SSLClientSocketPoolTest, SetSocketRequestPriorityOnInitDirect) { 283 TEST_P(SSLClientSocketPoolTest, SetSocketRequestPriorityOnInitDirect) {
279 CreatePool(true /* tcp pool */, false, false); 284 CreatePool(true /* tcp pool */, false, false);
280 scoped_refptr<SSLSocketParams> params = 285 scoped_refptr<SSLSocketParams> params =
281 SSLParams(ProxyServer::SCHEME_DIRECT, false); 286 SSLParams(ProxyServer::SCHEME_DIRECT, false);
282 287
283 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) { 288 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) {
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 ssl.channel_id_sent = true; 916 ssl.channel_id_sent = true;
912 ssl.SetNextProto(GetParam()); 917 ssl.SetNextProto(GetParam());
913 TestIPPoolingDisabled(&ssl); 918 TestIPPoolingDisabled(&ssl);
914 } 919 }
915 920
916 // It would be nice to also test the timeouts in SSLClientSocketPool. 921 // It would be nice to also test the timeouts in SSLClientSocketPool.
917 922
918 } // namespace 923 } // namespace
919 924
920 } // namespace net 925 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_pool.cc ('k') | net/socket/transport_client_socket_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698