Skip to content

Commit

Permalink
sync: Update calls from RunAllPending() to RunUntilIdle().
Browse files Browse the repository at this point in the history
RunAllPending() is deprecated and we should switch to RunUntilIdle().

BUG=131220
TBR=akalin@chromium.org


Review URL: https://chromiumcodereview.appspot.com/11275305

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167651 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
tfarina@chromium.org committed Nov 14, 2012
1 parent 070ff3f commit 8cae971
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions sync/engine/sync_scheduler_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1125,12 +1125,12 @@ TEST_F(SyncSchedulerTest, StartWhenNotConnected) {
scheduler()->ScheduleNudgeAsync(
zero(), NUDGE_SOURCE_LOCAL, ModelTypeSet(BOOKMARKS), FROM_HERE);
// Should save the nudge for until after the server is reachable.
MessageLoop::current()->RunAllPending();
MessageLoop::current()->RunUntilIdle();

connection()->SetServerReachable();
connection()->UpdateConnectionStatus();
scheduler()->OnConnectionStatusChange();
MessageLoop::current()->RunAllPending();
MessageLoop::current()->RunUntilIdle();
}

TEST_F(SyncSchedulerTest, ServerConnectionChangeDuringBackoff) {
Expand Down Expand Up @@ -1158,7 +1158,7 @@ TEST_F(SyncSchedulerTest, ServerConnectionChangeDuringBackoff) {
connection()->SetServerReachable();
connection()->UpdateConnectionStatus();
scheduler()->OnConnectionStatusChange();
MessageLoop::current()->RunAllPending();
MessageLoop::current()->RunUntilIdle();
}

TEST_F(SyncSchedulerTest, ConnectionChangeCanaryPreemptedByNudge) {
Expand Down
2 changes: 1 addition & 1 deletion sync/internal_api/js_mutation_event_observer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class JsMutationEventObserverTest : public testing::Test {
JsMutationEventObserver js_mutation_event_observer_;

void PumpLoop() {
message_loop_.RunAllPending();
message_loop_.RunUntilIdle();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class JsSyncEncryptionHandlerObserverTest : public testing::Test {
JsSyncEncryptionHandlerObserver js_sync_encryption_handler_observer_;

void PumpLoop() {
message_loop_.RunAllPending();
message_loop_.RunUntilIdle();
}
};

Expand Down
2 changes: 1 addition & 1 deletion sync/internal_api/js_sync_manager_observer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class JsSyncManagerObserverTest : public testing::Test {
JsSyncManagerObserver js_sync_manager_observer_;

void PumpLoop() {
message_loop_.RunAllPending();
message_loop_.RunUntilIdle();
}
};

Expand Down
2 changes: 1 addition & 1 deletion sync/internal_api/public/util/weak_handle_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class WeakHandleTest : public ::testing::Test {
}

void PumpLoop() {
message_loop_.RunAllPending();
message_loop_.RunUntilIdle();
}

static void CallTestFromOtherThread(tracked_objects::Location from_here,
Expand Down
2 changes: 1 addition & 1 deletion sync/internal_api/sync_encryption_handler_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class SyncEncryptionHandlerImplTest : public ::testing::Test {
}

void PumpLoop() {
message_loop_.RunAllPending();
message_loop_.RunUntilIdle();
}

// Getters for tests.
Expand Down
2 changes: 1 addition & 1 deletion sync/internal_api/sync_manager_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ class SyncManagerTest : public testing::Test,
}

void PumpLoop() {
message_loop_.RunAllPending();
message_loop_.RunUntilIdle();
}

void SendJsMessage(const std::string& name, const JsArgList& args,
Expand Down
2 changes: 1 addition & 1 deletion sync/js/sync_js_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ using ::testing::StrictMock;
class SyncJsControllerTest : public testing::Test {
protected:
void PumpLoop() {
message_loop_.RunAllPending();
message_loop_.RunUntilIdle();
}

private:
Expand Down
4 changes: 2 additions & 2 deletions sync/notifier/invalidation_notifier_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ class InvalidationNotifierTestDelegate {
// another task, so they must be run in order to avoid leaking the inner
// task. Stopping does not schedule any tasks, so it's both necessary and
// sufficient to drain the task queue before stopping the notifier.
message_loop_.RunAllPending();
message_loop_.RunUntilIdle();
invalidator_.reset();
}

void WaitForInvalidator() {
message_loop_.RunAllPending();
message_loop_.RunUntilIdle();
}

void TriggerOnInvalidatorStateChange(InvalidatorState state) {
Expand Down
2 changes: 1 addition & 1 deletion sync/notifier/invalidator_factory_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class InvalidatorFactoryTest : public testing::Test {
}

virtual void TearDown() OVERRIDE {
message_loop_.RunAllPending();
message_loop_.RunUntilIdle();
EXPECT_EQ(0, fake_handler_.GetInvalidationCount());
}

Expand Down
2 changes: 1 addition & 1 deletion sync/notifier/non_blocking_invalidator_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class NonBlockingInvalidatorTestDelegate {
invalidator_.reset();
request_context_getter_ = NULL;
io_thread_.Stop();
message_loop_.RunAllPending();
message_loop_.RunUntilIdle();
}

void WaitForInvalidator() {
Expand Down
6 changes: 3 additions & 3 deletions sync/notifier/sync_invalidation_listener_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class SyncInvalidationListenerTest : public testing::Test {
EXPECT_TRUE(fake_invalidation_client_->IsAckedHandle(ack_handle));
// Pump message loop to trigger
// InvalidationStateTracker::SetMaxVersion().
message_loop_.RunAllPending();
message_loop_.RunUntilIdle();
}

// |payload| can be NULL, but not |type_name|.
Expand All @@ -272,7 +272,7 @@ class SyncInvalidationListenerTest : public testing::Test {
client_.WriteState(new_state);
// Pump message loop to trigger
// InvalidationStateTracker::WriteState().
message_loop_.RunAllPending();
message_loop_.RunUntilIdle();
}

void EnableNotifications() {
Expand Down Expand Up @@ -309,7 +309,7 @@ class SyncInvalidationListenerTest : public testing::Test {
// avoid leaking the inner task. client_.StopForTest() does not
// schedule any tasks, so it's both necessary and sufficient to
// drain the task queue before calling it.
message_loop_.RunAllPending();
message_loop_.RunUntilIdle();
fake_invalidation_client_ = NULL;
client_.StopForTest();
}
Expand Down
8 changes: 4 additions & 4 deletions sync/notifier/sync_system_resources_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ TEST_F(SyncSystemResourcesTest, ScheduleImmediately) {
EXPECT_CALL(mock_closure, Run());
sync_system_resources_.internal_scheduler()->Schedule(
invalidation::Scheduler::NoDelay(), mock_closure.CreateClosure());
message_loop_.RunAllPending();
message_loop_.RunUntilIdle();
}

TEST_F(SyncSystemResourcesTest, ScheduleOnListenerThread) {
Expand All @@ -144,7 +144,7 @@ TEST_F(SyncSystemResourcesTest, ScheduleOnListenerThread) {
invalidation::Scheduler::NoDelay(), mock_closure.CreateClosure());
EXPECT_TRUE(
sync_system_resources_.internal_scheduler()->IsRunningOnThread());
message_loop_.RunAllPending();
message_loop_.RunUntilIdle();
}

TEST_F(SyncSystemResourcesTest, ScheduleWithZeroDelay) {
Expand All @@ -153,7 +153,7 @@ TEST_F(SyncSystemResourcesTest, ScheduleWithZeroDelay) {
EXPECT_CALL(mock_closure, Run());
sync_system_resources_.internal_scheduler()->Schedule(
invalidation::TimeDelta::FromSeconds(0), mock_closure.CreateClosure());
message_loop_.RunAllPending();
message_loop_.RunUntilIdle();
}

// TODO(akalin): Figure out how to test with a non-zero delay.
Expand All @@ -169,7 +169,7 @@ TEST_F(SyncSystemResourcesTest, WriteState) {
.WillOnce(SaveArg<0>(&results));
sync_system_resources_.storage()->WriteKey(
"", "state", mock_storage_callback.CreateCallback());
message_loop_.RunAllPending();
message_loop_.RunUntilIdle();
EXPECT_EQ(invalidation::Status(invalidation::Status::SUCCESS, ""), results);
}

Expand Down

0 comments on commit 8cae971

Please sign in to comment.