Make sure the socket is deleted when ConnectJob times out.
It's benign since ClientSocketPoolBase has a scoped_ptr that will delete it anyway, but it hits a DCHECK since ConnectJob::ReleaseSocket() should return NULL when the ConnectJob encountered an error.
Update TestConnectJobDelegate to call ConnectJob::ReleaseSocket() and EXPECT on its value.
Replicate the ConnectJob tests for the late binding case (doesn't add any extra coverage since we're not executing ClientSocketPoolBase code, just ConnectJob, but this way I don't accidentally delete necessary tests when I delete all the old tests after switching over completely to late binding).
BUG=none
TEST=net_unittests
Review URL: http://codereview.chromium.org/160664
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22580 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc
index 00b9753..ec32383 100644
--- a/net/socket/client_socket_pool_base.cc
+++ b/net/socket/client_socket_pool_base.cc
@@ -55,6 +55,8 @@
}
void ConnectJob::OnTimeout() {
+ // Make sure the socket is NULL before calling into |delegate|.
+ set_socket(NULL);
// The delegate will delete |this|.
Delegate *delegate = delegate_;
delegate_ = NULL;