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 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_MOCK_H__
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_MOCK_H__
8 #include "base/memory/scoped_ptr.h"
9 #include "components/sync_driver/data_type_controller.h"
10 #include "components/sync_driver/data_type_error_handler.h"
11 #include "components/sync_driver/sync_api_component_factory.h"
12 #include "sync/internal_api/public/base/model_type.h"
13 #include "testing/gmock/include/gmock/gmock.h"
15 namespace sync_driver
{
16 class AssociatorInterface
;
17 class ChangeProcessor
;
18 class DataTypeEncryptionHandler
;
19 class DataTypeStatusTable
;
22 class ProfileSyncComponentsFactoryMock
23 : public sync_driver::SyncApiComponentFactory
{
25 ProfileSyncComponentsFactoryMock();
26 ProfileSyncComponentsFactoryMock(
27 sync_driver::AssociatorInterface
* model_associator
,
28 sync_driver::ChangeProcessor
* change_processor
);
29 ~ProfileSyncComponentsFactoryMock() override
;
31 MOCK_METHOD1(Initialize
, void(sync_driver::SyncService
*));
32 MOCK_METHOD0(RegisterDataTypes
, void());
33 MOCK_METHOD5(CreateDataTypeManager
,
34 sync_driver::DataTypeManager
*(
35 const syncer::WeakHandle
<syncer::DataTypeDebugInfoListener
>&,
36 const sync_driver::DataTypeController::TypeMap
*,
37 const sync_driver::DataTypeEncryptionHandler
*,
38 browser_sync::SyncBackendHost
*,
39 sync_driver::DataTypeManagerObserver
* observer
));
40 MOCK_METHOD4(CreateSyncBackendHost
,
41 browser_sync::SyncBackendHost
*(
42 const std::string
& name
,
43 invalidation::InvalidationService
* invalidator
,
44 const base::WeakPtr
<sync_driver::SyncPrefs
>& sync_prefs
,
45 const base::FilePath
& sync_folder
));
47 scoped_ptr
<sync_driver::LocalDeviceInfoProvider
>
48 CreateLocalDeviceInfoProvider() override
;
49 void SetLocalDeviceInfoProvider(
50 scoped_ptr
<sync_driver::LocalDeviceInfoProvider
> local_device
);
52 scoped_ptr
<syncer::AttachmentService
> CreateAttachmentService(
53 scoped_ptr
<syncer::AttachmentStoreForSync
> attachment_store
,
54 const syncer::UserShare
& user_share
,
55 const std::string
& store_birthday
,
56 syncer::ModelType model_type
,
57 syncer::AttachmentService::Delegate
* delegate
) override
;
58 MOCK_METHOD2(CreateBookmarkSyncComponents
,
59 SyncComponents(sync_driver::SyncService
* sync_service
,
60 sync_driver::DataTypeErrorHandler
* error_handler
));
61 MOCK_METHOD3(CreateTypedUrlSyncComponents
,
63 sync_driver::SyncService
* sync_service
,
64 history::HistoryBackend
* history_backend
,
65 sync_driver::DataTypeErrorHandler
* error_handler
));
68 sync_driver::SyncApiComponentFactory::SyncComponents
MakeSyncComponents();
70 scoped_ptr
<sync_driver::AssociatorInterface
> model_associator_
;
71 scoped_ptr
<sync_driver::ChangeProcessor
> change_processor_
;
72 // LocalDeviceInfoProvider is initially owned by this class,
73 // transferred to caller when CreateLocalDeviceInfoProvider is called.
74 scoped_ptr
<sync_driver::LocalDeviceInfoProvider
> local_device_
;
77 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_MOCK_H__