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.
5 #include "chrome/browser/sync/profile_sync_components_factory_mock.h"
7 #include "components/sync_driver/change_processor.h"
8 #include "components/sync_driver/local_device_info_provider_mock.h"
9 #include "components/sync_driver/model_associator.h"
10 #include "sync/api/attachments/attachment_store.h"
11 #include "sync/internal_api/public/attachments/attachment_service_impl.h"
13 using sync_driver::AssociatorInterface
;
14 using sync_driver::ChangeProcessor
;
16 using testing::InvokeWithoutArgs
;
17 using testing::Return
;
19 ProfileSyncComponentsFactoryMock::ProfileSyncComponentsFactoryMock()
20 : local_device_(new sync_driver::LocalDeviceInfoProviderMock()) {
23 ProfileSyncComponentsFactoryMock::ProfileSyncComponentsFactoryMock(
24 AssociatorInterface
* model_associator
, ChangeProcessor
* change_processor
)
25 : model_associator_(model_associator
),
26 change_processor_(change_processor
),
27 local_device_(new sync_driver::LocalDeviceInfoProviderMock()) {
28 ON_CALL(*this, CreateBookmarkSyncComponents(_
, _
)).
32 &ProfileSyncComponentsFactoryMock::MakeSyncComponents
));
35 ProfileSyncComponentsFactoryMock::~ProfileSyncComponentsFactoryMock() {}
37 scoped_ptr
<syncer::AttachmentService
>
38 ProfileSyncComponentsFactoryMock::CreateAttachmentService(
39 scoped_ptr
<syncer::AttachmentStoreForSync
> attachment_store
,
40 const syncer::UserShare
& user_share
,
41 const std::string
& store_birthday
,
42 syncer::ModelType model_type
,
43 syncer::AttachmentService::Delegate
* delegate
) {
44 return syncer::AttachmentServiceImpl::CreateForTest();
47 sync_driver::SyncApiComponentFactory::SyncComponents
48 ProfileSyncComponentsFactoryMock::MakeSyncComponents() {
49 return sync_driver::SyncApiComponentFactory::SyncComponents(
50 model_associator_
.release(), change_processor_
.release());
53 scoped_ptr
<sync_driver::LocalDeviceInfoProvider
>
54 ProfileSyncComponentsFactoryMock::CreateLocalDeviceInfoProvider() {
55 return local_device_
.Pass();
58 void ProfileSyncComponentsFactoryMock::SetLocalDeviceInfoProvider(
59 scoped_ptr
<sync_driver::LocalDeviceInfoProvider
> local_device
) {
60 local_device_
= local_device
.Pass();