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