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/glue/data_type_controller.h"
10 #include "chrome/browser/sync/glue/data_type_error_handler.h"
11 #include "chrome/browser/sync/profile_sync_components_factory.h"
12 #include "chrome/browser/sync/profile_sync_service.h"
13 #include "testing/gmock/include/gmock/gmock.h"
15 namespace browser_sync
{
16 class AssociatorInterface
;
17 class ChangeProcessor
;
18 class DataTypeEncryptionHandler
;
19 class FailedDataTypesHandler
;
22 class ProfileSyncComponentsFactoryMock
: public ProfileSyncComponentsFactory
{
24 ProfileSyncComponentsFactoryMock();
25 ProfileSyncComponentsFactoryMock(
26 browser_sync::AssociatorInterface
* model_associator
,
27 browser_sync::ChangeProcessor
* change_processor
);
28 virtual ~ProfileSyncComponentsFactoryMock();
30 MOCK_METHOD1(RegisterDataTypes
, void(ProfileSyncService
*));
31 MOCK_METHOD6(CreateDataTypeManager
,
32 browser_sync::DataTypeManager
*(
33 const syncer::WeakHandle
<syncer::DataTypeDebugInfoListener
>&,
34 const browser_sync::DataTypeController::TypeMap
*,
35 const browser_sync::DataTypeEncryptionHandler
*,
36 browser_sync::SyncBackendHost
*,
37 browser_sync::DataTypeManagerObserver
* observer
,
38 browser_sync::FailedDataTypesHandler
*
39 failed_datatypes_handler
));
40 MOCK_METHOD3(CreateSyncBackendHost
,
41 browser_sync::SyncBackendHost
*(
42 const std::string
& name
,
44 const base::WeakPtr
<browser_sync::SyncPrefs
>& sync_prefs
));
45 MOCK_METHOD4(CreateGenericChangeProcessor
,
46 browser_sync::GenericChangeProcessor
*(
47 ProfileSyncService
* profile_sync_service
,
48 browser_sync::DataTypeErrorHandler
* error_handler
,
49 const base::WeakPtr
<syncer::SyncableService
>& local_service
,
50 const base::WeakPtr
<syncer::SyncMergeResult
>& merge_result
));
51 MOCK_METHOD0(CreateSharedChangeProcessor
,
52 browser_sync::SharedChangeProcessor
*());
53 MOCK_METHOD1(GetSyncableServiceForType
,
54 base::WeakPtr
<syncer::SyncableService
>(syncer::ModelType
));
55 MOCK_METHOD2(CreateBookmarkSyncComponents
,
56 SyncComponents(ProfileSyncService
* profile_sync_service
,
57 browser_sync::DataTypeErrorHandler
* error_handler
));
58 MOCK_METHOD3(CreatePasswordSyncComponents
,
60 ProfileSyncService
* profile_sync_service
,
61 PasswordStore
* password_store
,
62 browser_sync::DataTypeErrorHandler
* error_handler
));
63 MOCK_METHOD2(CreateSessionSyncComponents
,
64 SyncComponents(ProfileSyncService
* profile_sync_service
,
65 browser_sync::DataTypeErrorHandler
* error_handler
));
66 #if defined(ENABLE_THEMES)
67 MOCK_METHOD2(CreateThemeSyncComponents
,
68 SyncComponents(ProfileSyncService
* profile_sync_service
,
69 browser_sync::DataTypeErrorHandler
* error_handler
));
71 MOCK_METHOD3(CreateTypedUrlSyncComponents
,
73 ProfileSyncService
* profile_sync_service
,
74 history::HistoryBackend
* history_backend
,
75 browser_sync::DataTypeErrorHandler
* error_handler
));
78 SyncComponents
MakeSyncComponents();
80 scoped_ptr
<browser_sync::AssociatorInterface
> model_associator_
;
81 scoped_ptr
<browser_sync::ChangeProcessor
> change_processor_
;
84 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_MOCK_H__