| 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 syncer { | 15 namespace browser_sync { |
| 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 SyncFrontend* frontend, | 29 sync_driver::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 WeakHandle<JsEventHandler>& event_handler, | 33 const syncer::WeakHandle<syncer::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 SyncCredentials& credentials, | 36 const syncer::SyncCredentials& credentials, |
| 37 bool delete_sync_data_folder, | 37 bool delete_sync_data_folder, |
| 38 std::unique_ptr<SyncManagerFactory> sync_manager_factory, | 38 std::unique_ptr<syncer::SyncManagerFactory> sync_manager_factory, |
| 39 const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler, | 39 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>& |
| 40 unrecoverable_error_handler, |
| 40 const base::Closure& report_unrecoverable_error_function, | 41 const base::Closure& report_unrecoverable_error_function, |
| 41 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter, | 42 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter, |
| 42 std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state) | 43 std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState> |
| 43 override; | 44 saved_nigori_state) override; |
| 44 | 45 |
| 45 void TriggerRefresh(const ModelTypeSet& types) override; | 46 void TriggerRefresh(const syncer::ModelTypeSet& types) override; |
| 46 | 47 |
| 47 void UpdateCredentials(const SyncCredentials& credentials) override; | 48 void UpdateCredentials(const syncer::SyncCredentials& credentials) override; |
| 48 | 49 |
| 49 void StartSyncingWithServer() override; | 50 void StartSyncingWithServer() override; |
| 50 | 51 |
| 51 void SetEncryptionPassphrase(const std::string& passphrase, | 52 void SetEncryptionPassphrase(const std::string& passphrase, |
| 52 bool is_explicit) override; | 53 bool is_explicit) override; |
| 53 | 54 |
| 54 bool SetDecryptionPassphrase(const std::string& passphrase) override; | 55 bool SetDecryptionPassphrase(const std::string& passphrase) override; |
| 55 | 56 |
| 56 void StopSyncingForShutdown() override; | 57 void StopSyncingForShutdown() override; |
| 57 | 58 |
| 58 std::unique_ptr<base::Thread> Shutdown(ShutdownReason reason) override; | 59 std::unique_ptr<base::Thread> Shutdown( |
| 60 syncer::ShutdownReason reason) override; |
| 59 | 61 |
| 60 void UnregisterInvalidationIds() override; | 62 void UnregisterInvalidationIds() override; |
| 61 | 63 |
| 62 ModelTypeSet ConfigureDataTypes( | 64 syncer::ModelTypeSet ConfigureDataTypes( |
| 63 ConfigureReason reason, | 65 syncer::ConfigureReason reason, |
| 64 const DataTypeConfigStateMap& config_state_map, | 66 const DataTypeConfigStateMap& config_state_map, |
| 65 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task, | 67 const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>& |
| 68 ready_task, |
| 66 const base::Callback<void()>& retry_callback) override; | 69 const base::Callback<void()>& retry_callback) override; |
| 67 | 70 |
| 68 void EnableEncryptEverything() override; | 71 void EnableEncryptEverything() override; |
| 69 | 72 |
| 70 void ActivateDirectoryDataType(ModelType type, | 73 void ActivateDirectoryDataType( |
| 71 ModelSafeGroup group, | 74 syncer::ModelType type, |
| 72 ChangeProcessor* change_processor) override; | 75 syncer::ModelSafeGroup group, |
| 73 void DeactivateDirectoryDataType(ModelType type) override; | 76 sync_driver::ChangeProcessor* change_processor) override; |
| 77 void DeactivateDirectoryDataType(syncer::ModelType type) override; |
| 74 | 78 |
| 75 void ActivateNonBlockingDataType(ModelType type, | 79 void ActivateNonBlockingDataType( |
| 76 std::unique_ptr<ActivationContext>) override; | 80 syncer::ModelType type, |
| 77 void DeactivateNonBlockingDataType(ModelType type) override; | 81 std::unique_ptr<syncer_v2::ActivationContext>) override; |
| 82 void DeactivateNonBlockingDataType(syncer::ModelType type) override; |
| 78 | 83 |
| 79 UserShare* GetUserShare() const override; | 84 syncer::UserShare* GetUserShare() const override; |
| 80 | 85 |
| 81 Status GetDetailedStatus() override; | 86 Status GetDetailedStatus() override; |
| 82 | 87 |
| 83 SyncCycleSnapshot GetLastCycleSnapshot() const override; | 88 syncer::SyncCycleSnapshot GetLastCycleSnapshot() const override; |
| 84 | 89 |
| 85 bool HasUnsyncedItems() const override; | 90 bool HasUnsyncedItems() const override; |
| 86 | 91 |
| 87 bool IsNigoriEnabled() const override; | 92 bool IsNigoriEnabled() const override; |
| 88 | 93 |
| 89 PassphraseType GetPassphraseType() const override; | 94 syncer::PassphraseType GetPassphraseType() const override; |
| 90 | 95 |
| 91 base::Time GetExplicitPassphraseTime() const override; | 96 base::Time GetExplicitPassphraseTime() const override; |
| 92 | 97 |
| 93 bool IsCryptographerReady(const BaseTransaction* trans) const override; | 98 bool IsCryptographerReady( |
| 99 const syncer::BaseTransaction* trans) const override; |
| 94 | 100 |
| 95 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) const override; | 101 void GetModelSafeRoutingInfo( |
| 102 syncer::ModelSafeRoutingInfo* out) const override; |
| 96 | 103 |
| 97 void FlushDirectory() const override; | 104 void FlushDirectory() const override; |
| 98 | 105 |
| 99 void RequestBufferedProtocolEventsAndEnableForwarding() override; | 106 void RequestBufferedProtocolEventsAndEnableForwarding() override; |
| 100 void DisableProtocolEventForwarding() override; | 107 void DisableProtocolEventForwarding() override; |
| 101 | 108 |
| 102 void EnableDirectoryTypeDebugInfoForwarding() override; | 109 void EnableDirectoryTypeDebugInfoForwarding() override; |
| 103 void DisableDirectoryTypeDebugInfoForwarding() override; | 110 void DisableDirectoryTypeDebugInfoForwarding() override; |
| 104 | 111 |
| 105 base::MessageLoop* GetSyncLoopForTesting() override; | 112 base::MessageLoop* GetSyncLoopForTesting() override; |
| 106 | 113 |
| 107 void RefreshTypesForTest(ModelTypeSet types) override; | 114 void RefreshTypesForTest(syncer::ModelTypeSet types) override; |
| 108 | 115 |
| 109 void ClearServerData( | 116 void ClearServerData( |
| 110 const SyncManager::ClearServerDataCallback& callback) override; | 117 const syncer::SyncManager::ClearServerDataCallback& callback) override; |
| 111 | 118 |
| 112 void OnCookieJarChanged(bool account_mismatch, bool empty_jar) override; | 119 void OnCookieJarChanged(bool account_mismatch, bool empty_jar) override; |
| 113 | 120 |
| 114 void set_fail_initial_download(bool should_fail); | 121 void set_fail_initial_download(bool should_fail); |
| 115 | 122 |
| 116 private: | 123 private: |
| 117 bool fail_initial_download_; | 124 bool fail_initial_download_; |
| 118 }; | 125 }; |
| 119 | 126 |
| 120 } // namespace syncer | 127 } // namespace browser_sync |
| 121 | 128 |
| 122 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_MOCK_H_ | 129 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_MOCK_H_ |
| OLD | NEW |