From 71bc9a80281fdd05026e8646cce72639d888747a Mon Sep 17 00:00:00 2001 From: "willchan@chromium.org" Date: Thu, 4 Jun 2009 06:11:48 +0000 Subject: Fix valgrind/purify errors with ClientSocketPoolTest_ConnectCancelConnect. The ConnectingSocket never ran to completion. Call WaitForResult() to force it to finish and delete itself. Review URL: http://codereview.chromium.org/119152 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17610 0039d316-1c4b-4281-b951-d872f2087c98 --- net/base/client_socket_pool_unittest.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'net') diff --git a/net/base/client_socket_pool_unittest.cc b/net/base/client_socket_pool_unittest.cc index 7272709..f38ef81 100644 --- a/net/base/client_socket_pool_unittest.cc +++ b/net/base/client_socket_pool_unittest.cc @@ -365,9 +365,9 @@ TEST_F(ClientSocketPoolTest, TwoRequestsCancelOne) { TestSocketRequest req2(pool_.get(), &request_order_); EXPECT_EQ(ERR_IO_PENDING, - req.handle.Init("a", "www.google.com", 80, 5, &req)); + req.handle.Init("a", "127.0.0.1", 80, 5, &req)); EXPECT_EQ(ERR_IO_PENDING, - req2.handle.Init("a", "www.google.com", 80, 5, &req)); + req.handle.Init("a", "127.0.0.1", 80, 5, &req)); req.handle.Reset(); PlatformThread::Sleep(100); @@ -388,12 +388,12 @@ TEST_F(ClientSocketPoolTest, ConnectCancelConnect) { TestSocketRequest req(pool_.get(), &request_order_); EXPECT_EQ(ERR_IO_PENDING, - req.handle.Init("a", "www.google.com", 80, 5, &req)); + req.handle.Init("a", "127.0.0.1", 80, 5, &req)); req.handle.Reset(); EXPECT_EQ(ERR_IO_PENDING, - req.handle.Init("a", "www.google.com", 80, 5, &req)); + req.handle.Init("a", "127.0.0.1", 80, 5, &req)); // There is a benign race condition here. The worker pool may or may not post // the tasks before we get here. It won't test the case properly if it @@ -409,9 +409,8 @@ TEST_F(ClientSocketPoolTest, ConnectCancelConnect) { PlatformThread::Sleep(100); MessageLoop::current()->RunAllPending(); - req.handle.Reset(); - // The handle's Reset method may have posted a task. - MessageLoop::current()->RunAllPending(); + // Don't leak the ConnectingSocket, make sure it runs to completion. + req.WaitForResult(); } TEST_F(ClientSocketPoolTest, CancelRequest) { -- cgit v1.1