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