| Index: net/socket/client_socket_pool_base_unittest.cc
|
| ===================================================================
|
| --- net/socket/client_socket_pool_base_unittest.cc (revision 27159)
|
| +++ net/socket/client_socket_pool_base_unittest.cc (working copy)
|
| @@ -143,34 +143,31 @@
|
| return DoConnect(false /* error */, false /* sync */);
|
| case kMockPendingJob:
|
| set_load_state(LOAD_STATE_CONNECTING);
|
| - MessageLoop::current()->PostDelayedTask(
|
| + MessageLoop::current()->PostTask(
|
| FROM_HERE,
|
| method_factory_.NewRunnableMethod(
|
| - &TestConnectJob::DoConnect,
|
| - true /* successful */,
|
| - true /* async */),
|
| - 2);
|
| + &TestConnectJob::DoConnect,
|
| + true /* successful */,
|
| + true /* async */));
|
| return ERR_IO_PENDING;
|
| case kMockPendingFailingJob:
|
| set_load_state(LOAD_STATE_CONNECTING);
|
| - MessageLoop::current()->PostDelayedTask(
|
| + MessageLoop::current()->PostTask(
|
| FROM_HERE,
|
| method_factory_.NewRunnableMethod(
|
| - &TestConnectJob::DoConnect,
|
| - false /* error */,
|
| - true /* async */),
|
| - 2);
|
| + &TestConnectJob::DoConnect,
|
| + false /* error */,
|
| + true /* async */));
|
| return ERR_IO_PENDING;
|
| case kMockWaitingJob:
|
| client_socket_factory_->WaitForSignal(this);
|
| waiting_success_ = true;
|
| return ERR_IO_PENDING;
|
| case kMockAdvancingLoadStateJob:
|
| - MessageLoop::current()->PostDelayedTask(
|
| + MessageLoop::current()->PostTask(
|
| FROM_HERE,
|
| method_factory_.NewRunnableMethod(
|
| - &TestConnectJob::AdvanceLoadState, load_state_),
|
| - 2);
|
| + &TestConnectJob::AdvanceLoadState, load_state_));
|
| return ERR_IO_PENDING;
|
| default:
|
| NOTREACHED();
|
| @@ -720,8 +717,6 @@
|
| // Create one asynchronous request.
|
| connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob);
|
| EXPECT_EQ(ERR_IO_PENDING, StartRequest("d", kDefaultPriority));
|
| - PlatformThread::Sleep(10);
|
| - MessageLoop::current()->RunAllPending();
|
|
|
| // The next synchronous request should wait for its turn.
|
| connect_job_factory_->set_job_type(TestConnectJob::kMockJob);
|
| @@ -958,26 +953,14 @@
|
| test_connect_job_factory_->set_job_type(next_job_type_);
|
| handle_->Reset();
|
| within_callback_ = true;
|
| - TestCompletionCallback next_job_callback;
|
| int rv = InitHandle(
|
| - handle_, "a", kDefaultPriority, &next_job_callback, pool_.get(),
|
| - NULL);
|
| + handle_, "a", kDefaultPriority, this, pool_.get(), NULL);
|
| switch (next_job_type_) {
|
| case TestConnectJob::kMockJob:
|
| EXPECT_EQ(OK, rv);
|
| break;
|
| case TestConnectJob::kMockPendingJob:
|
| EXPECT_EQ(ERR_IO_PENDING, rv);
|
| -
|
| - // For pending jobs, wait for new socket to be created. This makes
|
| - // sure there are no more pending operations nor any unclosed sockets
|
| - // when the test finishes.
|
| - // We need to give it a little bit of time to run, so that all the
|
| - // operations that happen on timers (e.g. cleanup of idle
|
| - // connections) can execute.
|
| - MessageLoop::current()->SetNestableTasksAllowed(true);
|
| - PlatformThread::Sleep(10);
|
| - EXPECT_EQ(OK, next_job_callback.WaitForResult());
|
| break;
|
| default:
|
| FAIL() << "Unexpected job type: " << next_job_type_;
|
|
|