| 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 <map> | 9 #include <map> |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 const BookmarkNode::MetaInfoMap& meta_info_map) { | 222 const BookmarkNode::MetaInfoMap& meta_info_map) { |
| 223 syncer::WriteNode node(trans_); | 223 syncer::WriteNode node(trans_); |
| 224 ASSERT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(id)); | 224 ASSERT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(id)); |
| 225 sync_pb::BookmarkSpecifics specifics = node.GetBookmarkSpecifics(); | 225 sync_pb::BookmarkSpecifics specifics = node.GetBookmarkSpecifics(); |
| 226 SetNodeMetaInfo(meta_info_map, &specifics); | 226 SetNodeMetaInfo(meta_info_map, &specifics); |
| 227 node.SetBookmarkSpecifics(specifics); | 227 node.SetBookmarkSpecifics(specifics); |
| 228 SetModified(id); | 228 SetModified(id); |
| 229 } | 229 } |
| 230 | 230 |
| 231 // Pass the fake change list to |service|. | 231 // Pass the fake change list to |service|. |
| 232 void ApplyPendingChanges(ChangeProcessor* processor) { | 232 void ApplyPendingChanges(sync_driver::ChangeProcessor* processor) { |
| 233 processor->ApplyChangesFromSyncModel( | 233 processor->ApplyChangesFromSyncModel( |
| 234 trans_, 0, syncer::ImmutableChangeRecordList(&changes_)); | 234 trans_, 0, syncer::ImmutableChangeRecordList(&changes_)); |
| 235 } | 235 } |
| 236 | 236 |
| 237 const syncer::ChangeRecordList& changes() { | 237 const syncer::ChangeRecordList& changes() { |
| 238 return changes_; | 238 return changes_; |
| 239 } | 239 } |
| 240 | 240 |
| 241 private: | 241 private: |
| 242 // Helper function to push an ACTION_UPDATE record onto the back | 242 // Helper function to push an ACTION_UPDATE record onto the back |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 int64 bookmark_bar_id() { | 741 int64 bookmark_bar_id() { |
| 742 return model_associator_->GetSyncIdFromChromeId( | 742 return model_associator_->GetSyncIdFromChromeId( |
| 743 model_->bookmark_bar_node()->id()); | 743 model_->bookmark_bar_node()->id()); |
| 744 } | 744 } |
| 745 | 745 |
| 746 protected: | 746 protected: |
| 747 TestingProfile profile_; | 747 TestingProfile profile_; |
| 748 BookmarkModel* model_; | 748 BookmarkModel* model_; |
| 749 syncer::TestUserShare test_user_share_; | 749 syncer::TestUserShare test_user_share_; |
| 750 scoped_ptr<BookmarkChangeProcessor> change_processor_; | 750 scoped_ptr<BookmarkChangeProcessor> change_processor_; |
| 751 StrictMock<DataTypeErrorHandlerMock> mock_error_handler_; | 751 StrictMock<sync_driver::DataTypeErrorHandlerMock> mock_error_handler_; |
| 752 scoped_ptr<BookmarkModelAssociator> model_associator_; | 752 scoped_ptr<BookmarkModelAssociator> model_associator_; |
| 753 | 753 |
| 754 private: | 754 private: |
| 755 content::TestBrowserThreadBundle thread_bundle_; | 755 content::TestBrowserThreadBundle thread_bundle_; |
| 756 syncer::SyncMergeResult local_merge_result_; | 756 syncer::SyncMergeResult local_merge_result_; |
| 757 syncer::SyncMergeResult syncer_merge_result_; | 757 syncer::SyncMergeResult syncer_merge_result_; |
| 758 }; | 758 }; |
| 759 | 759 |
| 760 TEST_F(ProfileSyncServiceBookmarkTest, InitialState) { | 760 TEST_F(ProfileSyncServiceBookmarkTest, InitialState) { |
| 761 LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE); | 761 LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE); |
| (...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2185 ExpectModelMatch(); | 2185 ExpectModelMatch(); |
| 2186 | 2186 |
| 2187 // Then simulate the add call arriving late. | 2187 // Then simulate the add call arriving late. |
| 2188 change_processor_->BookmarkNodeAdded(model_, model_->bookmark_bar_node(), 0); | 2188 change_processor_->BookmarkNodeAdded(model_, model_->bookmark_bar_node(), 0); |
| 2189 ExpectModelMatch(); | 2189 ExpectModelMatch(); |
| 2190 } | 2190 } |
| 2191 | 2191 |
| 2192 } // namespace | 2192 } // namespace |
| 2193 | 2193 |
| 2194 } // namespace browser_sync | 2194 } // namespace browser_sync |
| OLD | NEW |