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_host.h" | 5 #include "chrome/browser/sync/glue/sync_backend_host.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 if (backend_.get()) { | 166 if (backend_.get()) { |
167 backend_->StopSyncingForShutdown(); | 167 backend_->StopSyncingForShutdown(); |
168 backend_->Shutdown(false); | 168 backend_->Shutdown(false); |
169 } | 169 } |
170 backend_.reset(); | 170 backend_.reset(); |
171 sync_prefs_.reset(); | 171 sync_prefs_.reset(); |
172 invalidator_storage_.reset(); | 172 invalidator_storage_.reset(); |
173 profile_.reset(); | 173 profile_.reset(); |
174 // Pump messages posted by the sync thread (which may end up | 174 // Pump messages posted by the sync thread (which may end up |
175 // posting on the IO thread). | 175 // posting on the IO thread). |
176 ui_loop_.RunAllPending(); | 176 ui_loop_.RunUntilIdle(); |
177 io_thread_.Stop(); | 177 io_thread_.Stop(); |
178 // Pump any messages posted by the IO thread. | 178 // Pump any messages posted by the IO thread. |
179 ui_loop_.RunAllPending(); | 179 ui_loop_.RunUntilIdle(); |
180 } | 180 } |
181 | 181 |
182 // Synchronously initializes the backend. | 182 // Synchronously initializes the backend. |
183 void InitializeBackend() { | 183 void InitializeBackend() { |
184 EXPECT_CALL(mock_frontend_, OnBackendInitialized(_, _, true)). | 184 EXPECT_CALL(mock_frontend_, OnBackendInitialized(_, _, true)). |
185 WillOnce(InvokeWithoutArgs(QuitMessageLoop)); | 185 WillOnce(InvokeWithoutArgs(QuitMessageLoop)); |
186 backend_->Initialize(&mock_frontend_, | 186 backend_->Initialize(&mock_frontend_, |
187 syncer::WeakHandle<syncer::JsEventHandler>(), | 187 syncer::WeakHandle<syncer::JsEventHandler>(), |
188 GURL(""), | 188 GURL(""), |
189 credentials_, | 189 credentials_, |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 backend_->Shutdown(false); | 629 backend_->Shutdown(false); |
630 backend_.reset(); | 630 backend_.reset(); |
631 | 631 |
632 TearDown(); | 632 TearDown(); |
633 SetUp(); | 633 SetUp(); |
634 } | 634 } |
635 | 635 |
636 } // namespace | 636 } // namespace |
637 | 637 |
638 } // namespace browser_sync | 638 } // namespace browser_sync |
OLD | NEW |