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 20 matching lines...) Expand all Loading... |
31 #include "build/build_config.h" | 31 #include "build/build_config.h" |
32 #include "components/bookmarks/browser/base_bookmark_model_observer.h" | 32 #include "components/bookmarks/browser/base_bookmark_model_observer.h" |
33 #include "components/bookmarks/browser/bookmark_model.h" | 33 #include "components/bookmarks/browser/bookmark_model.h" |
34 #include "components/bookmarks/browser/bookmark_utils.h" | 34 #include "components/bookmarks/browser/bookmark_utils.h" |
35 #include "components/bookmarks/managed/managed_bookmark_service.h" | 35 #include "components/bookmarks/managed/managed_bookmark_service.h" |
36 #include "components/bookmarks/test/bookmark_test_helpers.h" | 36 #include "components/bookmarks/test/bookmark_test_helpers.h" |
37 #include "components/bookmarks/test/test_bookmark_client.h" | 37 #include "components/bookmarks/test/test_bookmark_client.h" |
38 #include "components/browser_sync/browser/profile_sync_test_util.h" | 38 #include "components/browser_sync/browser/profile_sync_test_util.h" |
39 #include "components/sync_bookmarks/bookmark_change_processor.h" | 39 #include "components/sync_bookmarks/bookmark_change_processor.h" |
40 #include "components/sync_bookmarks/bookmark_model_associator.h" | 40 #include "components/sync_bookmarks/bookmark_model_associator.h" |
41 #include "components/sync_driver/data_type_error_handler.h" | |
42 #include "components/sync_driver/data_type_error_handler_mock.h" | |
43 #include "components/sync_driver/fake_sync_client.h" | 41 #include "components/sync_driver/fake_sync_client.h" |
44 #include "sync/api/sync_error.h" | 42 #include "sync/api/sync_error.h" |
45 #include "sync/api/sync_merge_result.h" | 43 #include "sync/api/sync_merge_result.h" |
46 #include "sync/internal_api/public/change_record.h" | 44 #include "sync/internal_api/public/change_record.h" |
| 45 #include "sync/internal_api/public/data_type_error_handler.h" |
47 #include "sync/internal_api/public/read_node.h" | 46 #include "sync/internal_api/public/read_node.h" |
48 #include "sync/internal_api/public/read_transaction.h" | 47 #include "sync/internal_api/public/read_transaction.h" |
| 48 #include "sync/internal_api/public/test/data_type_error_handler_mock.h" |
49 #include "sync/internal_api/public/test/test_user_share.h" | 49 #include "sync/internal_api/public/test/test_user_share.h" |
50 #include "sync/internal_api/public/write_node.h" | 50 #include "sync/internal_api/public/write_node.h" |
51 #include "sync/internal_api/public/write_transaction.h" | 51 #include "sync/internal_api/public/write_transaction.h" |
52 #include "sync/internal_api/syncapi_internal.h" | 52 #include "sync/internal_api/syncapi_internal.h" |
53 #include "sync/syncable/mutable_entry.h" | 53 #include "sync/syncable/mutable_entry.h" |
54 #include "sync/syncable/syncable_id.h" | 54 #include "sync/syncable/syncable_id.h" |
55 #include "sync/syncable/syncable_util.h" | 55 #include "sync/syncable/syncable_util.h" |
56 #include "sync/syncable/syncable_write_transaction.h" | 56 #include "sync/syncable/syncable_write_transaction.h" |
57 #include "testing/gmock/include/gmock/gmock.h" | 57 #include "testing/gmock/include/gmock/gmock.h" |
58 #include "testing/gtest/include/gtest/gtest.h" | 58 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 return change_processor_.get(); | 784 return change_processor_.get(); |
785 } | 785 } |
786 | 786 |
787 void delete_change_processor() { change_processor_.reset(); } | 787 void delete_change_processor() { change_processor_.reset(); } |
788 | 788 |
789 void ResetChangeProcessor() { | 789 void ResetChangeProcessor() { |
790 change_processor_ = base::WrapUnique(new BookmarkChangeProcessor( | 790 change_processor_ = base::WrapUnique(new BookmarkChangeProcessor( |
791 sync_client_.get(), model_associator_.get(), &mock_error_handler_)); | 791 sync_client_.get(), model_associator_.get(), &mock_error_handler_)); |
792 } | 792 } |
793 | 793 |
794 sync_driver::DataTypeErrorHandlerMock* mock_error_handler() { | 794 syncer::DataTypeErrorHandlerMock* mock_error_handler() { |
795 return &mock_error_handler_; | 795 return &mock_error_handler_; |
796 } | 796 } |
797 | 797 |
798 void delete_model_associator() { model_associator_.reset(); } | 798 void delete_model_associator() { model_associator_.reset(); } |
799 | 799 |
800 BookmarkModelAssociator* model_associator() { | 800 BookmarkModelAssociator* model_associator() { |
801 return model_associator_.get(); | 801 return model_associator_.get(); |
802 } | 802 } |
803 | 803 |
804 bookmarks::ManagedBookmarkService* managed_bookmark_service() { | 804 bookmarks::ManagedBookmarkService* managed_bookmark_service() { |
805 return managed_bookmark_service_.get(); | 805 return managed_bookmark_service_.get(); |
806 } | 806 } |
807 | 807 |
808 private: | 808 private: |
809 base::ScopedTempDir data_dir_; | 809 base::ScopedTempDir data_dir_; |
810 base::MessageLoop message_loop_; | 810 base::MessageLoop message_loop_; |
811 browser_sync::ProfileSyncServiceBundle profile_sync_service_bundle_; | 811 browser_sync::ProfileSyncServiceBundle profile_sync_service_bundle_; |
812 | 812 |
813 std::unique_ptr<sync_driver::FakeSyncClient> sync_client_; | 813 std::unique_ptr<sync_driver::FakeSyncClient> sync_client_; |
814 std::unique_ptr<BookmarkModel> model_; | 814 std::unique_ptr<BookmarkModel> model_; |
815 syncer::TestUserShare test_user_share_; | 815 syncer::TestUserShare test_user_share_; |
816 std::unique_ptr<BookmarkChangeProcessor> change_processor_; | 816 std::unique_ptr<BookmarkChangeProcessor> change_processor_; |
817 StrictMock<sync_driver::DataTypeErrorHandlerMock> mock_error_handler_; | 817 StrictMock<syncer::DataTypeErrorHandlerMock> mock_error_handler_; |
818 std::unique_ptr<BookmarkModelAssociator> model_associator_; | 818 std::unique_ptr<BookmarkModelAssociator> model_associator_; |
819 std::unique_ptr<bookmarks::ManagedBookmarkService> managed_bookmark_service_; | 819 std::unique_ptr<bookmarks::ManagedBookmarkService> managed_bookmark_service_; |
820 | 820 |
821 syncer::SyncMergeResult local_merge_result_; | 821 syncer::SyncMergeResult local_merge_result_; |
822 syncer::SyncMergeResult syncer_merge_result_; | 822 syncer::SyncMergeResult syncer_merge_result_; |
823 | 823 |
824 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceBookmarkTest); | 824 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceBookmarkTest); |
825 }; | 825 }; |
826 | 826 |
827 TEST_F(ProfileSyncServiceBookmarkTest, InitialState) { | 827 TEST_F(ProfileSyncServiceBookmarkTest, InitialState) { |
(...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2588 EXPECT_EQ(syncer::kInvalidId, sync_id); | 2588 EXPECT_EQ(syncer::kInvalidId, sync_id); |
2589 | 2589 |
2590 // Verify that Sync ignores deleting this node. | 2590 // Verify that Sync ignores deleting this node. |
2591 model()->Remove(node); | 2591 model()->Remove(node); |
2592 EXPECT_EQ(sync_bookmark_count, GetSyncBookmarkCount()); | 2592 EXPECT_EQ(sync_bookmark_count, GetSyncBookmarkCount()); |
2593 } | 2593 } |
2594 | 2594 |
2595 } // namespace | 2595 } // namespace |
2596 | 2596 |
2597 } // namespace browser_sync | 2597 } // namespace browser_sync |
OLD | NEW |