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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 enum LoadOption { LOAD_FROM_STORAGE, DELETE_EXISTING_STORAGE }; | 352 enum LoadOption { LOAD_FROM_STORAGE, DELETE_EXISTING_STORAGE }; |
353 enum SaveOption { SAVE_TO_STORAGE, DONT_SAVE_TO_STORAGE }; | 353 enum SaveOption { SAVE_TO_STORAGE, DONT_SAVE_TO_STORAGE }; |
354 | 354 |
355 ProfileSyncServiceBookmarkTest() | 355 ProfileSyncServiceBookmarkTest() |
356 : managed_bookmark_service_(new bookmarks::ManagedBookmarkService( | 356 : managed_bookmark_service_(new bookmarks::ManagedBookmarkService( |
357 profile_sync_service_bundle_.pref_service(), | 357 profile_sync_service_bundle_.pref_service(), |
358 base::Bind(ReturnEmptyString))), | 358 base::Bind(ReturnEmptyString))), |
359 local_merge_result_(syncer::BOOKMARKS), | 359 local_merge_result_(syncer::BOOKMARKS), |
360 syncer_merge_result_(syncer::BOOKMARKS) { | 360 syncer_merge_result_(syncer::BOOKMARKS) { |
361 CHECK(data_dir_.CreateUniqueTempDir()); | 361 CHECK(data_dir_.CreateUniqueTempDir()); |
362 browser_sync::ProfileSyncServiceBundle::SyncClientBuilder builder( | 362 ProfileSyncServiceBundle::SyncClientBuilder builder( |
363 &profile_sync_service_bundle_); | 363 &profile_sync_service_bundle_); |
364 builder.SetBookmarkModelCallback(base::Bind( | 364 builder.SetBookmarkModelCallback(base::Bind( |
365 &ProfileSyncServiceBookmarkTest::model, base::Unretained(this))); | 365 &ProfileSyncServiceBookmarkTest::model, base::Unretained(this))); |
366 sync_client_ = builder.Build(); | 366 sync_client_ = builder.Build(); |
367 bookmarks::RegisterProfilePrefs( | 367 bookmarks::RegisterProfilePrefs( |
368 profile_sync_service_bundle_.pref_service()->registry()); | 368 profile_sync_service_bundle_.pref_service()->registry()); |
369 } | 369 } |
370 | 370 |
371 ~ProfileSyncServiceBookmarkTest() override { | 371 ~ProfileSyncServiceBookmarkTest() override { |
372 static_cast<KeyedService*>(managed_bookmark_service_.get())->Shutdown(); | 372 static_cast<KeyedService*>(managed_bookmark_service_.get())->Shutdown(); |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 return model_associator_.get(); | 808 return model_associator_.get(); |
809 } | 809 } |
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 browser_sync::ProfileSyncServiceBundle profile_sync_service_bundle_; | 818 ProfileSyncServiceBundle profile_sync_service_bundle_; |
819 | 819 |
820 std::unique_ptr<sync_driver::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_; |
(...skipping 1763 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 |