| 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 #include "components/sync/driver/sync_api_component_factory_mock.h" | 5 #include "components/sync/driver/sync_api_component_factory_mock.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "components/sync/api/attachments/attachment_store.h" | 9 #include "components/sync/api/attachments/attachment_store.h" |
| 10 #include "components/sync/core/attachments/attachment_service_impl.h" | 10 #include "components/sync/core/attachments/attachment_service_impl.h" |
| 11 #include "components/sync/device_info/local_device_info_provider_mock.h" | 11 #include "components/sync/device_info/local_device_info_provider_mock.h" |
| 12 #include "components/sync/driver/change_processor.h" | 12 #include "components/sync/driver/change_processor.h" |
| 13 #include "components/sync/driver/model_associator.h" | 13 #include "components/sync/driver/model_associator.h" |
| 14 | 14 |
| 15 using sync_driver::AssociatorInterface; | |
| 16 using sync_driver::ChangeProcessor; | |
| 17 using testing::_; | 15 using testing::_; |
| 18 using testing::InvokeWithoutArgs; | 16 using testing::InvokeWithoutArgs; |
| 19 using testing::Return; | 17 using testing::Return; |
| 20 | 18 |
| 19 namespace syncer { |
| 20 |
| 21 SyncApiComponentFactoryMock::SyncApiComponentFactoryMock() | 21 SyncApiComponentFactoryMock::SyncApiComponentFactoryMock() |
| 22 : local_device_(new sync_driver::LocalDeviceInfoProviderMock()) {} | 22 : local_device_(new LocalDeviceInfoProviderMock()) {} |
| 23 | 23 |
| 24 SyncApiComponentFactoryMock::SyncApiComponentFactoryMock( | 24 SyncApiComponentFactoryMock::SyncApiComponentFactoryMock( |
| 25 AssociatorInterface* model_associator, | 25 AssociatorInterface* model_associator, |
| 26 ChangeProcessor* change_processor) | 26 ChangeProcessor* change_processor) |
| 27 : model_associator_(model_associator), | 27 : model_associator_(model_associator), |
| 28 change_processor_(change_processor), | 28 change_processor_(change_processor), |
| 29 local_device_(new sync_driver::LocalDeviceInfoProviderMock()) { | 29 local_device_(new LocalDeviceInfoProviderMock()) {} |
| 30 } | |
| 31 | 30 |
| 32 SyncApiComponentFactoryMock::~SyncApiComponentFactoryMock() {} | 31 SyncApiComponentFactoryMock::~SyncApiComponentFactoryMock() {} |
| 33 | 32 |
| 34 std::unique_ptr<syncer::AttachmentService> | 33 std::unique_ptr<AttachmentService> |
| 35 SyncApiComponentFactoryMock::CreateAttachmentService( | 34 SyncApiComponentFactoryMock::CreateAttachmentService( |
| 36 std::unique_ptr<syncer::AttachmentStoreForSync> attachment_store, | 35 std::unique_ptr<AttachmentStoreForSync> attachment_store, |
| 37 const syncer::UserShare& user_share, | 36 const UserShare& user_share, |
| 38 const std::string& store_birthday, | 37 const std::string& store_birthday, |
| 39 syncer::ModelType model_type, | 38 ModelType model_type, |
| 40 syncer::AttachmentService::Delegate* delegate) { | 39 AttachmentService::Delegate* delegate) { |
| 41 return syncer::AttachmentServiceImpl::CreateForTest(); | 40 return AttachmentServiceImpl::CreateForTest(); |
| 42 } | 41 } |
| 43 | 42 |
| 44 sync_driver::SyncApiComponentFactory::SyncComponents | 43 SyncApiComponentFactory::SyncComponents |
| 45 SyncApiComponentFactoryMock::CreateBookmarkSyncComponents( | 44 SyncApiComponentFactoryMock::CreateBookmarkSyncComponents( |
| 46 sync_driver::SyncService* sync_service, | 45 SyncService* sync_service, |
| 47 std::unique_ptr<syncer::DataTypeErrorHandler> error_handler) { | 46 std::unique_ptr<DataTypeErrorHandler> error_handler) { |
| 48 return MakeSyncComponents(); | 47 return MakeSyncComponents(); |
| 49 } | 48 } |
| 50 | 49 |
| 51 sync_driver::SyncApiComponentFactory::SyncComponents | 50 SyncApiComponentFactory::SyncComponents |
| 52 SyncApiComponentFactoryMock::MakeSyncComponents() { | 51 SyncApiComponentFactoryMock::MakeSyncComponents() { |
| 53 return sync_driver::SyncApiComponentFactory::SyncComponents( | 52 return SyncApiComponentFactory::SyncComponents(model_associator_.release(), |
| 54 model_associator_.release(), change_processor_.release()); | 53 change_processor_.release()); |
| 55 } | 54 } |
| 56 | 55 |
| 57 std::unique_ptr<sync_driver::LocalDeviceInfoProvider> | 56 std::unique_ptr<LocalDeviceInfoProvider> |
| 58 SyncApiComponentFactoryMock::CreateLocalDeviceInfoProvider() { | 57 SyncApiComponentFactoryMock::CreateLocalDeviceInfoProvider() { |
| 59 return std::move(local_device_); | 58 return std::move(local_device_); |
| 60 } | 59 } |
| 61 | 60 |
| 62 void SyncApiComponentFactoryMock::SetLocalDeviceInfoProvider( | 61 void SyncApiComponentFactoryMock::SetLocalDeviceInfoProvider( |
| 63 std::unique_ptr<sync_driver::LocalDeviceInfoProvider> local_device) { | 62 std::unique_ptr<LocalDeviceInfoProvider> local_device) { |
| 64 local_device_ = std::move(local_device); | 63 local_device_ = std::move(local_device); |
| 65 } | 64 } |
| 65 |
| 66 } // namespace syncer |
| OLD | NEW |