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 | |
342 // The test verifies that the sync thread doesn't block because | 339 // The test verifies that the sync thread doesn't block because |
343 // of the blocked DB thread and can finish the shutdown. | 340 // of the blocked DB thread and can finish the shutdown. |
344 sync_thread->message_loop()->RunUntilIdle(); | 341 sync_thread->message_loop()->RunUntilIdle(); |
345 | 342 |
346 db_thread_lock_.Release(); | 343 db_thread_lock_.Release(); |
347 | 344 |
348 // Run the main thread loop until all workers have been removed and the | 345 // Run the main thread loop until all workers have been removed and the |
349 // registrar destroyed. | 346 // registrar destroyed. |
350 run_loop_.Run(); | 347 run_loop_.Run(); |
351 } | 348 } |
352 | 349 |
353 } // namespace | 350 } // namespace |
354 | 351 |
355 } // namespace browser_sync | 352 } // namespace browser_sync |
OLD | NEW |