summaryrefslogtreecommitdiffstats
path: root/net/socket/socket_test_util.h
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-18 16:01:06 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-18 16:01:06 +0000
commita512f598dca5030e9c02c497b36839cbdcd6e0cb (patch)
tree0d1e24b54244557c52fe1bc1eac534316f378e8c /net/socket/socket_test_util.h
parente4b553615a137a007b7c073d2ac2189fad00b6eb (diff)
downloadchromium_src-a512f598dca5030e9c02c497b36839cbdcd6e0cb.zip
chromium_src-a512f598dca5030e9c02c497b36839cbdcd6e0cb.tar.gz
chromium_src-a512f598dca5030e9c02c497b36839cbdcd6e0cb.tar.bz2
Change ClientSocketHandle to take the pool as a parameter to Init() rather than the constructor. The purpose of this change is to allow ClientSocketHandle to be able to accept ClientSocketPools of different types, since we will want to pass a TCPClientSocketPool or an SSLClientSocketPool or whatever to it.
BUG=http://crbug.com/13289 Review URL: http://codereview.chromium.org/171003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23629 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/socket_test_util.h')
-rw-r--r--net/socket/socket_test_util.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h
index a4973d8..8307d44 100644
--- a/net/socket/socket_test_util.h
+++ b/net/socket/socket_test_util.h
@@ -297,11 +297,9 @@ class MockSSLClientSocket : public MockClientSocket {
class TestSocketRequest : public CallbackRunner< Tuple1<int> > {
public:
TestSocketRequest(
- ClientSocketPool* pool,
std::vector<TestSocketRequest*>* request_order,
size_t* completion_count)
- : handle_(pool),
- request_order_(request_order),
+ : request_order_(request_order),
completion_count_(completion_count) {
DCHECK(request_order);
DCHECK(completion_count);
@@ -337,9 +335,21 @@ class ClientSocketPoolTest : public testing::Test {
virtual void SetUp();
virtual void TearDown();
- int StartRequestUsingPool(ClientSocketPool* socket_pool,
+ template <typename PoolType>
+ int StartRequestUsingPool(PoolType* socket_pool,
const std::string& group_name,
- int priority);
+ int priority) {
+ DCHECK(socket_pool);
+ TestSocketRequest* request = new TestSocketRequest(&request_order_,
+ &completion_count_);
+ requests_.push_back(request);
+ int rv = request->handle()->Init(
+ group_name, ignored_request_info_, priority, request,
+ socket_pool, NULL);
+ if (rv != ERR_IO_PENDING)
+ request_order_.push_back(request);
+ return rv;
+ }
// Provided there were n requests started, takes |index| in range 1..n
// and returns order in which that request completed, in range 1..n,