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