Index: 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 2678848cf8274d106848ca8d161a49d8cfd742e3..c9d80f1b48ff467217719507cd2b59d308e80799 100644 |
--- a/net/socket/tcp_client_socket_pool_unittest.cc |
+++ b/net/socket/tcp_client_socket_pool_unittest.cc |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -206,7 +206,7 @@ class MockClientSocketFactory : public ClientSocketFactory { |
class TCPClientSocketPoolTest : public ClientSocketPoolTest { |
protected: |
TCPClientSocketPoolTest() |
- : ignored_request_info_("ignored", 80), |
+ : ignored_socket_params_("ignored", 80, MEDIUM, GURL(), false), |
host_resolver_(new MockHostResolver), |
pool_(new TCPClientSocketPool(kMaxSockets, |
kMaxSocketsPerGroup, |
@@ -217,10 +217,10 @@ class TCPClientSocketPoolTest : public ClientSocketPoolTest { |
int StartRequest(const std::string& group_name, RequestPriority priority) { |
return StartRequestUsingPool( |
- pool_.get(), group_name, priority, ignored_request_info_); |
+ pool_.get(), group_name, priority, ignored_socket_params_); |
} |
- HostResolver::RequestInfo ignored_request_info_; |
+ TCPSocketParams ignored_socket_params_; |
scoped_refptr<MockHostResolver> host_resolver_; |
MockClientSocketFactory client_socket_factory_; |
MockNetworkChangeNotifier notifier_; |
@@ -230,8 +230,8 @@ class TCPClientSocketPoolTest : public ClientSocketPoolTest { |
TEST_F(TCPClientSocketPoolTest, Basic) { |
TestCompletionCallback callback; |
ClientSocketHandle handle; |
- HostResolver::RequestInfo info("www.google.com", 80); |
- int rv = handle.Init("a", info, LOW, &callback, pool_.get(), NULL); |
+ TCPSocketParams dest("www.google.com", 80, LOW, GURL(), false); |
+ int rv = handle.Init("a", dest, LOW, &callback, pool_.get(), NULL); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
EXPECT_FALSE(handle.is_initialized()); |
EXPECT_FALSE(handle.socket()); |
@@ -246,10 +246,11 @@ TEST_F(TCPClientSocketPoolTest, Basic) { |
TEST_F(TCPClientSocketPoolTest, InitHostResolutionFailure) { |
host_resolver_->rules()->AddSimulatedFailure("unresolvable.host.name"); |
TestSocketRequest req(&request_order_, &completion_count_); |
- HostResolver::RequestInfo info("unresolvable.host.name", 80); |
+ TCPSocketParams dest("unresolvable.host.name", 80, kDefaultPriority, GURL(), |
+ false); |
EXPECT_EQ(ERR_IO_PENDING, |
req.handle()->Init( |
- "a", info, kDefaultPriority, &req, pool_.get(), NULL)); |
+ "a", dest, kDefaultPriority, &req, pool_.get(), NULL)); |
EXPECT_EQ(ERR_NAME_NOT_RESOLVED, req.WaitForResult()); |
} |
@@ -257,17 +258,17 @@ TEST_F(TCPClientSocketPoolTest, InitConnectionFailure) { |
client_socket_factory_.set_client_socket_type( |
MockClientSocketFactory::MOCK_FAILING_CLIENT_SOCKET); |
TestSocketRequest req(&request_order_, &completion_count_); |
- HostResolver::RequestInfo info("a", 80); |
+ TCPSocketParams dest("a", 80, kDefaultPriority, GURL(), false); |
EXPECT_EQ(ERR_IO_PENDING, |
req.handle()->Init( |
- "a", info, kDefaultPriority, &req, pool_.get(), NULL)); |
+ "a", dest, kDefaultPriority, &req, pool_.get(), NULL)); |
EXPECT_EQ(ERR_CONNECTION_FAILED, req.WaitForResult()); |
// Make the host resolutions complete synchronously this time. |
host_resolver_->set_synchronous_mode(true); |
EXPECT_EQ(ERR_CONNECTION_FAILED, |
req.handle()->Init( |
- "a", info, kDefaultPriority, &req, pool_.get(), NULL)); |
+ "a", dest, kDefaultPriority, &req, pool_.get(), NULL)); |
} |
TEST_F(TCPClientSocketPoolTest, PendingRequests) { |
@@ -371,10 +372,10 @@ TEST_F(TCPClientSocketPoolTest, PendingRequests_NoKeepAlive) { |
// ClientSocketPool which will crash if the group was not cleared properly. |
TEST_F(TCPClientSocketPoolTest, CancelRequestClearGroup) { |
TestSocketRequest req(&request_order_, &completion_count_); |
- HostResolver::RequestInfo info("www.google.com", 80); |
+ TCPSocketParams dest("www.google.com", 80, kDefaultPriority, GURL(), false); |
EXPECT_EQ(ERR_IO_PENDING, |
req.handle()->Init( |
- "a", info, kDefaultPriority, &req, pool_.get(), NULL)); |
+ "a", dest, kDefaultPriority, &req, pool_.get(), NULL)); |
req.handle()->Reset(); |
// There is a race condition here. If the worker pool doesn't post the task |
@@ -390,13 +391,13 @@ TEST_F(TCPClientSocketPoolTest, TwoRequestsCancelOne) { |
TestSocketRequest req(&request_order_, &completion_count_); |
TestSocketRequest req2(&request_order_, &completion_count_); |
- HostResolver::RequestInfo info("www.google.com", 80); |
+ TCPSocketParams dest("www.google.com", 80, kDefaultPriority, GURL(), false); |
EXPECT_EQ(ERR_IO_PENDING, |
req.handle()->Init( |
- "a", info, kDefaultPriority, &req, pool_.get(), NULL)); |
+ "a", dest, kDefaultPriority, &req, pool_.get(), NULL)); |
EXPECT_EQ(ERR_IO_PENDING, |
req2.handle()->Init( |
- "a", info, kDefaultPriority, &req2, pool_.get(), NULL)); |
+ "a", dest, kDefaultPriority, &req2, pool_.get(), NULL)); |
req.handle()->Reset(); |
@@ -411,17 +412,17 @@ TEST_F(TCPClientSocketPoolTest, ConnectCancelConnect) { |
TestCompletionCallback callback; |
TestSocketRequest req(&request_order_, &completion_count_); |
- HostResolver::RequestInfo info("www.google.com", 80); |
+ TCPSocketParams dest("www.google.com", 80, kDefaultPriority, GURL(), false); |
EXPECT_EQ(ERR_IO_PENDING, |
handle.Init( |
- "a", info, kDefaultPriority, &callback, pool_.get(), NULL)); |
+ "a", dest, kDefaultPriority, &callback, pool_.get(), NULL)); |
handle.Reset(); |
TestCompletionCallback callback2; |
EXPECT_EQ(ERR_IO_PENDING, |
handle.Init( |
- "a", info, kDefaultPriority, &callback2, pool_.get(), NULL)); |
+ "a", dest, kDefaultPriority, &callback2, pool_.get(), NULL)); |
host_resolver_->set_synchronous_mode(true); |
// At this point, handle has two ConnectingSockets out for it. Due to the |
@@ -519,9 +520,8 @@ class RequestSocketCallback : public CallbackRunner< Tuple1<int> > { |
MessageLoop::current()->RunAllPending(); |
} |
within_callback_ = true; |
- int rv = handle_->Init( |
- "a", HostResolver::RequestInfo("www.google.com", 80), LOWEST, |
- this, pool_.get(), NULL); |
+ TCPSocketParams dest("www.google.com", 80, LOWEST, GURL(), false); |
+ int rv = handle_->Init("a", dest, LOWEST, this, pool_.get(), NULL); |
EXPECT_EQ(OK, rv); |
} |
} |
@@ -540,9 +540,8 @@ class RequestSocketCallback : public CallbackRunner< Tuple1<int> > { |
TEST_F(TCPClientSocketPoolTest, RequestTwice) { |
ClientSocketHandle handle; |
RequestSocketCallback callback(&handle, pool_.get()); |
- int rv = handle.Init( |
- "a", HostResolver::RequestInfo("www.google.com", 80), LOWEST, |
- &callback, pool_.get(), NULL); |
+ TCPSocketParams dest("www.google.com", 80, LOWEST, GURL(), false); |
+ int rv = handle.Init("a", dest, LOWEST, &callback, pool_.get(), NULL); |
ASSERT_EQ(ERR_IO_PENDING, rv); |
// The callback is going to request "www.google.com". We want it to complete |
@@ -604,8 +603,8 @@ TEST_F(TCPClientSocketPoolTest, FailingActiveRequestWithPendingRequests) { |
TEST_F(TCPClientSocketPoolTest, ResetIdleSocketsOnIPAddressChange) { |
TestCompletionCallback callback; |
ClientSocketHandle handle; |
- HostResolver::RequestInfo info("www.google.com", 80); |
- int rv = handle.Init("a", info, LOW, &callback, pool_.get(), NULL); |
+ TCPSocketParams dest("www.google.com", 80, LOW, GURL(), false); |
+ int rv = handle.Init("a", dest, LOW, &callback, pool_.get(), NULL); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
EXPECT_FALSE(handle.is_initialized()); |
EXPECT_FALSE(handle.socket()); |