From c933965b0974d3bd8b090b12766520c0878502a0 Mon Sep 17 00:00:00 2001 From: "kristianm@google.com" Date: Mon, 14 Mar 2011 19:02:43 +0000 Subject: Revert 78034 - Removing a TODO and cleaning up code. This is done in preparation of a patch to let some request ignore the max sockets and max sockets to group limits. BUG=none TEST=none Review URL: http://codereview.chromium.org/6679001 TBR=kristianm@google.com Review URL: http://codereview.chromium.org/6685057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78061 0039d316-1c4b-4281-b951-d872f2087c98 --- net/http/http_network_transaction_unittest.cc | 4 ++-- net/socket/tcp_client_socket_pool.cc | 8 ++++++++ net/socket/tcp_client_socket_pool.h | 4 ++++ net/socket/tcp_client_socket_pool_unittest.cc | 3 +-- net/spdy/spdy_http_stream_unittest.cc | 3 ++- net/spdy/spdy_session_unittest.cc | 8 ++++---- 6 files changed, 21 insertions(+), 9 deletions(-) (limited to 'net') diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 78dbe55..b238f57 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -7075,7 +7075,7 @@ TEST_F(HttpNetworkTransactionTest, scoped_refptr spdy_session = session->spdy_session_pool()->Get(pair, BoundNetLog()); scoped_refptr tcp_params( - new TCPSocketParams(host_port_pair, MEDIUM, GURL(), false)); + new TCPSocketParams("www.google.com", 443, MEDIUM, GURL(), false)); scoped_ptr connection(new ClientSocketHandle); EXPECT_EQ(ERR_IO_PENDING, @@ -8324,7 +8324,7 @@ TEST_F(HttpNetworkTransactionTest, PreconnectWithExistingSpdySession) { scoped_refptr spdy_session = session->spdy_session_pool()->Get(pair, BoundNetLog()); scoped_refptr tcp_params( - new TCPSocketParams(host_port_pair, MEDIUM, GURL(), false)); + new TCPSocketParams("www.google.com", 443, MEDIUM, GURL(), false)); TestCompletionCallback callback; scoped_ptr connection(new ClientSocketHandle); diff --git a/net/socket/tcp_client_socket_pool.cc b/net/socket/tcp_client_socket_pool.cc index 716c798..4d71e2d 100644 --- a/net/socket/tcp_client_socket_pool.cc +++ b/net/socket/tcp_client_socket_pool.cc @@ -28,6 +28,14 @@ TCPSocketParams::TCPSocketParams(const HostPortPair& host_port_pair, Initialize(priority, referrer, disable_resolver_cache); } +// TODO(willchan): Update all unittests so we don't need this. +TCPSocketParams::TCPSocketParams(const std::string& host, int port, + RequestPriority priority, const GURL& referrer, + bool disable_resolver_cache) + : destination_(HostPortPair(host, port)) { + Initialize(priority, referrer, disable_resolver_cache); +} + TCPSocketParams::~TCPSocketParams() {} void TCPSocketParams::Initialize(RequestPriority priority, diff --git a/net/socket/tcp_client_socket_pool.h b/net/socket/tcp_client_socket_pool.h index 245262e..4c19509 100644 --- a/net/socket/tcp_client_socket_pool.h +++ b/net/socket/tcp_client_socket_pool.h @@ -28,6 +28,10 @@ class TCPSocketParams : public base::RefCounted { TCPSocketParams(const HostPortPair& host_port_pair, RequestPriority priority, const GURL& referrer, bool disable_resolver_cache); + // TODO(willchan): Update all unittests so we don't need this. + TCPSocketParams(const std::string& host, int port, RequestPriority priority, + const GURL& referrer, bool disable_resolver_cache); + const HostResolver::RequestInfo& destination() const { return destination_; } private: diff --git a/net/socket/tcp_client_socket_pool_unittest.cc b/net/socket/tcp_client_socket_pool_unittest.cc index a8d496f..307bd12 100644 --- a/net/socket/tcp_client_socket_pool_unittest.cc +++ b/net/socket/tcp_client_socket_pool_unittest.cc @@ -353,9 +353,8 @@ TEST_F(TCPClientSocketPoolTest, InitHostResolutionFailure) { host_resolver_->rules()->AddSimulatedFailure("unresolvable.host.name"); TestCompletionCallback callback; ClientSocketHandle handle; - HostPortPair host_port_pair("unresolvable.host.name", 80); scoped_refptr dest(new TCPSocketParams( - host_port_pair, kDefaultPriority, GURL(), false)); + "unresolvable.host.name", 80, kDefaultPriority, GURL(), false)); EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", dest, kDefaultPriority, &callback, &pool_, BoundNetLog())); diff --git a/net/spdy/spdy_http_stream_unittest.cc b/net/spdy/spdy_http_stream_unittest.cc index 730c5cc..bee345a 100644 --- a/net/spdy/spdy_http_stream_unittest.cc +++ b/net/spdy/spdy_http_stream_unittest.cc @@ -30,7 +30,8 @@ class SpdyHttpStreamTest : public testing::Test { session_deps_.socket_factory->AddSocketDataProvider(data_.get()); http_session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_); session_ = http_session_->spdy_session_pool()->Get(pair, BoundNetLog()); - tcp_params_ = new TCPSocketParams(host_port_pair, + tcp_params_ = new TCPSocketParams(host_port_pair.host(), + host_port_pair.port(), MEDIUM, GURL(), false); TestCompletionCallback callback; scoped_ptr connection(new ClientSocketHandle); diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc index ee59f8b..0f3b601 100644 --- a/net/spdy/spdy_session_unittest.cc +++ b/net/spdy/spdy_session_unittest.cc @@ -92,7 +92,7 @@ TEST_F(SpdySessionTest, GoAway) { EXPECT_TRUE(spdy_session_pool->HasSession(pair)); scoped_refptr tcp_params( - new TCPSocketParams(test_host_port_pair, MEDIUM, GURL(), false)); + new TCPSocketParams(kTestHost, kTestPort, MEDIUM, GURL(), false)); scoped_ptr connection(new ClientSocketHandle); EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(), tcp_params, MEDIUM, @@ -199,7 +199,7 @@ TEST_F(SpdySessionTest, OnSettings) { ASSERT_TRUE(spdy_session_pool->HasSession(pair)); scoped_refptr tcp_params( - new TCPSocketParams(test_host_port_pair, MEDIUM, GURL(), false)); + new TCPSocketParams(kTestHost, kTestPort, MEDIUM, GURL(), false)); scoped_ptr connection(new ClientSocketHandle); EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(), tcp_params, MEDIUM, @@ -280,7 +280,7 @@ TEST_F(SpdySessionTest, CancelPendingCreateStream) { ASSERT_TRUE(spdy_session_pool->HasSession(pair)); scoped_refptr tcp_params( - new TCPSocketParams(test_host_port_pair, MEDIUM, GURL(), false)); + new TCPSocketParams(kTestHost, kTestPort, MEDIUM, GURL(), false)); scoped_ptr connection(new ClientSocketHandle); EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(), tcp_params, MEDIUM, @@ -375,7 +375,7 @@ TEST_F(SpdySessionTest, SendSettingsOnNewSession) { EXPECT_TRUE(spdy_session_pool->HasSession(pair)); scoped_refptr tcp_params( - new TCPSocketParams(test_host_port_pair, MEDIUM, GURL(), false)); + new TCPSocketParams(kTestHost, kTestPort, MEDIUM, GURL(), false)); scoped_ptr connection(new ClientSocketHandle); EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(), tcp_params, MEDIUM, -- cgit v1.1