diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-14 18:36:51 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-14 18:36:51 +0000 |
commit | b4c62ebe8a5bce337c64f9776c225cafc6a51a16 (patch) | |
tree | 5fff0a30ab02ba08b8b9ff2dd2a675d36353c181 /net/socket | |
parent | 90bb38d8b23ab609bd95b209b28df1eff5940cd5 (diff) | |
download | chromium_src-b4c62ebe8a5bce337c64f9776c225cafc6a51a16.zip chromium_src-b4c62ebe8a5bce337c64f9776c225cafc6a51a16.tar.gz chromium_src-b4c62ebe8a5bce337c64f9776c225cafc6a51a16.tar.bz2 |
net: Update calls from RunAllPending() to RunUntilIdle().
RunAllPending() is deprecated and we should switch to RunUntilIdle().
BUG=131220
TBR=willchan@chromium.org
Review URL: https://chromiumcodereview.appspot.com/11361263
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167705 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket')
-rw-r--r-- | net/socket/buffered_write_stream_socket_unittest.cc | 4 | ||||
-rw-r--r-- | net/socket/client_socket_pool_base_unittest.cc | 44 | ||||
-rw-r--r-- | net/socket/deterministic_socket_data_unittest.cc | 2 | ||||
-rw-r--r-- | net/socket/socket_test_util.cc | 6 | ||||
-rw-r--r-- | net/socket/socks_client_socket_pool_unittest.cc | 4 | ||||
-rw-r--r-- | net/socket/transport_client_socket_pool_unittest.cc | 22 |
6 files changed, 41 insertions, 41 deletions
diff --git a/net/socket/buffered_write_stream_socket_unittest.cc b/net/socket/buffered_write_stream_socket_unittest.cc index 664422e..8a1942a 100644 --- a/net/socket/buffered_write_stream_socket_unittest.cc +++ b/net/socket/buffered_write_stream_socket_unittest.cc @@ -19,7 +19,7 @@ namespace { class BufferedWriteStreamSocketTest : public testing::Test { public: void Finish() { - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(data_->at_read_eof()); EXPECT_TRUE(data_->at_write_eof()); } @@ -86,7 +86,7 @@ TEST_F(BufferedWriteStreamSocketTest, WriteWhileBlocked) { }; Initialize(writes, arraysize(writes)); TestWrite("abc"); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); TestWrite("def"); data_->RunFor(1); TestWrite("ghi"); diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc index 363010a..dbbeb5d 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc @@ -1040,7 +1040,7 @@ TEST_F(ClientSocketPoolBaseTest, TotalLimitCountsConnectingSockets) { // to flush all tasks, we need to wait so that we know there are no // soon-to-be-pending tasks waiting. base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(10)); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // The next synchronous request should wait for its turn. connect_job_factory_->set_job_type(TestConnectJob::kMockJob); @@ -1275,7 +1275,7 @@ TEST_F(ClientSocketPoolBaseTest, CloseIdleSocketAtSocketLimitDeleteGroup) { } // Flush all the DoReleaseSocket tasks. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Stall a group. Set a pending job so it'll trigger a backup job if we don't // reuse a socket. @@ -1470,10 +1470,10 @@ class RequestSocketCallback : public TestCompletionCallbackBase { handle_->Reset(); { // TODO: Resolve conflicting intentions of stopping recursion with the - // |!within_callback_| test (above) and the call to |RunAllPending()| + // |!within_callback_| test (above) and the call to |RunUntilIdle()| // below. http://crbug.com/114130. MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); } within_callback_ = true; TestCompletionCallback next_job_callback; @@ -1670,7 +1670,7 @@ TEST_F(ClientSocketPoolBaseTest, GroupWithPendingRequestsIsNotEmpty) { EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); pool_->CloseIdleSockets(); - MessageLoop::current()->RunAllPending(); // Run the released socket wakeups + MessageLoop::current()->RunUntilIdle(); // Run the released socket wakeups } TEST_F(ClientSocketPoolBaseTest, BasicAsynchronous) { @@ -1850,7 +1850,7 @@ TEST_F(ClientSocketPoolBaseTest, ReleaseSockets) { // Both Requests 2 and 3 are pending. We release socket 1 which should // service request 2. Request 3 should still be waiting. req1.handle()->Reset(); - MessageLoop::current()->RunAllPending(); // Run the released socket wakeups + MessageLoop::current()->RunUntilIdle(); // Run the released socket wakeups ASSERT_TRUE(req2.handle()->socket()); EXPECT_EQ(OK, req2.WaitForResult()); EXPECT_FALSE(req3.handle()->socket()); @@ -1932,7 +1932,7 @@ TEST_F(ClientSocketPoolBaseTest, LoadState) { EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(LOAD_STATE_IDLE, handle.GetLoadState()); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); ClientSocketHandle handle2; TestCompletionCallback callback2; @@ -2123,7 +2123,7 @@ TEST_F(ClientSocketPoolBaseTest, DisableCleanupTimerNoReuse) { // to flush all tasks, we need to wait so that we know there are no // soon-to-be-pending tasks waiting. base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(10)); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Both sockets should now be idle. ASSERT_EQ(2, pool_->IdleSocketCount()); @@ -2201,7 +2201,7 @@ TEST_F(ClientSocketPoolBaseTest, CleanupTimedOutIdleSockets) { // to flush all tasks, we need to wait so that we know there are no // soon-to-be-pending tasks waiting. base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(10)); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); ASSERT_EQ(2, pool_->IdleSocketCount()); @@ -2353,7 +2353,7 @@ TEST_F(ClientSocketPoolBaseTest, SocketLimitReleasingSockets) { handle_a[0].Reset(); // Used to get stuck here. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); handle_b[1].socket()->Disconnect(); handle_b[1].Reset(); @@ -2510,7 +2510,7 @@ TEST_F(ClientSocketPoolBaseTest, DoNotReuseSocketAfterFlush) { pool_->Flush(); handle.Reset(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", params_, @@ -2621,7 +2621,7 @@ TEST_F(ClientSocketPoolBaseTest, BackupSocketCancelAtMaxSockets) { BoundNetLog())); } - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Cancel the pending request. handle.Reset(); @@ -2630,7 +2630,7 @@ TEST_F(ClientSocketPoolBaseTest, BackupSocketCancelAtMaxSockets) { base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds( ClientSocketPool::kMaxConnectRetryIntervalMs / 2 * 3)); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kDefaultMaxSockets, client_socket_factory_.allocation_count()); } @@ -2659,7 +2659,7 @@ TEST_F(ClientSocketPoolBaseTest, CancelBackupSocketAfterCancelingAllRequests) { // Wait for the backup timer to fire (add some slop to ensure it fires) base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds( ClientSocketPool::kMaxConnectRetryIntervalMs / 2 * 3)); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); ASSERT_TRUE(pool_->HasGroup("bar")); EXPECT_EQ(1, pool_->NumConnectJobsInGroup("bar")); } @@ -2698,7 +2698,7 @@ TEST_F(ClientSocketPoolBaseTest, CancelBackupSocketAfterFinishingAllRequests) { // Wait for the backup timer to fire (add some slop to ensure it fires) base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds( ClientSocketPool::kMaxConnectRetryIntervalMs / 2 * 3)); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); } // Test delayed socket binding for the case where we have two connects, @@ -2742,7 +2742,7 @@ TEST_F(ClientSocketPoolBaseTest, DelayedSocketBindingWaitingForConnect) { // binding. handle1.Reset(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Still no idle sockets, still one pending connect job. EXPECT_EQ(0, pool_->IdleSocketCount()); @@ -2758,7 +2758,7 @@ TEST_F(ClientSocketPoolBaseTest, DelayedSocketBindingWaitingForConnect) { client_socket_factory_.SignalJobs(); EXPECT_EQ(0, pool_->NumConnectJobsInGroup("a")); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); } // Test delayed socket binding when a group is at capacity and one @@ -2800,7 +2800,7 @@ TEST_F(ClientSocketPoolBaseTest, DelayedSocketBindingAtGroupCapacity) { // binding. handle1.Reset(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Still no idle sockets, still one pending connect job. EXPECT_EQ(0, pool_->IdleSocketCount()); @@ -2816,7 +2816,7 @@ TEST_F(ClientSocketPoolBaseTest, DelayedSocketBindingAtGroupCapacity) { client_socket_factory_.SignalJobs(); EXPECT_EQ(0, pool_->NumConnectJobsInGroup("a")); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); } // Test out the case where we have one socket connected, one @@ -2860,7 +2860,7 @@ TEST_F(ClientSocketPoolBaseTest, DelayedSocketBindingAtStall) { // binding. handle1.Reset(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Still no idle sockets, still one pending connect job. EXPECT_EQ(0, pool_->IdleSocketCount()); @@ -2876,7 +2876,7 @@ TEST_F(ClientSocketPoolBaseTest, DelayedSocketBindingAtStall) { client_socket_factory_.SignalJobs(); EXPECT_EQ(0, pool_->NumConnectJobsInGroup("a")); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); } // Cover the case where on an available socket slot, we have one pending @@ -3501,7 +3501,7 @@ TEST_F(ClientSocketPoolBaseTest, PreconnectWithBackupJob) { EXPECT_EQ(1, pool_->NumConnectJobsInGroup("a")); EXPECT_EQ(1, pool_->NumUnassignedConnectJobsInGroup("a")); EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Make the backup job be a pending job, so it completes normally. connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); diff --git a/net/socket/deterministic_socket_data_unittest.cc b/net/socket/deterministic_socket_data_unittest.cc index e1f42f4..055fbdc 100644 --- a/net/socket/deterministic_socket_data_unittest.cc +++ b/net/socket/deterministic_socket_data_unittest.cc @@ -80,7 +80,7 @@ DeterministicSocketDataTest::DeterministicSocketDataTest() void DeterministicSocketDataTest::TearDown() { // Empty the current queue. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); PlatformTest::TearDown(); } diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc index 41ccd08..407c543 100644 --- a/net/socket/socket_test_util.cc +++ b/net/socket/socket_test_util.cc @@ -466,7 +466,7 @@ void DeterministicSocketData::Run() { // since they can change in either. while ((!at_write_eof() || !at_read_eof()) && !stopped()) { if (counter % 2 == 0) - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); if (counter % 2 == 1) { InvokeCallbacks(); } @@ -477,7 +477,7 @@ void DeterministicSocketData::Run() { while (socket_ && (socket_->write_pending() || socket_->read_pending()) && !stopped()) { InvokeCallbacks(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); } SetStopped(false); } @@ -1483,7 +1483,7 @@ bool ClientSocketPoolTest::ReleaseOneConnection(KeepAlive keep_alive) { if (keep_alive == NO_KEEP_ALIVE) (*i)->handle()->socket()->Disconnect(); (*i)->handle()->Reset(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); return true; } } diff --git a/net/socket/socks_client_socket_pool_unittest.cc b/net/socket/socks_client_socket_pool_unittest.cc index 9912854..a8d0a9f 100644 --- a/net/socket/socks_client_socket_pool_unittest.cc +++ b/net/socket/socks_client_socket_pool_unittest.cc @@ -222,7 +222,7 @@ TEST_F(SOCKSClientSocketPoolTest, CancelDuringTransportConnect) { EXPECT_EQ(0, transport_socket_pool_.cancel_count()); // Now wait for the TCP sockets to connect. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(ClientSocketPoolTest::kRequestNotFound, GetOrderOfRequest(1)); EXPECT_EQ(ClientSocketPoolTest::kRequestNotFound, GetOrderOfRequest(2)); @@ -258,7 +258,7 @@ TEST_F(SOCKSClientSocketPoolTest, CancelDuringSOCKSConnect) { EXPECT_EQ(0, transport_socket_pool_.release_count()); // Now wait for the async data to reach the SOCKS connect jobs. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(ClientSocketPoolTest::kRequestNotFound, GetOrderOfRequest(1)); EXPECT_EQ(ClientSocketPoolTest::kRequestNotFound, GetOrderOfRequest(2)); diff --git a/net/socket/transport_client_socket_pool_unittest.cc b/net/socket/transport_client_socket_pool_unittest.cc index d7ff4e6..12a9a7d 100644 --- a/net/socket/transport_client_socket_pool_unittest.cc +++ b/net/socket/transport_client_socket_pool_unittest.cc @@ -813,7 +813,7 @@ class RequestSocketCallback : public TestCompletionCallbackBase { handle_->Reset(); { MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); } within_callback_ = true; scoped_refptr<TransportSocketParams> dest(new TransportSocketParams( @@ -915,14 +915,14 @@ TEST_F(TransportClientSocketPoolTest, ResetIdleSocketsOnIPAddressChange) { handle.Reset(); // Need to run all pending to release the socket back to the pool. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Now we should have 1 idle socket. EXPECT_EQ(1, pool_.IdleSocketCount()); // After an IP address change, we should have 0 idle sockets. NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunAllPending(); // Notification happens async. + MessageLoop::current()->RunUntilIdle(); // Notification happens async. EXPECT_EQ(0, pool_.IdleSocketCount()); } @@ -965,14 +965,14 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketConnect) { EXPECT_FALSE(handle.socket()); // Create the first socket, set the timer. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Wait for the backup socket timer to fire. base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds( ClientSocketPool::kMaxConnectRetryIntervalMs + 50)); // Let the appropriate socket connect. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(OK, callback.WaitForResult()); EXPECT_TRUE(handle.is_initialized()); @@ -1007,7 +1007,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketCancel) { EXPECT_FALSE(handle.socket()); // Create the first socket, set the timer. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); if (index == CANCEL_AFTER_WAIT) { // Wait for the backup socket timer to fire. @@ -1016,7 +1016,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketCancel) { } // Let the appropriate socket connect. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); handle.Reset(); @@ -1053,7 +1053,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketFailAfterStall) { EXPECT_FALSE(handle.socket()); // Create the first socket, set the timer. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Wait for the backup socket timer to fire. base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds( @@ -1064,7 +1064,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketFailAfterStall) { host_resolver_->set_synchronous_mode(true); // Let the appropriate socket connect. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(ERR_CONNECTION_FAILED, callback.WaitForResult()); EXPECT_FALSE(handle.is_initialized()); @@ -1101,7 +1101,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketFailAfterDelay) { EXPECT_FALSE(handle.socket()); // Create the first socket, set the timer. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Wait for the backup socket timer to fire. base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds( @@ -1112,7 +1112,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketFailAfterDelay) { host_resolver_->set_synchronous_mode(true); // Let the appropriate socket connect. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(ERR_CONNECTION_FAILED, callback.WaitForResult()); EXPECT_FALSE(handle.is_initialized()); |