Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: components/sync_driver/non_ui_data_type_controller_unittest.cc

Issue 2053913002: Remove MessageLoop::current()->RunUntilIdle() in components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/sync_driver/non_ui_data_type_controller.h" 5 #include "components/sync_driver/non_ui_data_type_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/run_loop.h"
16 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
17 #include "base/synchronization/waitable_event.h" 18 #include "base/synchronization/waitable_event.h"
18 #include "base/test/test_timeouts.h" 19 #include "base/test/test_timeouts.h"
19 #include "base/threading/thread.h" 20 #include "base/threading/thread.h"
20 #include "base/threading/thread_task_runner_handle.h" 21 #include "base/threading/thread_task_runner_handle.h"
21 #include "base/tracked_objects.h" 22 #include "base/tracked_objects.h"
22 #include "components/sync_driver/data_type_controller_mock.h" 23 #include "components/sync_driver/data_type_controller_mock.h"
23 #include "components/sync_driver/fake_sync_client.h" 24 #include "components/sync_driver/fake_sync_client.h"
24 #include "components/sync_driver/generic_change_processor_factory.h" 25 #include "components/sync_driver/generic_change_processor_factory.h"
25 #include "components/sync_driver/non_ui_data_type_controller_mock.h" 26 #include "components/sync_driver/non_ui_data_type_controller_mock.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 void WaitForDTC() { 205 void WaitForDTC() {
205 WaitableEvent done(base::WaitableEvent::ResetPolicy::MANUAL, 206 WaitableEvent done(base::WaitableEvent::ResetPolicy::MANUAL,
206 base::WaitableEvent::InitialState::NOT_SIGNALED); 207 base::WaitableEvent::InitialState::NOT_SIGNALED);
207 backend_thread_.task_runner()->PostTask( 208 backend_thread_.task_runner()->PostTask(
208 FROM_HERE, 209 FROM_HERE,
209 base::Bind(&SyncNonUIDataTypeControllerTest::SignalDone, &done)); 210 base::Bind(&SyncNonUIDataTypeControllerTest::SignalDone, &done));
210 done.TimedWait(TestTimeouts::action_timeout()); 211 done.TimedWait(TestTimeouts::action_timeout());
211 if (!done.IsSignaled()) { 212 if (!done.IsSignaled()) {
212 ADD_FAILURE() << "Timed out waiting for DB thread to finish."; 213 ADD_FAILURE() << "Timed out waiting for DB thread to finish.";
213 } 214 }
214 base::MessageLoop::current()->RunUntilIdle(); 215 base::RunLoop().RunUntilIdle();
215 } 216 }
216 217
217 SyncService* GetSyncService() override { 218 SyncService* GetSyncService() override {
218 // Make sure this isn't called on backend_thread. 219 // Make sure this isn't called on backend_thread.
219 EXPECT_FALSE(backend_thread_.task_runner()->BelongsToCurrentThread()); 220 EXPECT_FALSE(backend_thread_.task_runner()->BelongsToCurrentThread());
220 return FakeSyncClient::GetSyncService(); 221 return FakeSyncClient::GetSyncService();
221 } 222 }
222 223
223 protected: 224 protected:
224 void SetStartExpectations() { 225 void SetStartExpectations() {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 FROM_HERE, 503 FROM_HERE,
503 base::Bind( 504 base::Bind(
504 &NonUIDataTypeControllerFake::OnSingleDataTypeUnrecoverableError, 505 &NonUIDataTypeControllerFake::OnSingleDataTypeUnrecoverableError,
505 non_ui_dtc_.get(), error)); 506 non_ui_dtc_.get(), error));
506 WaitForDTC(); 507 WaitForDTC();
507 } 508 }
508 509
509 } // namespace 510 } // namespace
510 511
511 } // namespace sync_driver 512 } // namespace sync_driver
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698