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

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

Issue 2050005: Reland 46757. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Reduce large iteration check. Created 10 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/client_socket_pool_base_unittest.cc ('k') | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/tcp_client_socket_pool.h" 5 #include "net/socket/tcp_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/message_loop.h" 9 #include "base/message_loop.h"
10 #include "net/base/mock_host_resolver.h" 10 #include "net/base/mock_host_resolver.h"
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 // Let the appropriate socket connect. 724 // Let the appropriate socket connect.
725 MessageLoop::current()->RunAllPending(); 725 MessageLoop::current()->RunAllPending();
726 726
727 EXPECT_EQ(OK, callback.WaitForResult()); 727 EXPECT_EQ(OK, callback.WaitForResult());
728 EXPECT_TRUE(handle.is_initialized()); 728 EXPECT_TRUE(handle.is_initialized());
729 EXPECT_TRUE(handle.socket()); 729 EXPECT_TRUE(handle.socket());
730 730
731 // One socket is stalled, the other is active. 731 // One socket is stalled, the other is active.
732 EXPECT_EQ(0, pool_->IdleSocketCount()); 732 EXPECT_EQ(0, pool_->IdleSocketCount());
733 handle.Reset(); 733 handle.Reset();
734
735 pool_ = new TCPClientSocketPool(kMaxSockets,
736 kMaxSocketsPerGroup,
737 "TCPUnitTest",
738 host_resolver_,
739 &client_socket_factory_,
740 NULL);
734 } 741 }
735 } 742 }
736 743
737 // Test the case where a socket took long enough to start the creation 744 // Test the case where a socket took long enough to start the creation
738 // of the backup socket, but then we cancelled the request after that. 745 // of the backup socket, but then we cancelled the request after that.
739 TEST_F(TCPClientSocketPoolTest, BackupSocketCancel) { 746 TEST_F(TCPClientSocketPoolTest, BackupSocketCancel) {
740 client_socket_factory_.set_client_socket_type( 747 client_socket_factory_.set_client_socket_type(
741 MockClientSocketFactory::MOCK_STALLED_CLIENT_SOCKET); 748 MockClientSocketFactory::MOCK_STALLED_CLIENT_SOCKET);
742 749
743 enum { CANCEL_BEFORE_WAIT, CANCEL_AFTER_WAIT }; 750 enum { CANCEL_BEFORE_WAIT, CANCEL_AFTER_WAIT };
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 EXPECT_FALSE(handle.socket()); 869 EXPECT_FALSE(handle.socket());
863 handle.Reset(); 870 handle.Reset();
864 871
865 // Reset for the next case. 872 // Reset for the next case.
866 host_resolver_->set_synchronous_mode(false); 873 host_resolver_->set_synchronous_mode(false);
867 } 874 }
868 875
869 } // namespace 876 } // namespace
870 877
871 } // namespace net 878 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/client_socket_pool_base_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698