| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/glue/sync_backend_registrar.h" | 5 #include "components/sync_driver/glue/sync_backend_registrar.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "components/sync_driver/change_processor_mock.h" | 10 #include "components/sync_driver/change_processor_mock.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 sync_thread_ = registrar_->sync_thread(); | 113 sync_thread_ = registrar_->sync_thread(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void TearDown() override { | 116 void TearDown() override { |
| 117 registrar_->RequestWorkerStopOnUIThread(); | 117 registrar_->RequestWorkerStopOnUIThread(); |
| 118 test_user_share_.TearDown(); | 118 test_user_share_.TearDown(); |
| 119 sync_thread_->task_runner()->PostTask( | 119 sync_thread_->task_runner()->PostTask( |
| 120 FROM_HERE, base::Bind(&SyncBackendRegistrar::Shutdown, | 120 FROM_HERE, base::Bind(&SyncBackendRegistrar::Shutdown, |
| 121 base::Unretained(registrar_.release()))); | 121 base::Unretained(registrar_.release()))); |
| 122 sync_thread_->WaitUntilThreadStarted(); | 122 sync_thread_->WaitUntilThreadStarted(); |
| 123 sync_thread_->message_loop()->RunUntilIdle(); | 123 base::RunLoop().RunUntilIdle(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void ExpectRoutingInfo( | 126 void ExpectRoutingInfo( |
| 127 SyncBackendRegistrar* registrar, | 127 SyncBackendRegistrar* registrar, |
| 128 const syncer::ModelSafeRoutingInfo& expected_routing_info) { | 128 const syncer::ModelSafeRoutingInfo& expected_routing_info) { |
| 129 syncer::ModelSafeRoutingInfo routing_info; | 129 syncer::ModelSafeRoutingInfo routing_info; |
| 130 registrar->GetModelSafeRoutingInfo(&routing_info); | 130 registrar->GetModelSafeRoutingInfo(&routing_info); |
| 131 EXPECT_EQ(expected_routing_info, routing_info); | 131 EXPECT_EQ(expected_routing_info, routing_info); |
| 132 } | 132 } |
| 133 | 133 |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 | 448 |
| 449 sync_thread->task_runner()->PostTask( | 449 sync_thread->task_runner()->PostTask( |
| 450 FROM_HERE, base::Bind(&SyncBackendRegistrar::Shutdown, | 450 FROM_HERE, base::Bind(&SyncBackendRegistrar::Shutdown, |
| 451 base::Unretained(registrar.release()))); | 451 base::Unretained(registrar.release()))); |
| 452 | 452 |
| 453 // Make sure the thread starts running. | 453 // Make sure the thread starts running. |
| 454 sync_thread->WaitUntilThreadStarted(); | 454 sync_thread->WaitUntilThreadStarted(); |
| 455 | 455 |
| 456 // The test verifies that the sync thread doesn't block because | 456 // The test verifies that the sync thread doesn't block because |
| 457 // of the blocked DB thread and can finish the shutdown. | 457 // of the blocked DB thread and can finish the shutdown. |
| 458 sync_thread->message_loop()->RunUntilIdle(); | 458 base::RunLoop().RunUntilIdle(); |
| 459 | 459 |
| 460 db_thread_lock_.Release(); | 460 db_thread_lock_.Release(); |
| 461 | 461 |
| 462 // Run the main thread loop until all workers have been removed and the | 462 // Run the main thread loop until all workers have been removed and the |
| 463 // registrar destroyed. | 463 // registrar destroyed. |
| 464 run_loop_.Run(); | 464 run_loop_.Run(); |
| 465 } | 465 } |
| 466 | 466 |
| 467 } // namespace | 467 } // namespace |
| 468 | 468 |
| 469 } // namespace browser_sync | 469 } // namespace browser_sync |
| OLD | NEW |