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

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

Issue 11464028: Introduce ERR_NETWORK_CHANGED and allow URLFetcher to automatically retry on that error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed nits Created 8 years 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) 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/socket/transport_client_socket_pool.h" 5 #include "net/socket/transport_client_socket_pool.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/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 976
977 EXPECT_EQ(OK, callback.WaitForResult()); 977 EXPECT_EQ(OK, callback.WaitForResult());
978 EXPECT_TRUE(handle.is_initialized()); 978 EXPECT_TRUE(handle.is_initialized());
979 EXPECT_TRUE(handle.socket()); 979 EXPECT_TRUE(handle.socket());
980 980
981 // One socket is stalled, the other is active. 981 // One socket is stalled, the other is active.
982 EXPECT_EQ(0, pool_.IdleSocketCount()); 982 EXPECT_EQ(0, pool_.IdleSocketCount());
983 handle.Reset(); 983 handle.Reset();
984 984
985 // Close all pending connect jobs and existing sockets. 985 // Close all pending connect jobs and existing sockets.
986 pool_.Flush(); 986 pool_.FlushWithError(ERR_NETWORK_CHANGED);
987 } 987 }
988 } 988 }
989 989
990 // Test the case where a socket took long enough to start the creation 990 // Test the case where a socket took long enough to start the creation
991 // of the backup socket, but then we cancelled the request after that. 991 // of the backup socket, but then we cancelled the request after that.
992 TEST_F(TransportClientSocketPoolTest, BackupSocketCancel) { 992 TEST_F(TransportClientSocketPoolTest, BackupSocketCancel) {
993 client_socket_factory_.set_client_socket_type( 993 client_socket_factory_.set_client_socket_type(
994 MockClientSocketFactory::MOCK_STALLED_CLIENT_SOCKET); 994 MockClientSocketFactory::MOCK_STALLED_CLIENT_SOCKET);
995 995
996 enum { CANCEL_BEFORE_WAIT, CANCEL_AFTER_WAIT }; 996 enum { CANCEL_BEFORE_WAIT, CANCEL_AFTER_WAIT };
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 EXPECT_TRUE(handle.socket()); 1274 EXPECT_TRUE(handle.socket());
1275 IPEndPoint endpoint; 1275 IPEndPoint endpoint;
1276 handle.socket()->GetLocalAddress(&endpoint); 1276 handle.socket()->GetLocalAddress(&endpoint);
1277 EXPECT_EQ(kIPv4AddressSize, endpoint.address().size()); 1277 EXPECT_EQ(kIPv4AddressSize, endpoint.address().size());
1278 EXPECT_EQ(1, client_socket_factory_.allocation_count()); 1278 EXPECT_EQ(1, client_socket_factory_.allocation_count());
1279 } 1279 }
1280 1280
1281 } // namespace 1281 } // namespace
1282 1282
1283 } // namespace net 1283 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/transport_client_socket_pool.cc ('k') | net/spdy/spdy_network_transaction_spdy2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698