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 "chrome/browser/sync/profile_sync_components_factory_mock.h" | 5 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
| 6 |
| 7 #include "chrome/browser/sync/glue/local_device_info_provider_mock.h" |
6 #include "components/sync_driver/change_processor.h" | 8 #include "components/sync_driver/change_processor.h" |
7 #include "components/sync_driver/model_associator.h" | 9 #include "components/sync_driver/model_associator.h" |
8 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
9 #include "sync/api/attachments/attachment_service_impl.h" | 11 #include "sync/api/attachments/attachment_service_impl.h" |
10 #include "sync/internal_api/public/attachments/fake_attachment_store.h" | 12 #include "sync/internal_api/public/attachments/fake_attachment_store.h" |
11 | 13 |
12 using browser_sync::AssociatorInterface; | 14 using browser_sync::AssociatorInterface; |
13 using browser_sync::ChangeProcessor; | 15 using browser_sync::ChangeProcessor; |
14 using testing::_; | 16 using testing::_; |
15 using testing::InvokeWithoutArgs; | 17 using testing::InvokeWithoutArgs; |
| 18 using testing::Return; |
16 | 19 |
17 ProfileSyncComponentsFactoryMock::ProfileSyncComponentsFactoryMock() {} | 20 ProfileSyncComponentsFactoryMock::ProfileSyncComponentsFactoryMock() { |
| 21 ON_CALL(*this, CreateLocalDeviceInfoProviderMock()). |
| 22 WillByDefault( |
| 23 Return(new browser_sync::LocalDeviceInfoProviderMock())); |
| 24 } |
18 | 25 |
19 ProfileSyncComponentsFactoryMock::ProfileSyncComponentsFactoryMock( | 26 ProfileSyncComponentsFactoryMock::ProfileSyncComponentsFactoryMock( |
20 AssociatorInterface* model_associator, ChangeProcessor* change_processor) | 27 AssociatorInterface* model_associator, ChangeProcessor* change_processor) |
21 : model_associator_(model_associator), | 28 : model_associator_(model_associator), |
22 change_processor_(change_processor) { | 29 change_processor_(change_processor) { |
23 ON_CALL(*this, CreateBookmarkSyncComponents(_, _)). | 30 ON_CALL(*this, CreateBookmarkSyncComponents(_, _)). |
24 WillByDefault( | 31 WillByDefault( |
25 InvokeWithoutArgs( | 32 InvokeWithoutArgs( |
26 this, | 33 this, |
27 &ProfileSyncComponentsFactoryMock::MakeSyncComponents)); | 34 &ProfileSyncComponentsFactoryMock::MakeSyncComponents)); |
| 35 ON_CALL(*this, CreateLocalDeviceInfoProviderMock()). |
| 36 WillByDefault( |
| 37 Return(new browser_sync::LocalDeviceInfoProviderMock())); |
28 } | 38 } |
29 | 39 |
30 ProfileSyncComponentsFactoryMock::~ProfileSyncComponentsFactoryMock() {} | 40 ProfileSyncComponentsFactoryMock::~ProfileSyncComponentsFactoryMock() {} |
31 | 41 |
32 scoped_ptr<syncer::AttachmentService> | 42 scoped_ptr<syncer::AttachmentService> |
33 ProfileSyncComponentsFactoryMock::CreateAttachmentService( | 43 ProfileSyncComponentsFactoryMock::CreateAttachmentService( |
34 const syncer::UserShare& user_share, | 44 const syncer::UserShare& user_share, |
35 syncer::AttachmentService::Delegate* delegate) { | 45 syncer::AttachmentService::Delegate* delegate) { |
36 return syncer::AttachmentServiceImpl::CreateForTest(); | 46 return syncer::AttachmentServiceImpl::CreateForTest(); |
37 } | 47 } |
38 | 48 |
39 ProfileSyncComponentsFactory::SyncComponents | 49 ProfileSyncComponentsFactory::SyncComponents |
40 ProfileSyncComponentsFactoryMock::MakeSyncComponents() { | 50 ProfileSyncComponentsFactoryMock::MakeSyncComponents() { |
41 return SyncComponents(model_associator_.release(), | 51 return SyncComponents(model_associator_.release(), |
42 change_processor_.release()); | 52 change_processor_.release()); |
43 } | 53 } |
| 54 |
| 55 scoped_ptr<browser_sync::LocalDeviceInfoProvider> |
| 56 ProfileSyncComponentsFactoryMock::CreateLocalDeviceInfoProvider() { |
| 57 return scoped_ptr<browser_sync::LocalDeviceInfoProvider>( |
| 58 CreateLocalDeviceInfoProviderMock()); |
| 59 } |
OLD | NEW |