OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "components/sync_driver/generic_change_processor.h" | 5 #include "components/sync_driver/generic_change_processor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "components/sync_driver/data_type_error_handler_mock.h" | |
18 #include "components/sync_driver/fake_sync_client.h" | 17 #include "components/sync_driver/fake_sync_client.h" |
19 #include "components/sync_driver/local_device_info_provider.h" | 18 #include "components/sync_driver/local_device_info_provider.h" |
20 #include "components/sync_driver/sync_api_component_factory.h" | 19 #include "components/sync_driver/sync_api_component_factory.h" |
21 #include "sync/api/attachments/attachment_id.h" | 20 #include "sync/api/attachments/attachment_id.h" |
22 #include "sync/api/attachments/attachment_store.h" | 21 #include "sync/api/attachments/attachment_store.h" |
23 #include "sync/api/fake_syncable_service.h" | 22 #include "sync/api/fake_syncable_service.h" |
24 #include "sync/api/sync_change.h" | 23 #include "sync/api/sync_change.h" |
25 #include "sync/api/sync_merge_result.h" | 24 #include "sync/api/sync_merge_result.h" |
26 #include "sync/internal_api/public/attachments/attachment_service_impl.h" | 25 #include "sync/internal_api/public/attachments/attachment_service_impl.h" |
27 #include "sync/internal_api/public/attachments/fake_attachment_downloader.h" | 26 #include "sync/internal_api/public/attachments/fake_attachment_downloader.h" |
28 #include "sync/internal_api/public/attachments/fake_attachment_uploader.h" | 27 #include "sync/internal_api/public/attachments/fake_attachment_uploader.h" |
29 #include "sync/internal_api/public/base/model_type.h" | 28 #include "sync/internal_api/public/base/model_type.h" |
30 #include "sync/internal_api/public/read_node.h" | 29 #include "sync/internal_api/public/read_node.h" |
31 #include "sync/internal_api/public/read_transaction.h" | 30 #include "sync/internal_api/public/read_transaction.h" |
32 #include "sync/internal_api/public/sync_encryption_handler.h" | 31 #include "sync/internal_api/public/sync_encryption_handler.h" |
| 32 #include "sync/internal_api/public/test/data_type_error_handler_mock.h" |
33 #include "sync/internal_api/public/test/test_user_share.h" | 33 #include "sync/internal_api/public/test/test_user_share.h" |
34 #include "sync/internal_api/public/user_share.h" | 34 #include "sync/internal_api/public/user_share.h" |
35 #include "sync/internal_api/public/write_node.h" | 35 #include "sync/internal_api/public/write_node.h" |
36 #include "sync/internal_api/public/write_transaction.h" | 36 #include "sync/internal_api/public/write_transaction.h" |
37 #include "testing/gmock/include/gmock/gmock-matchers.h" | 37 #include "testing/gmock/include/gmock/gmock-matchers.h" |
38 #include "testing/gtest/include/gtest/gtest.h" | 38 #include "testing/gtest/include/gtest/gtest.h" |
39 | 39 |
40 namespace sync_driver { | 40 namespace sync_driver { |
41 | 41 |
42 namespace { | 42 namespace { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, | 105 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, |
106 const base::FilePath& sync_folder) override { | 106 const base::FilePath& sync_folder) override { |
107 return nullptr; | 107 return nullptr; |
108 } | 108 } |
109 std::unique_ptr<sync_driver::LocalDeviceInfoProvider> | 109 std::unique_ptr<sync_driver::LocalDeviceInfoProvider> |
110 CreateLocalDeviceInfoProvider() override { | 110 CreateLocalDeviceInfoProvider() override { |
111 return nullptr; | 111 return nullptr; |
112 } | 112 } |
113 SyncComponents CreateBookmarkSyncComponents( | 113 SyncComponents CreateBookmarkSyncComponents( |
114 sync_driver::SyncService* sync_service, | 114 sync_driver::SyncService* sync_service, |
115 sync_driver::DataTypeErrorHandler* error_handler) override { | 115 syncer::DataTypeErrorHandler* error_handler) override { |
116 return SyncComponents(nullptr, nullptr); | 116 return SyncComponents(nullptr, nullptr); |
117 } | 117 } |
118 | 118 |
119 std::unique_ptr<syncer::AttachmentService> CreateAttachmentService( | 119 std::unique_ptr<syncer::AttachmentService> CreateAttachmentService( |
120 std::unique_ptr<syncer::AttachmentStoreForSync> attachment_store, | 120 std::unique_ptr<syncer::AttachmentStoreForSync> attachment_store, |
121 const syncer::UserShare& user_share, | 121 const syncer::UserShare& user_share, |
122 const std::string& store_birthday, | 122 const std::string& store_birthday, |
123 syncer::ModelType model_type, | 123 syncer::ModelType model_type, |
124 syncer::AttachmentService::Delegate* delegate) override { | 124 syncer::AttachmentService::Delegate* delegate) override { |
125 std::unique_ptr<MockAttachmentService> attachment_service( | 125 std::unique_ptr<MockAttachmentService> attachment_service( |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 base::MessageLoopForUI loop_; | 226 base::MessageLoopForUI loop_; |
227 | 227 |
228 std::unique_ptr<syncer::SyncMergeResult> sync_merge_result_; | 228 std::unique_ptr<syncer::SyncMergeResult> sync_merge_result_; |
229 std::unique_ptr<base::WeakPtrFactory<syncer::SyncMergeResult>> | 229 std::unique_ptr<base::WeakPtrFactory<syncer::SyncMergeResult>> |
230 merge_result_ptr_factory_; | 230 merge_result_ptr_factory_; |
231 | 231 |
232 syncer::FakeSyncableService fake_syncable_service_; | 232 syncer::FakeSyncableService fake_syncable_service_; |
233 base::WeakPtrFactory<syncer::FakeSyncableService> | 233 base::WeakPtrFactory<syncer::FakeSyncableService> |
234 syncable_service_ptr_factory_; | 234 syncable_service_ptr_factory_; |
235 | 235 |
236 DataTypeErrorHandlerMock data_type_error_handler_; | 236 syncer::DataTypeErrorHandlerMock data_type_error_handler_; |
237 std::unique_ptr<syncer::TestUserShare> test_user_share_; | 237 std::unique_ptr<syncer::TestUserShare> test_user_share_; |
238 MockAttachmentService* mock_attachment_service_; | 238 MockAttachmentService* mock_attachment_service_; |
239 FakeSyncClient sync_client_; | 239 FakeSyncClient sync_client_; |
240 MockSyncApiComponentFactory sync_factory_; | 240 MockSyncApiComponentFactory sync_factory_; |
241 | 241 |
242 std::unique_ptr<GenericChangeProcessor> change_processor_; | 242 std::unique_ptr<GenericChangeProcessor> change_processor_; |
243 }; | 243 }; |
244 | 244 |
245 // Similar to above, but focused on the method that implements sync/api | 245 // Similar to above, but focused on the method that implements sync/api |
246 // interfaces and is hence exposed to datatypes directly. | 246 // interfaces and is hence exposed to datatypes directly. |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 change_processor()->GetAllSyncData(syncer::SESSIONS); | 540 change_processor()->GetAllSyncData(syncer::SESSIONS); |
541 ASSERT_EQ(sync_data.size(), 1U); | 541 ASSERT_EQ(sync_data.size(), 1U); |
542 ASSERT_EQ("session tag 2", | 542 ASSERT_EQ("session tag 2", |
543 sync_data[0].GetSpecifics().session().session_tag()); | 543 sync_data[0].GetSpecifics().session().session_tag()); |
544 EXPECT_FALSE(syncer::SyncDataRemote(sync_data[0]).GetClientTagHash().empty()); | 544 EXPECT_FALSE(syncer::SyncDataRemote(sync_data[0]).GetClientTagHash().empty()); |
545 } | 545 } |
546 | 546 |
547 } // namespace | 547 } // namespace |
548 | 548 |
549 } // namespace sync_driver | 549 } // namespace sync_driver |
OLD | NEW |