Index: net/socket/client_socket_pool_base_unittest.cc |
=================================================================== |
--- net/socket/client_socket_pool_base_unittest.cc (revision 23124) |
+++ net/socket/client_socket_pool_base_unittest.cc (working copy) |
@@ -248,13 +248,14 @@ |
max_sockets, max_sockets_per_group, connect_job_factory)) {} |
virtual int RequestSocket( |
+ LoadLog* load_log, |
const std::string& group_name, |
const HostResolver::RequestInfo& resolve_info, |
int priority, |
ClientSocketHandle* handle, |
CompletionCallback* callback) { |
return base_->RequestSocket( |
- group_name, resolve_info, priority, handle, callback); |
+ NULL, group_name, resolve_info, priority, handle, callback); |
} |
virtual void CancelRequest( |
@@ -384,7 +385,7 @@ |
request.handle = &ignored; |
scoped_ptr<TestConnectJob> job( |
new TestConnectJob(TestConnectJob::kMockJob, |
- "a", |
+ "a", |
request, |
base::TimeDelta::FromMicroseconds(1), |
&delegate, |
@@ -400,7 +401,7 @@ |
// Deleted by TestConnectJobDelegate. |
TestConnectJob* job = |
new TestConnectJob(TestConnectJob::kMockPendingJob, |
- "a", |
+ "a", |
request, |
base::TimeDelta::FromMicroseconds(1), |
&delegate, |
@@ -415,8 +416,8 @@ |
TestCompletionCallback callback; |
ClientSocketHandle handle(pool_.get()); |
- EXPECT_EQ(OK, handle.Init("a", ignored_request_info_, kDefaultPriority, |
- &callback)); |
+ EXPECT_EQ(OK, handle.Init(NULL, "a", ignored_request_info_, |
+ kDefaultPriority, &callback)); |
EXPECT_TRUE(handle.is_initialized()); |
EXPECT_TRUE(handle.socket()); |
handle.Reset(); |
@@ -427,7 +428,7 @@ |
connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); |
TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); |
- int rv = req.handle()->Init("a", ignored_request_info_, 0, &req); |
+ int rv = req.handle()->Init(NULL, "a", ignored_request_info_, 0, &req); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
EXPECT_EQ(LOAD_STATE_CONNECTING, pool_->GetLoadState("a", req.handle())); |
EXPECT_EQ(OK, req.WaitForResult()); |
@@ -442,7 +443,7 @@ |
connect_job_factory_->set_job_type(TestConnectJob::kMockFailingJob); |
TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); |
EXPECT_EQ(ERR_CONNECTION_FAILED, |
- req.handle()->Init("a", ignored_request_info_, |
+ req.handle()->Init(NULL, "a", ignored_request_info_, |
kDefaultPriority, &req)); |
} |
@@ -452,8 +453,8 @@ |
connect_job_factory_->set_job_type(TestConnectJob::kMockPendingFailingJob); |
TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); |
EXPECT_EQ(ERR_IO_PENDING, |
- req.handle()->Init("a", ignored_request_info_, kDefaultPriority, |
- &req)); |
+ req.handle()->Init(NULL, "a", ignored_request_info_, |
+ kDefaultPriority, &req)); |
EXPECT_EQ(LOAD_STATE_CONNECTING, pool_->GetLoadState("a", req.handle())); |
EXPECT_EQ(ERR_CONNECTION_FAILED, req.WaitForResult()); |
} |
@@ -744,7 +745,7 @@ |
connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); |
TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); |
EXPECT_EQ(ERR_IO_PENDING, |
- req.handle()->Init("a", ignored_request_info_, |
+ req.handle()->Init(NULL, "a", ignored_request_info_, |
kDefaultPriority, &req)); |
req.handle()->Reset(); |
} |
@@ -757,10 +758,10 @@ |
TestSocketRequest req2(pool_.get(), &request_order_, &completion_count_); |
EXPECT_EQ(ERR_IO_PENDING, |
- req.handle()->Init("a", ignored_request_info_, |
+ req.handle()->Init(NULL, "a", ignored_request_info_, |
kDefaultPriority, &req)); |
EXPECT_EQ(ERR_IO_PENDING, |
- req2.handle()->Init("a", ignored_request_info_, |
+ req2.handle()->Init(NULL, "a", ignored_request_info_, |
kDefaultPriority, &req2)); |
req.handle()->Reset(); |
@@ -778,14 +779,14 @@ |
TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); |
EXPECT_EQ(ERR_IO_PENDING, |
- handle.Init("a", ignored_request_info_, |
+ handle.Init(NULL, "a", ignored_request_info_, |
kDefaultPriority, &callback)); |
handle.Reset(); |
TestCompletionCallback callback2; |
EXPECT_EQ(ERR_IO_PENDING, |
- handle.Init("a", ignored_request_info_, |
+ handle.Init(NULL, "a", ignored_request_info_, |
kDefaultPriority, &callback2)); |
EXPECT_EQ(OK, callback2.WaitForResult()); |
@@ -848,7 +849,7 @@ |
handle_->Reset(); |
within_callback_ = true; |
int rv = handle_->Init( |
- "a", HostResolver::RequestInfo("www.google.com", 80), |
+ NULL, "a", HostResolver::RequestInfo("www.google.com", 80), |
kDefaultPriority, this); |
switch (next_job_type_) { |
case TestConnectJob::kMockJob: |
@@ -884,7 +885,7 @@ |
RequestSocketCallback callback( |
&handle, connect_job_factory_, TestConnectJob::kMockPendingJob); |
int rv = handle.Init( |
- "a", ignored_request_info_, kDefaultPriority, &callback); |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &callback); |
ASSERT_EQ(ERR_IO_PENDING, rv); |
EXPECT_EQ(OK, callback.WaitForResult()); |
@@ -899,7 +900,7 @@ |
RequestSocketCallback callback( |
&handle, connect_job_factory_, TestConnectJob::kMockJob); |
int rv = handle.Init( |
- "a", ignored_request_info_, kDefaultPriority, &callback); |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &callback); |
ASSERT_EQ(ERR_IO_PENDING, rv); |
EXPECT_EQ(OK, callback.WaitForResult()); |
@@ -962,13 +963,14 @@ |
TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); |
int rv = req.handle()->Init( |
- "a", ignored_request_info_, kDefaultPriority, &req); |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &req); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
// Cancel the active request. |
req.handle()->Reset(); |
- rv = req.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req); |
+ rv = req.handle()->Init( |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &req); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
EXPECT_EQ(OK, req.WaitForResult()); |
@@ -988,13 +990,14 @@ |
// Start job 1 (async error). |
TestSocketRequest req1(pool_.get(), &request_order_, &completion_count_); |
- int rv = req1.handle()->Init("a", ignored_request_info_, |
+ int rv = req1.handle()->Init(NULL, "a", ignored_request_info_, |
kDefaultPriority, &req1); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
// Start job 2 (async error). |
TestSocketRequest req2(pool_.get(), &request_order_, &completion_count_); |
- rv = req2.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req2); |
+ rv = req2.handle()->Init( |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &req2); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
// The pending job is sync. |
@@ -1002,7 +1005,8 @@ |
// Request 3 does not have a ConnectJob yet. It's just pending. |
TestSocketRequest req3(pool_.get(), &request_order_, &completion_count_); |
- rv = req3.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req3); |
+ rv = req3.handle()->Init( |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &req3); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
EXPECT_EQ(ERR_CONNECTION_FAILED, req1.WaitForResult()); |
@@ -1029,8 +1033,8 @@ |
connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); |
TestSocketRequest req1(pool_.get(), &request_order_, &completion_count_); |
- int rv = req1.handle()->Init("a", ignored_request_info_, kDefaultPriority, |
- &req1); |
+ int rv = req1.handle()->Init(NULL, "a", ignored_request_info_, |
+ kDefaultPriority, &req1); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
EXPECT_EQ(OK, req1.WaitForResult()); |
@@ -1038,7 +1042,8 @@ |
connect_job_factory_->set_job_type(TestConnectJob::kMockWaitingJob); |
TestSocketRequest req2(pool_.get(), &request_order_, &completion_count_); |
- rv = req2.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req2); |
+ rv = req2.handle()->Init( |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &req2); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
req1.handle()->Reset(); |
MessageLoop::current()->RunAllPending(); // Run the DoReleaseSocket() |
@@ -1047,7 +1052,8 @@ |
// will use the idle socket). |
TestSocketRequest req3(pool_.get(), &request_order_, &completion_count_); |
- rv = req3.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req3); |
+ rv = req3.handle()->Init( |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &req3); |
EXPECT_EQ(OK, rv); |
EXPECT_FALSE(req2.handle()->socket()); |
@@ -1113,7 +1119,7 @@ |
request.handle = &ignored; |
scoped_ptr<TestConnectJob> job( |
new TestConnectJob(TestConnectJob::kMockJob, |
- "a", |
+ "a", |
request, |
base::TimeDelta::FromMicroseconds(1), |
&delegate, |
@@ -1129,7 +1135,7 @@ |
// Deleted by TestConnectJobDelegate. |
TestConnectJob* job = |
new TestConnectJob(TestConnectJob::kMockPendingJob, |
- "a", |
+ "a", |
request, |
base::TimeDelta::FromMicroseconds(1), |
&delegate, |
@@ -1144,7 +1150,7 @@ |
TestCompletionCallback callback; |
ClientSocketHandle handle(pool_.get()); |
- EXPECT_EQ(OK, handle.Init("a", ignored_request_info_, kDefaultPriority, |
+ EXPECT_EQ(OK, handle.Init(NULL, "a", ignored_request_info_, kDefaultPriority, |
&callback)); |
EXPECT_TRUE(handle.is_initialized()); |
EXPECT_TRUE(handle.socket()); |
@@ -1156,7 +1162,7 @@ |
connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); |
TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); |
- int rv = req.handle()->Init("a", ignored_request_info_, 0, &req); |
+ int rv = req.handle()->Init(NULL, "a", ignored_request_info_, 0, &req); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
EXPECT_EQ(LOAD_STATE_CONNECTING, pool_->GetLoadState("a", req.handle())); |
EXPECT_EQ(OK, req.WaitForResult()); |
@@ -1171,7 +1177,7 @@ |
connect_job_factory_->set_job_type(TestConnectJob::kMockFailingJob); |
TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); |
EXPECT_EQ(ERR_CONNECTION_FAILED, |
- req.handle()->Init("a", ignored_request_info_, |
+ req.handle()->Init(NULL, "a", ignored_request_info_, |
kDefaultPriority, &req)); |
} |
@@ -1182,8 +1188,8 @@ |
connect_job_factory_->set_job_type(TestConnectJob::kMockPendingFailingJob); |
TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); |
EXPECT_EQ(ERR_IO_PENDING, |
- req.handle()->Init("a", ignored_request_info_, kDefaultPriority, |
- &req)); |
+ req.handle()->Init(NULL, "a", ignored_request_info_, |
+ kDefaultPriority, &req)); |
EXPECT_EQ(LOAD_STATE_CONNECTING, pool_->GetLoadState("a", req.handle())); |
EXPECT_EQ(ERR_CONNECTION_FAILED, req.WaitForResult()); |
} |
@@ -1247,7 +1253,7 @@ |
connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); |
TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); |
EXPECT_EQ(ERR_IO_PENDING, |
- req.handle()->Init("a", ignored_request_info_, |
+ req.handle()->Init(NULL, "a", ignored_request_info_, |
kDefaultPriority, &req)); |
req.handle()->Reset(); |
} |
@@ -1260,10 +1266,10 @@ |
TestSocketRequest req2(pool_.get(), &request_order_, &completion_count_); |
EXPECT_EQ(ERR_IO_PENDING, |
- req.handle()->Init("a", ignored_request_info_, |
+ req.handle()->Init(NULL, "a", ignored_request_info_, |
kDefaultPriority, &req)); |
EXPECT_EQ(ERR_IO_PENDING, |
- req2.handle()->Init("a", ignored_request_info_, |
+ req2.handle()->Init(NULL, "a", ignored_request_info_, |
kDefaultPriority, &req2)); |
req.handle()->Reset(); |
@@ -1281,14 +1287,14 @@ |
TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); |
EXPECT_EQ(ERR_IO_PENDING, |
- handle.Init("a", ignored_request_info_, |
+ handle.Init(NULL, "a", ignored_request_info_, |
kDefaultPriority, &callback)); |
handle.Reset(); |
TestCompletionCallback callback2; |
EXPECT_EQ(ERR_IO_PENDING, |
- handle.Init("a", ignored_request_info_, |
+ handle.Init(NULL, "a", ignored_request_info_, |
kDefaultPriority, &callback2)); |
EXPECT_EQ(OK, callback2.WaitForResult()); |
@@ -1362,7 +1368,7 @@ |
RequestSocketCallback callback( |
&handle, connect_job_factory_, TestConnectJob::kMockPendingJob); |
int rv = handle.Init( |
- "a", ignored_request_info_, kDefaultPriority, &callback); |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &callback); |
ASSERT_EQ(ERR_IO_PENDING, rv); |
EXPECT_EQ(OK, callback.WaitForResult()); |
@@ -1377,7 +1383,7 @@ |
RequestSocketCallback callback( |
&handle, connect_job_factory_, TestConnectJob::kMockJob); |
int rv = handle.Init( |
- "a", ignored_request_info_, kDefaultPriority, &callback); |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &callback); |
ASSERT_EQ(ERR_IO_PENDING, rv); |
EXPECT_EQ(OK, callback.WaitForResult()); |
@@ -1443,13 +1449,14 @@ |
TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); |
int rv = req.handle()->Init( |
- "a", ignored_request_info_, kDefaultPriority, &req); |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &req); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
// Cancel the active request. |
req.handle()->Reset(); |
- rv = req.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req); |
+ rv = req.handle()->Init( |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &req); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
EXPECT_EQ(OK, req.WaitForResult()); |
@@ -1467,8 +1474,8 @@ |
connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); |
TestSocketRequest req1(pool_.get(), &request_order_, &completion_count_); |
- int rv = req1.handle()->Init("a", ignored_request_info_, kDefaultPriority, |
- &req1); |
+ int rv = req1.handle()->Init(NULL, "a", ignored_request_info_, |
+ kDefaultPriority, &req1); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
EXPECT_EQ(OK, req1.WaitForResult()); |
@@ -1477,10 +1484,12 @@ |
connect_job_factory_->set_job_type(TestConnectJob::kMockWaitingJob); |
TestSocketRequest req2(pool_.get(), &request_order_, &completion_count_); |
- rv = req2.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req2); |
+ rv = req2.handle()->Init( |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &req2); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
TestSocketRequest req3(pool_.get(), &request_order_, &completion_count_); |
- rv = req3.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req3); |
+ rv = req3.handle()->Init( |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &req3); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
// Both Requests 2 and 3 are pending. We release socket 1 which should |
@@ -1511,18 +1520,21 @@ |
connect_job_factory_->set_job_type(TestConnectJob::kMockPendingFailingJob); |
TestSocketRequest req1(pool_.get(), &request_order_, &completion_count_); |
- int rv = req1.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req1); |
+ int rv = req1.handle()->Init( |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &req1); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
TestSocketRequest req2(pool_.get(), &request_order_, &completion_count_); |
- rv = req2.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req2); |
+ rv = req2.handle()->Init( |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &req2); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
// The pending job is sync. |
connect_job_factory_->set_job_type(TestConnectJob::kMockJob); |
TestSocketRequest req3(pool_.get(), &request_order_, &completion_count_); |
- rv = req3.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req3); |
+ rv = req3.handle()->Init( |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &req3); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
EXPECT_EQ(ERR_CONNECTION_FAILED, req1.WaitForResult()); |
@@ -1541,15 +1553,16 @@ |
TestConnectJob::kMockAdvancingLoadStateJob); |
TestSocketRequest req1(pool_.get(), &request_order_, &completion_count_); |
- int rv = req1.handle()->Init("a", ignored_request_info_, kDefaultPriority, |
- &req1); |
+ int rv = req1.handle()->Init( |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &req1); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
EXPECT_EQ(LOAD_STATE_IDLE, req1.handle()->GetLoadState()); |
MessageLoop::current()->RunAllPending(); |
TestSocketRequest req2(pool_.get(), &request_order_, &completion_count_); |
- rv = req2.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req2); |
+ rv = req2.handle()->Init( |
+ NULL, "a", ignored_request_info_, kDefaultPriority, &req2); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
EXPECT_EQ(LOAD_STATE_WAITING_FOR_CACHE, req1.handle()->GetLoadState()); |
EXPECT_EQ(LOAD_STATE_WAITING_FOR_CACHE, req2.handle()->GetLoadState()); |