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 "chrome/browser/sync/profile_sync_components_factory.h"
10 #include "chrome/browser/sync/profile_sync_service.h"
11 #include "components/sync_driver/data_type_controller.h"
12 #include "components/sync_driver/data_type_error_handler.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
: public ProfileSyncComponentsFactory
{
24 ProfileSyncComponentsFactoryMock();
25 ProfileSyncComponentsFactoryMock(
26 sync_driver::AssociatorInterface
* model_associator
,
27 sync_driver::ChangeProcessor
* change_processor
);
28 virtual ~ProfileSyncComponentsFactoryMock();
30 MOCK_METHOD1(RegisterDataTypes
, void(ProfileSyncService
*));
31 MOCK_METHOD5(CreateDataTypeManager
,
32 sync_driver::DataTypeManager
*(
33 const syncer::WeakHandle
<syncer::DataTypeDebugInfoListener
>&,
34 const sync_driver::DataTypeController::TypeMap
*,
35 const sync_driver::DataTypeEncryptionHandler
*,
36 browser_sync::SyncBackendHost
*,
37 sync_driver::DataTypeManagerObserver
* observer
));
38 MOCK_METHOD5(CreateSyncBackendHost
,
39 browser_sync::SyncBackendHost
*(
40 const std::string
& name
,
42 invalidation::InvalidationService
* invalidator
,
43 const base::WeakPtr
<sync_driver::SyncPrefs
>& sync_prefs
,
44 const base::FilePath
& sync_folder
));
46 virtual scoped_ptr
<sync_driver::LocalDeviceInfoProvider
>
47 CreateLocalDeviceInfoProvider() override
;
48 void SetLocalDeviceInfoProvider(
49 scoped_ptr
<sync_driver::LocalDeviceInfoProvider
> local_device
);
51 MOCK_METHOD1(GetSyncableServiceForType
,
52 base::WeakPtr
<syncer::SyncableService
>(syncer::ModelType
));
53 virtual scoped_ptr
<syncer::AttachmentService
> CreateAttachmentService(
54 const scoped_refptr
<syncer::AttachmentStore
>& attachment_store
,
55 const syncer::UserShare
& user_share
,
56 const std::string
& store_birthday
,
57 syncer::AttachmentService::Delegate
* delegate
) override
;
58 MOCK_METHOD2(CreateBookmarkSyncComponents
,
59 SyncComponents(ProfileSyncService
* profile_sync_service
,
60 sync_driver::DataTypeErrorHandler
* error_handler
));
61 #if defined(ENABLE_THEMES)
62 MOCK_METHOD2(CreateThemeSyncComponents
,
63 SyncComponents(ProfileSyncService
* profile_sync_service
,
64 sync_driver::DataTypeErrorHandler
* error_handler
));
66 MOCK_METHOD3(CreateTypedUrlSyncComponents
,
68 ProfileSyncService
* profile_sync_service
,
69 history::HistoryBackend
* history_backend
,
70 sync_driver::DataTypeErrorHandler
* error_handler
));
73 SyncComponents
MakeSyncComponents();
75 scoped_ptr
<sync_driver::AssociatorInterface
> model_associator_
;
76 scoped_ptr
<sync_driver::ChangeProcessor
> change_processor_
;
77 // LocalDeviceInfoProvider is initially owned by this class,
78 // transferred to caller when CreateLocalDeviceInfoProvider is called.
79 scoped_ptr
<sync_driver::LocalDeviceInfoProvider
> local_device_
;
82 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_MOCK_H__