OLD | NEW |
---|---|
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <stack> | 5 #include <stack> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/message_loop.h" | |
11 #include "base/string_util.h" | 12 #include "base/string_util.h" |
12 #include "base/string16.h" | 13 #include "base/string16.h" |
13 #include "chrome/browser/bookmarks/bookmark_model.h" | 14 #include "chrome/browser/bookmarks/bookmark_model.h" |
14 #include "chrome/browser/chrome_thread.h" | 15 #include "chrome/browser/chrome_thread.h" |
15 #include "chrome/browser/profile.h" | 16 #include "chrome/browser/profile.h" |
16 #include "chrome/browser/sync/engine/syncapi.h" | 17 #include "chrome/browser/sync/engine/syncapi.h" |
17 #include "chrome/browser/sync/glue/model_associator.h" | 18 #include "chrome/browser/sync/glue/model_associator.h" |
18 #include "chrome/browser/sync/glue/sync_backend_host.h" | 19 #include "chrome/browser/sync/glue/sync_backend_host.h" |
19 #include "chrome/browser/sync/profile_sync_service.h" | 20 #include "chrome/browser/sync/profile_sync_service.h" |
20 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
272 : ui_thread_(ChromeThread::UI, &message_loop_), | 273 : ui_thread_(ChromeThread::UI, &message_loop_), |
273 file_thread_(ChromeThread::FILE, &message_loop_), | 274 file_thread_(ChromeThread::FILE, &message_loop_), |
274 model_(NULL) { | 275 model_(NULL) { |
275 profile_.reset(new TestingProfile()); | 276 profile_.reset(new TestingProfile()); |
276 profile_->set_has_history_service(true); | 277 profile_->set_has_history_service(true); |
277 } | 278 } |
278 virtual ~ProfileSyncServiceTest() { | 279 virtual ~ProfileSyncServiceTest() { |
279 // Kill the service before the profile. | 280 // Kill the service before the profile. |
280 service_.reset(); | 281 service_.reset(); |
281 profile_.reset(); | 282 profile_.reset(); |
283 | |
284 // Ensure that the sync objects destruct to avoid memory leaks. | |
285 MessageLoop::current()->RunAllPending(); | |
tim (not reviewing)
2009/11/03 00:12:11
I'm just a little confused if this works, because
jam
2009/11/03 00:16:13
That's not the task in question. That task alread
| |
282 } | 286 } |
283 | 287 |
284 ModelAssociator* associator() { | 288 ModelAssociator* associator() { |
285 DCHECK(service_.get()); | 289 DCHECK(service_.get()); |
286 return service_->model_associator_; | 290 return service_->model_associator_; |
287 } | 291 } |
288 | 292 |
289 ChangeProcessingInterface* change_processor() { | 293 ChangeProcessingInterface* change_processor() { |
290 DCHECK(service_.get()); | 294 DCHECK(service_.get()); |
291 return service_->change_processor_.get(); | 295 return service_->change_processor_.get(); |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1299 | 1303 |
1300 // Restart the sync service. | 1304 // Restart the sync service. |
1301 StartSyncService(); | 1305 StartSyncService(); |
1302 | 1306 |
1303 // Make sure we're back in sync. In real life, the user would need | 1307 // Make sure we're back in sync. In real life, the user would need |
1304 // to reauthenticate before this happens, but in the test, authentication | 1308 // to reauthenticate before this happens, but in the test, authentication |
1305 // is sidestepped. | 1309 // is sidestepped. |
1306 ExpectBookmarkModelMatchesTestData(); | 1310 ExpectBookmarkModelMatchesTestData(); |
1307 ExpectModelMatch(); | 1311 ExpectModelMatch(); |
1308 } | 1312 } |
OLD | NEW |