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