diff options
author | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-22 19:51:07 +0000 |
---|---|---|
committer | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-22 19:51:07 +0000 |
commit | 6b62593d8c267a935c03913b950a064d00f98a3f (patch) | |
tree | a50ab16c24a53e2614eb0371727931676789631a /net/socket | |
parent | 999731f231cb6705ed0f8d88a00f3107c55b70b4 (diff) | |
download | chromium_src-6b62593d8c267a935c03913b950a064d00f98a3f.zip chromium_src-6b62593d8c267a935c03913b950a064d00f98a3f.tar.gz chromium_src-6b62593d8c267a935c03913b950a064d00f98a3f.tar.bz2 |
Cleanup testing objects.
BUG=NONE
TEST=Heapchecker errors eliminated
Review URL: http://codereview.chromium.org/1108004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42241 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket')
-rw-r--r-- | net/socket/socks_client_socket_pool_unittest.cc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/net/socket/socks_client_socket_pool_unittest.cc b/net/socket/socks_client_socket_pool_unittest.cc index 9f8ff7f..4291f3c 100644 --- a/net/socket/socks_client_socket_pool_unittest.cc +++ b/net/socket/socks_client_socket_pool_unittest.cc @@ -61,6 +61,8 @@ class MockTCPClientSocketPool : public TCPClientSocketPool { return; if (rv == OK) handle_->set_socket(socket_.get()); + else + socket_.reset(NULL); socket_.release(); handle_ = NULL; @@ -131,7 +133,7 @@ class MockTCPClientSocketPool : public TCPClientSocketPool { ClientSocketFactory* client_socket_factory_; int release_count_; int cancel_count_; - std::vector<MockConnectJob*> job_list_; + ScopedVector<MockConnectJob> job_list_; DISALLOW_COPY_AND_ASSIGN(MockTCPClientSocketPool); }; @@ -221,9 +223,9 @@ TEST_F(SOCKSClientSocketPoolTest, Async) { } TEST_F(SOCKSClientSocketPoolTest, TCPConnectError) { - SocketDataProvider* socket_data = new StaticSocketDataProvider(); + scoped_ptr<SocketDataProvider> socket_data(new StaticSocketDataProvider()); socket_data->set_connect_data(MockConnect(false, ERR_CONNECTION_REFUSED)); - tcp_client_socket_factory_.AddSocketDataProvider(socket_data); + tcp_client_socket_factory_.AddSocketDataProvider(socket_data.get()); ClientSocketHandle handle; int rv = handle.Init("a", ignored_socket_params_, LOW, NULL, pool_, NULL); @@ -233,9 +235,9 @@ TEST_F(SOCKSClientSocketPoolTest, TCPConnectError) { } TEST_F(SOCKSClientSocketPoolTest, AsyncTCPConnectError) { - SocketDataProvider* socket_data = new StaticSocketDataProvider(); + scoped_ptr<SocketDataProvider> socket_data(new StaticSocketDataProvider()); socket_data->set_connect_data(MockConnect(true, ERR_CONNECTION_REFUSED)); - tcp_client_socket_factory_.AddSocketDataProvider(socket_data); + tcp_client_socket_factory_.AddSocketDataProvider(socket_data.get()); TestCompletionCallback callback; ClientSocketHandle handle; @@ -254,11 +256,10 @@ TEST_F(SOCKSClientSocketPoolTest, SOCKSConnectError) { MockRead failed_read[] = { MockRead(false, 0), }; - SocketDataProvider* socket_data = - new StaticSocketDataProvider(failed_read, arraysize(failed_read), - NULL, 0); + scoped_ptr<SocketDataProvider> socket_data(new StaticSocketDataProvider( + failed_read, arraysize(failed_read), NULL, 0)); socket_data->set_connect_data(MockConnect(false, 0)); - tcp_client_socket_factory_.AddSocketDataProvider(socket_data); + tcp_client_socket_factory_.AddSocketDataProvider(socket_data.get()); ClientSocketHandle handle; EXPECT_EQ(0, tcp_socket_pool_->release_count()); @@ -273,11 +274,10 @@ TEST_F(SOCKSClientSocketPoolTest, AsyncSOCKSConnectError) { MockRead failed_read[] = { MockRead(true, 0), }; - SocketDataProvider* socket_data = - new StaticSocketDataProvider(failed_read, arraysize(failed_read), - NULL, 0); + scoped_ptr<SocketDataProvider> socket_data(new StaticSocketDataProvider( + failed_read, arraysize(failed_read), NULL, 0)); socket_data->set_connect_data(MockConnect(false, 0)); - tcp_client_socket_factory_.AddSocketDataProvider(socket_data); + tcp_client_socket_factory_.AddSocketDataProvider(socket_data.get()); TestCompletionCallback callback; ClientSocketHandle handle; |