OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/sync/glue/sync_backend_registrar.h" | 5 #include "chrome/browser/sync/glue/sync_backend_registrar.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "chrome/browser/sync/glue/ui_model_worker.h" | 8 #include "chrome/browser/sync/glue/ui_model_worker.h" |
9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
10 #include "components/sync_driver/change_processor_mock.h" | 10 #include "components/sync_driver/change_processor_mock.h" |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 registrar->SetInitialTypes(ModelTypeSet()); | 329 registrar->SetInitialTypes(ModelTypeSet()); |
330 | 330 |
331 // Start the shutdown. | 331 // Start the shutdown. |
332 registrar->RequestWorkerStopOnUIThread(); | 332 registrar->RequestWorkerStopOnUIThread(); |
333 | 333 |
334 sync_thread->message_loop()->PostTask( | 334 sync_thread->message_loop()->PostTask( |
335 FROM_HERE, | 335 FROM_HERE, |
336 base::Bind(&SyncBackendRegistrar::Shutdown, | 336 base::Bind(&SyncBackendRegistrar::Shutdown, |
337 base::Unretained(registrar.release()))); | 337 base::Unretained(registrar.release()))); |
338 | 338 |
| 339 // Make sure the thread starts running. |
| 340 sync_thread->WaitUntilThreadStarted(); |
| 341 |
339 // The test verifies that the sync thread doesn't block because | 342 // The test verifies that the sync thread doesn't block because |
340 // of the blocked DB thread and can finish the shutdown. | 343 // of the blocked DB thread and can finish the shutdown. |
341 sync_thread->message_loop()->RunUntilIdle(); | 344 sync_thread->message_loop()->RunUntilIdle(); |
342 | 345 |
343 db_thread_lock_.Release(); | 346 db_thread_lock_.Release(); |
344 | 347 |
345 // Run the main thread loop until all workers have been removed and the | 348 // Run the main thread loop until all workers have been removed and the |
346 // registrar destroyed. | 349 // registrar destroyed. |
347 run_loop_.Run(); | 350 run_loop_.Run(); |
348 } | 351 } |
349 | 352 |
350 } // namespace | 353 } // namespace |
351 | 354 |
352 } // namespace browser_sync | 355 } // namespace browser_sync |
OLD | NEW |