| 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 CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_MOCK_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_MOCK_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_MOCK_H_ | 6 #define CHROME_BROWSER_SYNC_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 "chrome/browser/sync/glue/sync_backend_host.h" | 12 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 13 #include "sync/internal_api/public/util/weak_handle.h" | 13 #include "sync/internal_api/public/util/weak_handle.h" |
| 14 | 14 |
| 15 namespace browser_sync { | 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 virtual ~SyncBackendHostMock(); | 26 ~SyncBackendHostMock() override; |
| 27 | 27 |
| 28 virtual void Initialize( | 28 void Initialize( |
| 29 sync_driver::SyncFrontend* frontend, | 29 sync_driver::SyncFrontend* frontend, |
| 30 scoped_ptr<base::Thread> sync_thread, | 30 scoped_ptr<base::Thread> sync_thread, |
| 31 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, | 31 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, |
| 32 const GURL& service_url, | 32 const GURL& service_url, |
| 33 const syncer::SyncCredentials& credentials, | 33 const syncer::SyncCredentials& credentials, |
| 34 bool delete_sync_data_folder, | 34 bool delete_sync_data_folder, |
| 35 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, | 35 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, |
| 36 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler, | 36 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler, |
| 37 syncer::ReportUnrecoverableErrorFunction | 37 syncer::ReportUnrecoverableErrorFunction |
| 38 report_unrecoverable_error_function, | 38 report_unrecoverable_error_function, |
| 39 syncer::NetworkResources* network_resources) override; | 39 syncer::NetworkResources* network_resources) override; |
| 40 | 40 |
| 41 virtual void UpdateCredentials( | 41 void UpdateCredentials(const syncer::SyncCredentials& credentials) override; |
| 42 const syncer::SyncCredentials& credentials) override; | |
| 43 | 42 |
| 44 virtual void StartSyncingWithServer() override; | 43 void StartSyncingWithServer() override; |
| 45 | 44 |
| 46 virtual void SetEncryptionPassphrase( | 45 void SetEncryptionPassphrase(const std::string& passphrase, |
| 47 const std::string& passphrase, | 46 bool is_explicit) override; |
| 48 bool is_explicit) override; | |
| 49 | 47 |
| 50 virtual bool SetDecryptionPassphrase( | 48 bool SetDecryptionPassphrase(const std::string& passphrase) override; |
| 51 const std::string& passphrase) override; | |
| 52 | 49 |
| 53 virtual void StopSyncingForShutdown() override; | 50 void StopSyncingForShutdown() override; |
| 54 | 51 |
| 55 virtual scoped_ptr<base::Thread> Shutdown(syncer::ShutdownReason reason) | 52 scoped_ptr<base::Thread> Shutdown(syncer::ShutdownReason reason) override; |
| 56 override; | |
| 57 | 53 |
| 58 virtual void UnregisterInvalidationIds() override; | 54 void UnregisterInvalidationIds() override; |
| 59 | 55 |
| 60 virtual void ConfigureDataTypes( | 56 void ConfigureDataTypes( |
| 61 syncer::ConfigureReason reason, | 57 syncer::ConfigureReason reason, |
| 62 const DataTypeConfigStateMap& config_state_map, | 58 const DataTypeConfigStateMap& config_state_map, |
| 63 const base::Callback<void(syncer::ModelTypeSet, | 59 const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>& |
| 64 syncer::ModelTypeSet)>& ready_task, | 60 ready_task, |
| 65 const base::Callback<void()>& retry_callback) override; | 61 const base::Callback<void()>& retry_callback) override; |
| 66 | 62 |
| 67 virtual void EnableEncryptEverything() override; | 63 void EnableEncryptEverything() override; |
| 68 | 64 |
| 69 virtual void ActivateDataType( | 65 void ActivateDataType( |
| 70 syncer::ModelType type, syncer::ModelSafeGroup group, | 66 syncer::ModelType type, |
| 67 syncer::ModelSafeGroup group, |
| 71 sync_driver::ChangeProcessor* change_processor) override; | 68 sync_driver::ChangeProcessor* change_processor) override; |
| 72 virtual void DeactivateDataType(syncer::ModelType type) override; | 69 void DeactivateDataType(syncer::ModelType type) override; |
| 73 | 70 |
| 74 virtual syncer::UserShare* GetUserShare() const override; | 71 syncer::UserShare* GetUserShare() const override; |
| 75 | 72 |
| 76 virtual scoped_ptr<syncer::SyncContextProxy> GetSyncContextProxy() override; | 73 scoped_ptr<syncer::SyncContextProxy> GetSyncContextProxy() override; |
| 77 | 74 |
| 78 virtual Status GetDetailedStatus() override; | 75 Status GetDetailedStatus() override; |
| 79 | 76 |
| 80 virtual syncer::sessions::SyncSessionSnapshot | 77 syncer::sessions::SyncSessionSnapshot GetLastSessionSnapshot() const override; |
| 81 GetLastSessionSnapshot() const override; | |
| 82 | 78 |
| 83 virtual bool HasUnsyncedItems() const override; | 79 bool HasUnsyncedItems() const override; |
| 84 | 80 |
| 85 virtual bool IsNigoriEnabled() const override; | 81 bool IsNigoriEnabled() const override; |
| 86 | 82 |
| 87 virtual syncer::PassphraseType GetPassphraseType() const override; | 83 syncer::PassphraseType GetPassphraseType() const override; |
| 88 | 84 |
| 89 virtual base::Time GetExplicitPassphraseTime() const override; | 85 base::Time GetExplicitPassphraseTime() const override; |
| 90 | 86 |
| 91 virtual bool IsCryptographerReady( | 87 bool IsCryptographerReady( |
| 92 const syncer::BaseTransaction* trans) const override; | 88 const syncer::BaseTransaction* trans) const override; |
| 93 | 89 |
| 94 virtual void GetModelSafeRoutingInfo( | 90 void GetModelSafeRoutingInfo( |
| 95 syncer::ModelSafeRoutingInfo* out) const override; | 91 syncer::ModelSafeRoutingInfo* out) const override; |
| 96 | 92 |
| 97 virtual void FlushDirectory() const override; | 93 void FlushDirectory() const override; |
| 98 | 94 |
| 99 virtual void RequestBufferedProtocolEventsAndEnableForwarding() override; | 95 void RequestBufferedProtocolEventsAndEnableForwarding() override; |
| 100 virtual void DisableProtocolEventForwarding() override; | 96 void DisableProtocolEventForwarding() override; |
| 101 | 97 |
| 102 virtual void EnableDirectoryTypeDebugInfoForwarding() override; | 98 void EnableDirectoryTypeDebugInfoForwarding() override; |
| 103 virtual void DisableDirectoryTypeDebugInfoForwarding() override; | 99 void DisableDirectoryTypeDebugInfoForwarding() override; |
| 104 | 100 |
| 105 virtual void GetAllNodesForTypes( | 101 void GetAllNodesForTypes( |
| 106 syncer::ModelTypeSet types, | 102 syncer::ModelTypeSet types, |
| 107 base::Callback<void(const std::vector<syncer::ModelType>& type, | 103 base::Callback<void(const std::vector<syncer::ModelType>& type, |
| 108 ScopedVector<base::ListValue>) > callback) override; | 104 ScopedVector<base::ListValue>)> callback) override; |
| 109 | 105 |
| 110 virtual base::MessageLoop* GetSyncLoopForTesting() override; | 106 base::MessageLoop* GetSyncLoopForTesting() override; |
| 111 | 107 |
| 112 void set_fail_initial_download(bool should_fail); | 108 void set_fail_initial_download(bool should_fail); |
| 113 | 109 |
| 114 private: | 110 private: |
| 115 bool fail_initial_download_; | 111 bool fail_initial_download_; |
| 116 }; | 112 }; |
| 117 | 113 |
| 118 } // namespace browser_sync | 114 } // namespace browser_sync |
| 119 | 115 |
| 120 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_MOCK_H_ | 116 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_MOCK_H_ |
| OLD | NEW |