| 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 CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_MOCK_H_ | |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_MOCK_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "chrome/browser/sync/glue/sync_backend_host.h" | |
| 13 #include "sync/internal_api/public/util/weak_handle.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 scoped_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 scoped_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 scoped_ptr<syncer::SyncEncryptionHandler::NigoriState> saved_nigori_state) | |
| 44 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 scoped_ptr<base::Thread> Shutdown(syncer::ShutdownReason reason) override; | |
| 60 | |
| 61 void UnregisterInvalidationIds() override; | |
| 62 | |
| 63 syncer::ModelTypeSet ConfigureDataTypes( | |
| 64 syncer::ConfigureReason reason, | |
| 65 const DataTypeConfigStateMap& config_state_map, | |
| 66 const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>& | |
| 67 ready_task, | |
| 68 const base::Callback<void()>& retry_callback) override; | |
| 69 | |
| 70 void EnableEncryptEverything() override; | |
| 71 | |
| 72 void ActivateDirectoryDataType( | |
| 73 syncer::ModelType type, | |
| 74 syncer::ModelSafeGroup group, | |
| 75 sync_driver::ChangeProcessor* change_processor) override; | |
| 76 void DeactivateDirectoryDataType(syncer::ModelType type) override; | |
| 77 | |
| 78 void ActivateNonBlockingDataType( | |
| 79 syncer::ModelType type, | |
| 80 scoped_ptr<syncer_v2::ActivationContext>) override; | |
| 81 void DeactivateNonBlockingDataType(syncer::ModelType type) override; | |
| 82 | |
| 83 syncer::UserShare* GetUserShare() const override; | |
| 84 | |
| 85 Status GetDetailedStatus() override; | |
| 86 | |
| 87 syncer::sessions::SyncSessionSnapshot GetLastSessionSnapshot() const override; | |
| 88 | |
| 89 bool HasUnsyncedItems() const override; | |
| 90 | |
| 91 bool IsNigoriEnabled() const override; | |
| 92 | |
| 93 syncer::PassphraseType GetPassphraseType() const override; | |
| 94 | |
| 95 base::Time GetExplicitPassphraseTime() const override; | |
| 96 | |
| 97 bool IsCryptographerReady( | |
| 98 const syncer::BaseTransaction* trans) const override; | |
| 99 | |
| 100 void GetModelSafeRoutingInfo( | |
| 101 syncer::ModelSafeRoutingInfo* out) const override; | |
| 102 | |
| 103 void FlushDirectory() const override; | |
| 104 | |
| 105 void RequestBufferedProtocolEventsAndEnableForwarding() override; | |
| 106 void DisableProtocolEventForwarding() override; | |
| 107 | |
| 108 void EnableDirectoryTypeDebugInfoForwarding() override; | |
| 109 void DisableDirectoryTypeDebugInfoForwarding() override; | |
| 110 | |
| 111 void GetAllNodesForTypes( | |
| 112 syncer::ModelTypeSet types, | |
| 113 base::Callback<void(const std::vector<syncer::ModelType>& type, | |
| 114 ScopedVector<base::ListValue>)> callback) override; | |
| 115 | |
| 116 base::MessageLoop* GetSyncLoopForTesting() override; | |
| 117 | |
| 118 void RefreshTypesForTest(syncer::ModelTypeSet types) override; | |
| 119 | |
| 120 void ClearServerData( | |
| 121 const syncer::SyncManager::ClearServerDataCallback& callback) override; | |
| 122 | |
| 123 void set_fail_initial_download(bool should_fail); | |
| 124 | |
| 125 private: | |
| 126 bool fail_initial_download_; | |
| 127 }; | |
| 128 | |
| 129 } // namespace browser_sync | |
| 130 | |
| 131 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_MOCK_H_ | |
| OLD | NEW |