Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: chrome/browser/sync/profile_sync_service_bookmark_unittest.cc

Issue 1086733002: Ensure tests have an active task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <map> 9 #include <map>
10 #include <queue> 10 #include <queue>
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 }; 321 };
322 322
323 323
324 class ProfileSyncServiceBookmarkTest : public testing::Test { 324 class ProfileSyncServiceBookmarkTest : public testing::Test {
325 protected: 325 protected:
326 enum LoadOption { LOAD_FROM_STORAGE, DELETE_EXISTING_STORAGE }; 326 enum LoadOption { LOAD_FROM_STORAGE, DELETE_EXISTING_STORAGE };
327 enum SaveOption { SAVE_TO_STORAGE, DONT_SAVE_TO_STORAGE }; 327 enum SaveOption { SAVE_TO_STORAGE, DONT_SAVE_TO_STORAGE };
328 328
329 ProfileSyncServiceBookmarkTest() 329 ProfileSyncServiceBookmarkTest()
330 : model_(NULL), 330 : model_(NULL),
331 thread_bundle_(content::TestBrowserThreadBundle::DEFAULT),
332 local_merge_result_(syncer::BOOKMARKS), 331 local_merge_result_(syncer::BOOKMARKS),
333 syncer_merge_result_(syncer::BOOKMARKS) {} 332 syncer_merge_result_(syncer::BOOKMARKS) {}
334 333
335 virtual ~ProfileSyncServiceBookmarkTest() { 334 virtual ~ProfileSyncServiceBookmarkTest() {
336 StopSync(); 335 StopSync();
337 UnloadBookmarkModel(); 336 UnloadBookmarkModel();
338 } 337 }
339 338
340 virtual void SetUp() { 339 virtual void SetUp() {
341 test_user_share_.SetUp(); 340 test_user_share_.SetUp();
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 int64 other_bookmarks_id() { 745 int64 other_bookmarks_id() {
747 return 746 return
748 model_associator_->GetSyncIdFromChromeId(model_->other_node()->id()); 747 model_associator_->GetSyncIdFromChromeId(model_->other_node()->id());
749 } 748 }
750 749
751 int64 bookmark_bar_id() { 750 int64 bookmark_bar_id() {
752 return model_associator_->GetSyncIdFromChromeId( 751 return model_associator_->GetSyncIdFromChromeId(
753 model_->bookmark_bar_node()->id()); 752 model_->bookmark_bar_node()->id());
754 } 753 }
755 754
755 private:
756 content::TestBrowserThreadBundle thread_bundle_;
757
756 protected: 758 protected:
757 TestingProfile profile_; 759 TestingProfile profile_;
758 BookmarkModel* model_; 760 BookmarkModel* model_;
759 syncer::TestUserShare test_user_share_; 761 syncer::TestUserShare test_user_share_;
760 scoped_ptr<BookmarkChangeProcessor> change_processor_; 762 scoped_ptr<BookmarkChangeProcessor> change_processor_;
761 StrictMock<sync_driver::DataTypeErrorHandlerMock> mock_error_handler_; 763 StrictMock<sync_driver::DataTypeErrorHandlerMock> mock_error_handler_;
762 scoped_ptr<BookmarkModelAssociator> model_associator_; 764 scoped_ptr<BookmarkModelAssociator> model_associator_;
763 765
764 private: 766 private:
765 content::TestBrowserThreadBundle thread_bundle_;
766 syncer::SyncMergeResult local_merge_result_; 767 syncer::SyncMergeResult local_merge_result_;
767 syncer::SyncMergeResult syncer_merge_result_; 768 syncer::SyncMergeResult syncer_merge_result_;
768 }; 769 };
769 770
770 TEST_F(ProfileSyncServiceBookmarkTest, InitialState) { 771 TEST_F(ProfileSyncServiceBookmarkTest, InitialState) {
771 LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE); 772 LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
772 StartSync(); 773 StartSync();
773 774
774 EXPECT_TRUE(other_bookmarks_id()); 775 EXPECT_TRUE(other_bookmarks_id());
775 EXPECT_TRUE(bookmark_bar_id()); 776 EXPECT_TRUE(bookmark_bar_id());
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after
2430 ExpectModelMatch(); 2431 ExpectModelMatch();
2431 2432
2432 // Then simulate the add call arriving late. 2433 // Then simulate the add call arriving late.
2433 change_processor_->BookmarkNodeAdded(model_, model_->bookmark_bar_node(), 0); 2434 change_processor_->BookmarkNodeAdded(model_, model_->bookmark_bar_node(), 0);
2434 ExpectModelMatch(); 2435 ExpectModelMatch();
2435 } 2436 }
2436 2437
2437 } // namespace 2438 } // namespace
2438 2439
2439 } // namespace browser_sync 2440 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698