| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_model_type_controller.h" | 5 #include "components/sync/driver/non_ui_model_type_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 } | 273 } |
| 274 | 274 |
| 275 // These threads can ping-pong for a bit so we run the model thread twice. | 275 // These threads can ping-pong for a bit so we run the model thread twice. |
| 276 void RunAllTasks() { | 276 void RunAllTasks() { |
| 277 RunQueuedModelThreadTasks(); | 277 RunQueuedModelThreadTasks(); |
| 278 RunQueuedUIThreadTasks(); | 278 RunQueuedUIThreadTasks(); |
| 279 RunQueuedModelThreadTasks(); | 279 RunQueuedModelThreadTasks(); |
| 280 } | 280 } |
| 281 | 281 |
| 282 // Runs any tasks posted on UI thread. | 282 // Runs any tasks posted on UI thread. |
| 283 void RunQueuedUIThreadTasks() { ui_loop_.RunUntilIdle(); } | 283 void RunQueuedUIThreadTasks() { base::RunLoop().RunUntilIdle(); } |
| 284 | 284 |
| 285 // Runs any tasks posted on model thread. | 285 // Runs any tasks posted on model thread. |
| 286 void RunQueuedModelThreadTasks() { | 286 void RunQueuedModelThreadTasks() { |
| 287 base::RunLoop run_loop; | 287 base::RunLoop run_loop; |
| 288 model_thread_runner_->PostTaskAndReply( | 288 model_thread_runner_->PostTaskAndReply( |
| 289 FROM_HERE, base::Bind(&base::DoNothing), | 289 FROM_HERE, base::Bind(&base::DoNothing), |
| 290 base::Bind(&base::RunLoop::Quit, base::Unretained(&run_loop))); | 290 base::Bind(&base::RunLoop::Quit, base::Unretained(&run_loop))); |
| 291 run_loop.Run(); | 291 run_loop.Run(); |
| 292 } | 292 } |
| 293 | 293 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 RegisterWithBackend(); | 366 RegisterWithBackend(); |
| 367 ExpectProcessorConnected(true); | 367 ExpectProcessorConnected(true); |
| 368 | 368 |
| 369 StartAssociating(); | 369 StartAssociating(); |
| 370 | 370 |
| 371 DeactivateDataTypeAndStop(); | 371 DeactivateDataTypeAndStop(); |
| 372 EXPECT_EQ(sync_driver::DataTypeController::NOT_RUNNING, controller_->state()); | 372 EXPECT_EQ(sync_driver::DataTypeController::NOT_RUNNING, controller_->state()); |
| 373 } | 373 } |
| 374 | 374 |
| 375 } // namespace sync_driver_v2 | 375 } // namespace sync_driver_v2 |
| OLD | NEW |