| 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 <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 const BookmarkNode::MetaInfoMap& meta_info_map) { | 259 const BookmarkNode::MetaInfoMap& meta_info_map) { |
| 260 syncer::WriteNode node(trans_); | 260 syncer::WriteNode node(trans_); |
| 261 ASSERT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(id)); | 261 ASSERT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(id)); |
| 262 sync_pb::BookmarkSpecifics specifics = node.GetBookmarkSpecifics(); | 262 sync_pb::BookmarkSpecifics specifics = node.GetBookmarkSpecifics(); |
| 263 SetNodeMetaInfo(meta_info_map, &specifics); | 263 SetNodeMetaInfo(meta_info_map, &specifics); |
| 264 node.SetBookmarkSpecifics(specifics); | 264 node.SetBookmarkSpecifics(specifics); |
| 265 SetModified(id); | 265 SetModified(id); |
| 266 } | 266 } |
| 267 | 267 |
| 268 // Pass the fake change list to |service|. | 268 // Pass the fake change list to |service|. |
| 269 void ApplyPendingChanges(syncer::ChangeProcessor* processor) { | 269 void ApplyPendingChanges(sync_driver::ChangeProcessor* processor) { |
| 270 processor->ApplyChangesFromSyncModel( | 270 processor->ApplyChangesFromSyncModel( |
| 271 trans_, 0, syncer::ImmutableChangeRecordList(&changes_)); | 271 trans_, 0, syncer::ImmutableChangeRecordList(&changes_)); |
| 272 } | 272 } |
| 273 | 273 |
| 274 const syncer::ChangeRecordList& changes() { return changes_; } | 274 const syncer::ChangeRecordList& changes() { return changes_; } |
| 275 | 275 |
| 276 private: | 276 private: |
| 277 // Helper function to push an ACTION_UPDATE record onto the back | 277 // Helper function to push an ACTION_UPDATE record onto the back |
| 278 // of the changelist. | 278 // of the changelist. |
| 279 void SetModified(int64_t id) { | 279 void SetModified(int64_t id) { |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 | 810 |
| 811 bookmarks::ManagedBookmarkService* managed_bookmark_service() { | 811 bookmarks::ManagedBookmarkService* managed_bookmark_service() { |
| 812 return managed_bookmark_service_.get(); | 812 return managed_bookmark_service_.get(); |
| 813 } | 813 } |
| 814 | 814 |
| 815 private: | 815 private: |
| 816 base::TestMessageLoop message_loop_; | 816 base::TestMessageLoop message_loop_; |
| 817 base::ScopedTempDir data_dir_; | 817 base::ScopedTempDir data_dir_; |
| 818 ProfileSyncServiceBundle profile_sync_service_bundle_; | 818 ProfileSyncServiceBundle profile_sync_service_bundle_; |
| 819 | 819 |
| 820 std::unique_ptr<syncer::FakeSyncClient> sync_client_; | 820 std::unique_ptr<sync_driver::FakeSyncClient> sync_client_; |
| 821 std::unique_ptr<BookmarkModel> model_; | 821 std::unique_ptr<BookmarkModel> model_; |
| 822 syncer::TestUserShare test_user_share_; | 822 syncer::TestUserShare test_user_share_; |
| 823 std::unique_ptr<BookmarkChangeProcessor> change_processor_; | 823 std::unique_ptr<BookmarkChangeProcessor> change_processor_; |
| 824 syncer::DataTypeErrorHandlerMock* mock_error_handler_; | 824 syncer::DataTypeErrorHandlerMock* mock_error_handler_; |
| 825 std::unique_ptr<BookmarkModelAssociator> model_associator_; | 825 std::unique_ptr<BookmarkModelAssociator> model_associator_; |
| 826 std::unique_ptr<bookmarks::ManagedBookmarkService> managed_bookmark_service_; | 826 std::unique_ptr<bookmarks::ManagedBookmarkService> managed_bookmark_service_; |
| 827 | 827 |
| 828 syncer::SyncMergeResult local_merge_result_; | 828 syncer::SyncMergeResult local_merge_result_; |
| 829 syncer::SyncMergeResult syncer_merge_result_; | 829 syncer::SyncMergeResult syncer_merge_result_; |
| 830 | 830 |
| (...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2592 EXPECT_EQ(syncer::kInvalidId, sync_id); | 2592 EXPECT_EQ(syncer::kInvalidId, sync_id); |
| 2593 | 2593 |
| 2594 // Verify that Sync ignores deleting this node. | 2594 // Verify that Sync ignores deleting this node. |
| 2595 model()->Remove(node); | 2595 model()->Remove(node); |
| 2596 EXPECT_EQ(sync_bookmark_count, GetSyncBookmarkCount()); | 2596 EXPECT_EQ(sync_bookmark_count, GetSyncBookmarkCount()); |
| 2597 } | 2597 } |
| 2598 | 2598 |
| 2599 } // namespace | 2599 } // namespace |
| 2600 | 2600 |
| 2601 } // namespace browser_sync | 2601 } // namespace browser_sync |
| OLD | NEW |