diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-15 22:04:32 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-15 22:04:32 +0000 |
commit | b59ff376c5d5b950774fcbe65727611d51832b75 (patch) | |
tree | a37598ddd4e9ec0530d5820bcce1f47bafa89289 /net/socket/client_socket_pool_base_unittest.cc | |
parent | 89d70652ad0bb9e7f419c17516fad279d8a4db32 (diff) | |
download | chromium_src-b59ff376c5d5b950774fcbe65727611d51832b75.zip chromium_src-b59ff376c5d5b950774fcbe65727611d51832b75.tar.gz chromium_src-b59ff376c5d5b950774fcbe65727611d51832b75.tar.bz2 |
Refactorings surrounding HostResolver:
(1) Extract HostResolver to an interface.
The existing concrete implementation is now named HostResolverImpl. This makes it possible to create mocks with more complex behavior (i.e. choose via rules if response will be sync vs async).
(2) Transform HostMapper into HostResolverProc.
Conceptually HostResolverProc maps a hostname to a socket address, whereas HostMapper mapped a hostname to another hostname (so you were still at the mercy of the system's host resolver). With HostResolverProc you can specify the exact AddressList, making it possible to run tests requiring IPv6 socketaddrs on systems (like WinXP) that don't actually support it.
(3) Add a MockHostResolver implementation of HostResolver.
This replaces the [ScopedHostMapper + RuleBasedHostMapper + HostResolver] combo. It is less clunky and a bit more expressive.
BUG=http://crbug.com/16452
R=willchan
TEST=existing
Review URL: http://codereview.chromium.org/149511
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20795 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/client_socket_pool_base_unittest.cc')
-rw-r--r-- | net/socket/client_socket_pool_base_unittest.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc index 8874686..e4faf5b 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc @@ -7,7 +7,6 @@ #include "base/compiler_specific.h" #include "base/message_loop.h" #include "base/scoped_vector.h" -#include "net/base/host_resolver_unittest.h" #include "net/base/net_errors.h" #include "net/base/test_completion_callback.h" #include "net/socket/client_socket.h" @@ -793,7 +792,7 @@ TEST_F(ClientSocketPoolBaseTest, ReleaseSockets) { ClientSocketPoolBase::EnableLateBindingOfSockets(false); // Start job 1 (async OK) - connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); + connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); TestSocketRequest req1(pool_.get(), &request_order_); int rv = req1.handle.Init("a", ignored_request_info_, 5, &req1); @@ -1135,7 +1134,7 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, ReleaseSockets) { CreatePool(kDefaultMaxSocketsPerGroup); // Start job 1 (async OK) - connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); + connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); TestSocketRequest req1(pool_.get(), &request_order_); int rv = req1.handle.Init("a", ignored_request_info_, 5, &req1); @@ -1178,7 +1177,7 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, ReleaseSockets) { TEST_F(ClientSocketPoolBaseTest_LateBinding, PendingJobCompletionOrder) { CreatePool(kDefaultMaxSocketsPerGroup); // First two jobs are async. - connect_job_factory_->set_job_type(TestConnectJob::kMockPendingFailingJob); + connect_job_factory_->set_job_type(TestConnectJob::kMockPendingFailingJob); TestSocketRequest req1(pool_.get(), &request_order_); int rv = req1.handle.Init("a", ignored_request_info_, 5, &req1); @@ -1189,7 +1188,7 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, PendingJobCompletionOrder) { EXPECT_EQ(ERR_IO_PENDING, rv); // The pending job is sync. - connect_job_factory_->set_job_type(TestConnectJob::kMockJob); + connect_job_factory_->set_job_type(TestConnectJob::kMockJob); TestSocketRequest req3(pool_.get(), &request_order_); rv = req3.handle.Init("a", ignored_request_info_, 5, &req3); @@ -1208,7 +1207,7 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, PendingJobCompletionOrder) { TEST_F(ClientSocketPoolBaseTest_LateBinding, LoadState) { CreatePool(kDefaultMaxSocketsPerGroup); connect_job_factory_->set_job_type( - TestConnectJob::kMockAdvancingLoadStateJob); + TestConnectJob::kMockAdvancingLoadStateJob); TestSocketRequest req1(pool_.get(), &request_order_); int rv = req1.handle.Init("a", ignored_request_info_, 5, &req1); |