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