| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_GLUE_SYNC_BACKEND_HOST_MOCK_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_MOCK_H_ |
| 6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_MOCK_H_ | 6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_MOCK_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "components/sync/base/weak_handle.h" | 12 #include "components/sync/base/weak_handle.h" |
| 13 #include "components/sync/driver/glue/sync_backend_host.h" | 13 #include "components/sync/driver/glue/sync_backend_host.h" |
| 14 | 14 |
| 15 namespace browser_sync { | 15 namespace syncer { |
| 16 | 16 |
| 17 // A mock of the SyncBackendHost. | 17 // A mock of the SyncBackendHost. |
| 18 // | 18 // |
| 19 // This class implements the bare minimum required for the ProfileSyncService to | 19 // This class implements the bare minimum required for the ProfileSyncService to |
| 20 // get through initialization. It often returns NULL pointers or nonesense | 20 // get through initialization. It often returns NULL pointers or nonesense |
| 21 // values; it is not intended to be used in tests that depend on SyncBackendHost | 21 // values; it is not intended to be used in tests that depend on SyncBackendHost |
| 22 // behavior. | 22 // behavior. |
| 23 class SyncBackendHostMock : public SyncBackendHost { | 23 class SyncBackendHostMock : public SyncBackendHost { |
| 24 public: | 24 public: |
| 25 SyncBackendHostMock(); | 25 SyncBackendHostMock(); |
| 26 ~SyncBackendHostMock() override; | 26 ~SyncBackendHostMock() override; |
| 27 | 27 |
| 28 void Initialize( | 28 void Initialize( |
| 29 sync_driver::SyncFrontend* frontend, | 29 SyncFrontend* frontend, |
| 30 std::unique_ptr<base::Thread> sync_thread, | 30 std::unique_ptr<base::Thread> sync_thread, |
| 31 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, | 31 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, |
| 32 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread, | 32 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread, |
| 33 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, | 33 const WeakHandle<JsEventHandler>& event_handler, |
| 34 const GURL& service_url, | 34 const GURL& service_url, |
| 35 const std::string& sync_user_agent, | 35 const std::string& sync_user_agent, |
| 36 const syncer::SyncCredentials& credentials, | 36 const SyncCredentials& credentials, |
| 37 bool delete_sync_data_folder, | 37 bool delete_sync_data_folder, |
| 38 std::unique_ptr<syncer::SyncManagerFactory> sync_manager_factory, | 38 std::unique_ptr<SyncManagerFactory> sync_manager_factory, |
| 39 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>& | 39 const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler, |
| 40 unrecoverable_error_handler, | |
| 41 const base::Closure& report_unrecoverable_error_function, | 40 const base::Closure& report_unrecoverable_error_function, |
| 42 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter, | 41 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter, |
| 43 std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState> | 42 std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state) |
| 44 saved_nigori_state) override; | 43 override; |
| 45 | 44 |
| 46 void TriggerRefresh(const syncer::ModelTypeSet& types) override; | 45 void TriggerRefresh(const ModelTypeSet& types) override; |
| 47 | 46 |
| 48 void UpdateCredentials(const syncer::SyncCredentials& credentials) override; | 47 void UpdateCredentials(const SyncCredentials& credentials) override; |
| 49 | 48 |
| 50 void StartSyncingWithServer() override; | 49 void StartSyncingWithServer() override; |
| 51 | 50 |
| 52 void SetEncryptionPassphrase(const std::string& passphrase, | 51 void SetEncryptionPassphrase(const std::string& passphrase, |
| 53 bool is_explicit) override; | 52 bool is_explicit) override; |
| 54 | 53 |
| 55 bool SetDecryptionPassphrase(const std::string& passphrase) override; | 54 bool SetDecryptionPassphrase(const std::string& passphrase) override; |
| 56 | 55 |
| 57 void StopSyncingForShutdown() override; | 56 void StopSyncingForShutdown() override; |
| 58 | 57 |
| 59 std::unique_ptr<base::Thread> Shutdown( | 58 std::unique_ptr<base::Thread> Shutdown(ShutdownReason reason) override; |
| 60 syncer::ShutdownReason reason) override; | |
| 61 | 59 |
| 62 void UnregisterInvalidationIds() override; | 60 void UnregisterInvalidationIds() override; |
| 63 | 61 |
| 64 syncer::ModelTypeSet ConfigureDataTypes( | 62 ModelTypeSet ConfigureDataTypes( |
| 65 syncer::ConfigureReason reason, | 63 ConfigureReason reason, |
| 66 const DataTypeConfigStateMap& config_state_map, | 64 const DataTypeConfigStateMap& config_state_map, |
| 67 const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>& | 65 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task, |
| 68 ready_task, | |
| 69 const base::Callback<void()>& retry_callback) override; | 66 const base::Callback<void()>& retry_callback) override; |
| 70 | 67 |
| 71 void EnableEncryptEverything() override; | 68 void EnableEncryptEverything() override; |
| 72 | 69 |
| 73 void ActivateDirectoryDataType( | 70 void ActivateDirectoryDataType(ModelType type, |
| 74 syncer::ModelType type, | 71 ModelSafeGroup group, |
| 75 syncer::ModelSafeGroup group, | 72 ChangeProcessor* change_processor) override; |
| 76 sync_driver::ChangeProcessor* change_processor) override; | 73 void DeactivateDirectoryDataType(ModelType type) override; |
| 77 void DeactivateDirectoryDataType(syncer::ModelType type) override; | |
| 78 | 74 |
| 79 void ActivateNonBlockingDataType( | 75 void ActivateNonBlockingDataType(ModelType type, |
| 80 syncer::ModelType type, | 76 std::unique_ptr<ActivationContext>) override; |
| 81 std::unique_ptr<syncer_v2::ActivationContext>) override; | 77 void DeactivateNonBlockingDataType(ModelType type) override; |
| 82 void DeactivateNonBlockingDataType(syncer::ModelType type) override; | |
| 83 | 78 |
| 84 syncer::UserShare* GetUserShare() const override; | 79 UserShare* GetUserShare() const override; |
| 85 | 80 |
| 86 Status GetDetailedStatus() override; | 81 Status GetDetailedStatus() override; |
| 87 | 82 |
| 88 syncer::SyncCycleSnapshot GetLastCycleSnapshot() const override; | 83 SyncCycleSnapshot GetLastCycleSnapshot() const override; |
| 89 | 84 |
| 90 bool HasUnsyncedItems() const override; | 85 bool HasUnsyncedItems() const override; |
| 91 | 86 |
| 92 bool IsNigoriEnabled() const override; | 87 bool IsNigoriEnabled() const override; |
| 93 | 88 |
| 94 syncer::PassphraseType GetPassphraseType() const override; | 89 PassphraseType GetPassphraseType() const override; |
| 95 | 90 |
| 96 base::Time GetExplicitPassphraseTime() const override; | 91 base::Time GetExplicitPassphraseTime() const override; |
| 97 | 92 |
| 98 bool IsCryptographerReady( | 93 bool IsCryptographerReady(const BaseTransaction* trans) const override; |
| 99 const syncer::BaseTransaction* trans) const override; | |
| 100 | 94 |
| 101 void GetModelSafeRoutingInfo( | 95 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) const override; |
| 102 syncer::ModelSafeRoutingInfo* out) const override; | |
| 103 | 96 |
| 104 void FlushDirectory() const override; | 97 void FlushDirectory() const override; |
| 105 | 98 |
| 106 void RequestBufferedProtocolEventsAndEnableForwarding() override; | 99 void RequestBufferedProtocolEventsAndEnableForwarding() override; |
| 107 void DisableProtocolEventForwarding() override; | 100 void DisableProtocolEventForwarding() override; |
| 108 | 101 |
| 109 void EnableDirectoryTypeDebugInfoForwarding() override; | 102 void EnableDirectoryTypeDebugInfoForwarding() override; |
| 110 void DisableDirectoryTypeDebugInfoForwarding() override; | 103 void DisableDirectoryTypeDebugInfoForwarding() override; |
| 111 | 104 |
| 112 base::MessageLoop* GetSyncLoopForTesting() override; | 105 base::MessageLoop* GetSyncLoopForTesting() override; |
| 113 | 106 |
| 114 void RefreshTypesForTest(syncer::ModelTypeSet types) override; | 107 void RefreshTypesForTest(ModelTypeSet types) override; |
| 115 | 108 |
| 116 void ClearServerData( | 109 void ClearServerData( |
| 117 const syncer::SyncManager::ClearServerDataCallback& callback) override; | 110 const SyncManager::ClearServerDataCallback& callback) override; |
| 118 | 111 |
| 119 void OnCookieJarChanged(bool account_mismatch, bool empty_jar) override; | 112 void OnCookieJarChanged(bool account_mismatch, bool empty_jar) override; |
| 120 | 113 |
| 121 void set_fail_initial_download(bool should_fail); | 114 void set_fail_initial_download(bool should_fail); |
| 122 | 115 |
| 123 private: | 116 private: |
| 124 bool fail_initial_download_; | 117 bool fail_initial_download_; |
| 125 }; | 118 }; |
| 126 | 119 |
| 127 } // namespace browser_sync | 120 } // namespace syncer |
| 128 | 121 |
| 129 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_MOCK_H_ | 122 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_MOCK_H_ |
| OLD | NEW |