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