From d510a78cd1aef9c2bdc692c79bae4a89f4851a98 Mon Sep 17 00:00:00 2001 From: "willchan@chromium.org" Date: Mon, 17 May 2010 05:35:06 +0000 Subject: This is roughly a reland of r43908, although I had to rewrite a fair chunk since code's changed a lot. I've changed it so as not to flush the host resolver too. I suspect there might have been a bug there. I was unable to reproduce the crash here on network change, so I think either that fixed it or something else changed under the hood. In any case, I want to reland this and see if anyone encounters any problems with it. BUG=40455,40457 Review URL: http://codereview.chromium.org/2114004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47395 0039d316-1c4b-4281-b951-d872f2087c98 --- net/socket/tcp_client_socket_pool_unittest.cc | 35 ++------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) (limited to 'net/socket/tcp_client_socket_pool_unittest.cc') diff --git a/net/socket/tcp_client_socket_pool_unittest.cc b/net/socket/tcp_client_socket_pool_unittest.cc index cba12b5..fdd8e6e 100644 --- a/net/socket/tcp_client_socket_pool_unittest.cc +++ b/net/socket/tcp_client_socket_pool_unittest.cc @@ -8,7 +8,6 @@ #include "base/compiler_specific.h" #include "base/message_loop.h" #include "net/base/mock_host_resolver.h" -#include "net/base/mock_network_change_notifier.h" #include "net/base/net_errors.h" #include "net/base/test_completion_callback.h" #include "net/socket/client_socket.h" @@ -263,9 +262,7 @@ class TCPClientSocketPoolTest : public ClientSocketPoolTest { kMaxSocketsPerGroup, "TCPUnitTest", host_resolver_, - &client_socket_factory_, - ¬ifier_)) { - } + &client_socket_factory_)) {} int StartRequest(const std::string& group_name, RequestPriority priority) { return StartRequestUsingPool( @@ -275,7 +272,6 @@ class TCPClientSocketPoolTest : public ClientSocketPoolTest { TCPSocketParams ignored_socket_params_; scoped_refptr host_resolver_; MockClientSocketFactory client_socket_factory_; - MockNetworkChangeNotifier notifier_; scoped_refptr pool_; }; @@ -652,32 +648,6 @@ TEST_F(TCPClientSocketPoolTest, FailingActiveRequestWithPendingRequests) { EXPECT_EQ(ERR_CONNECTION_FAILED, requests_[i]->WaitForResult()); } -TEST_F(TCPClientSocketPoolTest, ResetIdleSocketsOnIPAddressChange) { - TestCompletionCallback callback; - ClientSocketHandle handle; - TCPSocketParams dest("www.google.com", 80, LOW, GURL(), false); - int rv = handle.Init("a", dest, LOW, &callback, pool_, BoundNetLog()); - EXPECT_EQ(ERR_IO_PENDING, rv); - EXPECT_FALSE(handle.is_initialized()); - EXPECT_FALSE(handle.socket()); - - EXPECT_EQ(OK, callback.WaitForResult()); - EXPECT_TRUE(handle.is_initialized()); - EXPECT_TRUE(handle.socket()); - - handle.Reset(); - - // Need to run all pending to release the socket back to the pool. - MessageLoop::current()->RunAllPending(); - - // Now we should have 1 idle socket. - EXPECT_EQ(1, pool_->IdleSocketCount()); - - // After an IP address change, we should have 0 idle sockets. - notifier_.NotifyIPAddressChange(); - EXPECT_EQ(0, pool_->IdleSocketCount()); -} - TEST_F(TCPClientSocketPoolTest, BackupSocketConnect) { // Case 1 tests the first socket stalling, and the backup connecting. MockClientSocketFactory::ClientSocketType case1_types[] = { @@ -736,8 +706,7 @@ TEST_F(TCPClientSocketPoolTest, BackupSocketConnect) { kMaxSocketsPerGroup, "TCPUnitTest", host_resolver_, - &client_socket_factory_, - NULL); + &client_socket_factory_); } } -- cgit v1.1