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 // TODO(akalin): This file is basically just a unit test for | 5 // TODO(akalin): This file is basically just a unit test for |
6 // BookmarkChangeProcessor. Write unit tests for | 6 // BookmarkChangeProcessor. Write unit tests for |
7 // BookmarkModelAssociator separately. | 7 // BookmarkModelAssociator separately. |
8 | 8 |
9 #include <stack> | 9 #include <stack> |
10 #include <vector> | 10 #include <vector> |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 model_->ClearStore(); | 357 model_->ClearStore(); |
358 message_loop_.RunAllPending(); | 358 message_loop_.RunAllPending(); |
359 } | 359 } |
360 | 360 |
361 void StartSync() { | 361 void StartSync() { |
362 // Set up model associator. | 362 // Set up model associator. |
363 model_associator_.reset(new TestBookmarkModelAssociator( | 363 model_associator_.reset(new TestBookmarkModelAssociator( |
364 profile_.GetBookmarkModel(), | 364 profile_.GetBookmarkModel(), |
365 test_user_share_.user_share(), | 365 test_user_share_.user_share(), |
366 &mock_error_handler_)); | 366 &mock_error_handler_)); |
367 SyncError error = model_associator_->AssociateModels(); | 367 csync::SyncError error = model_associator_->AssociateModels(); |
368 EXPECT_FALSE(error.IsSet()); | 368 EXPECT_FALSE(error.IsSet()); |
369 MessageLoop::current()->RunAllPending(); | 369 MessageLoop::current()->RunAllPending(); |
370 | 370 |
371 // Set up change processor. | 371 // Set up change processor. |
372 change_processor_.reset( | 372 change_processor_.reset( |
373 new BookmarkChangeProcessor(model_associator_.get(), | 373 new BookmarkChangeProcessor(model_associator_.get(), |
374 &mock_error_handler_)); | 374 &mock_error_handler_)); |
375 change_processor_->Start(&profile_, test_user_share_.user_share()); | 375 change_processor_->Start(&profile_, test_user_share_.user_share()); |
376 } | 376 } |
377 | 377 |
378 void StopSync() { | 378 void StopSync() { |
379 change_processor_->Stop(); | 379 change_processor_->Stop(); |
380 change_processor_.reset(); | 380 change_processor_.reset(); |
381 SyncError error = model_associator_->DisassociateModels(); | 381 csync::SyncError error = model_associator_->DisassociateModels(); |
382 EXPECT_FALSE(error.IsSet()); | 382 EXPECT_FALSE(error.IsSet()); |
383 model_associator_.reset(); | 383 model_associator_.reset(); |
384 | 384 |
385 message_loop_.RunAllPending(); | 385 message_loop_.RunAllPending(); |
386 | 386 |
387 // TODO(akalin): Actually close the database and flush it to disk | 387 // TODO(akalin): Actually close the database and flush it to disk |
388 // (and make StartSync reload from disk). This would require | 388 // (and make StartSync reload from disk). This would require |
389 // refactoring TestUserShare. | 389 // refactoring TestUserShare. |
390 } | 390 } |
391 | 391 |
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 EXPECT_EQ(1, observer.get_started()); | 1490 EXPECT_EQ(1, observer.get_started()); |
1491 EXPECT_EQ(0, observer.get_completed_count_at_started()); | 1491 EXPECT_EQ(0, observer.get_completed_count_at_started()); |
1492 EXPECT_EQ(1, observer.get_completed()); | 1492 EXPECT_EQ(1, observer.get_completed()); |
1493 | 1493 |
1494 model_->RemoveObserver(&observer); | 1494 model_->RemoveObserver(&observer); |
1495 } | 1495 } |
1496 | 1496 |
1497 } // namespace | 1497 } // namespace |
1498 | 1498 |
1499 } // namespace browser_sync | 1499 } // namespace browser_sync |
OLD | NEW |