| 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 #include "components/sync_driver/glue/sync_backend_host_mock.h" | 5 #include "components/sync/driver/glue/sync_backend_host_mock.h" |
| 6 | 6 |
| 7 #include "components/sync/core/activation_context.h" | 7 #include "components/sync/core/activation_context.h" |
| 8 #include "components/sync_driver/sync_frontend.h" | 8 #include "components/sync/driver/sync_frontend.h" |
| 9 | 9 |
| 10 namespace browser_sync { | 10 namespace browser_sync { |
| 11 | 11 |
| 12 const char kTestCacheGuid[] = "test-guid"; | 12 const char kTestCacheGuid[] = "test-guid"; |
| 13 | 13 |
| 14 SyncBackendHostMock::SyncBackendHostMock() : fail_initial_download_(false) {} | 14 SyncBackendHostMock::SyncBackendHostMock() : fail_initial_download_(false) {} |
| 15 SyncBackendHostMock::~SyncBackendHostMock() {} | 15 SyncBackendHostMock::~SyncBackendHostMock() {} |
| 16 | 16 |
| 17 void SyncBackendHostMock::Initialize( | 17 void SyncBackendHostMock::Initialize( |
| 18 sync_driver::SyncFrontend* frontend, | 18 sync_driver::SyncFrontend* frontend, |
| 19 std::unique_ptr<base::Thread> sync_thread, | 19 std::unique_ptr<base::Thread> sync_thread, |
| 20 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, | 20 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, |
| 21 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread, | 21 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread, |
| 22 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, | 22 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, |
| 23 const GURL& service_url, | 23 const GURL& service_url, |
| 24 const std::string& sync_user_agent, | 24 const std::string& sync_user_agent, |
| 25 const syncer::SyncCredentials& credentials, | 25 const syncer::SyncCredentials& credentials, |
| 26 bool delete_sync_data_folder, | 26 bool delete_sync_data_folder, |
| 27 std::unique_ptr<syncer::SyncManagerFactory> sync_manager_factory, | 27 std::unique_ptr<syncer::SyncManagerFactory> sync_manager_factory, |
| 28 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>& | 28 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>& |
| 29 unrecoverable_error_handler, | 29 unrecoverable_error_handler, |
| 30 const base::Closure& report_unrecoverable_error_function, | 30 const base::Closure& report_unrecoverable_error_function, |
| 31 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter, | 31 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter, |
| 32 std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState> | 32 std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState> |
| 33 saved_nigori_state) { | 33 saved_nigori_state) { |
| 34 frontend->OnBackendInitialized( | 34 frontend->OnBackendInitialized( |
| 35 syncer::WeakHandle<syncer::JsBackend>(), | 35 syncer::WeakHandle<syncer::JsBackend>(), |
| 36 syncer::WeakHandle<syncer::DataTypeDebugInfoListener>(), | 36 syncer::WeakHandle<syncer::DataTypeDebugInfoListener>(), kTestCacheGuid, |
| 37 kTestCacheGuid, | |
| 38 !fail_initial_download_); | 37 !fail_initial_download_); |
| 39 } | 38 } |
| 40 | 39 |
| 41 void SyncBackendHostMock::TriggerRefresh(const syncer::ModelTypeSet& types) {} | 40 void SyncBackendHostMock::TriggerRefresh(const syncer::ModelTypeSet& types) {} |
| 42 | 41 |
| 43 void SyncBackendHostMock::UpdateCredentials( | 42 void SyncBackendHostMock::UpdateCredentials( |
| 44 const syncer::SyncCredentials& credentials) {} | 43 const syncer::SyncCredentials& credentials) {} |
| 45 | 44 |
| 46 void SyncBackendHostMock::StartSyncingWithServer() {} | 45 void SyncBackendHostMock::StartSyncingWithServer() {} |
| 47 | 46 |
| 48 void SyncBackendHostMock::SetEncryptionPassphrase( | 47 void SyncBackendHostMock::SetEncryptionPassphrase(const std::string& passphrase, |
| 49 const std::string& passphrase, | 48 bool is_explicit) {} |
| 50 bool is_explicit) {} | |
| 51 | 49 |
| 52 bool SyncBackendHostMock::SetDecryptionPassphrase( | 50 bool SyncBackendHostMock::SetDecryptionPassphrase( |
| 53 const std::string& passphrase) { | 51 const std::string& passphrase) { |
| 54 return false; | 52 return false; |
| 55 } | 53 } |
| 56 | 54 |
| 57 void SyncBackendHostMock::StopSyncingForShutdown() {} | 55 void SyncBackendHostMock::StopSyncingForShutdown() {} |
| 58 | 56 |
| 59 std::unique_ptr<base::Thread> SyncBackendHostMock::Shutdown( | 57 std::unique_ptr<base::Thread> SyncBackendHostMock::Shutdown( |
| 60 syncer::ShutdownReason reason) { | 58 syncer::ShutdownReason reason) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 89 | 87 |
| 90 syncer::UserShare* SyncBackendHostMock::GetUserShare() const { | 88 syncer::UserShare* SyncBackendHostMock::GetUserShare() const { |
| 91 return NULL; | 89 return NULL; |
| 92 } | 90 } |
| 93 | 91 |
| 94 SyncBackendHost::Status SyncBackendHostMock::GetDetailedStatus() { | 92 SyncBackendHost::Status SyncBackendHostMock::GetDetailedStatus() { |
| 95 return SyncBackendHost::Status(); | 93 return SyncBackendHost::Status(); |
| 96 } | 94 } |
| 97 | 95 |
| 98 syncer::sessions::SyncSessionSnapshot | 96 syncer::sessions::SyncSessionSnapshot |
| 99 SyncBackendHostMock::GetLastSessionSnapshot() const { | 97 SyncBackendHostMock::GetLastSessionSnapshot() const { |
| 100 return syncer::sessions::SyncSessionSnapshot(); | 98 return syncer::sessions::SyncSessionSnapshot(); |
| 101 } | 99 } |
| 102 | 100 |
| 103 bool SyncBackendHostMock::HasUnsyncedItems() const { | 101 bool SyncBackendHostMock::HasUnsyncedItems() const { |
| 104 return false; | 102 return false; |
| 105 } | 103 } |
| 106 | 104 |
| 107 bool SyncBackendHostMock::IsNigoriEnabled() const { | 105 bool SyncBackendHostMock::IsNigoriEnabled() const { |
| 108 return true; | 106 return true; |
| 109 } | 107 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 136 | 134 |
| 137 void SyncBackendHostMock::DisableProtocolEventForwarding() {} | 135 void SyncBackendHostMock::DisableProtocolEventForwarding() {} |
| 138 | 136 |
| 139 void SyncBackendHostMock::EnableDirectoryTypeDebugInfoForwarding() {} | 137 void SyncBackendHostMock::EnableDirectoryTypeDebugInfoForwarding() {} |
| 140 | 138 |
| 141 void SyncBackendHostMock::DisableDirectoryTypeDebugInfoForwarding() {} | 139 void SyncBackendHostMock::DisableDirectoryTypeDebugInfoForwarding() {} |
| 142 | 140 |
| 143 void SyncBackendHostMock::GetAllNodesForTypes( | 141 void SyncBackendHostMock::GetAllNodesForTypes( |
| 144 syncer::ModelTypeSet types, | 142 syncer::ModelTypeSet types, |
| 145 base::Callback<void(const std::vector<syncer::ModelType>& type, | 143 base::Callback<void(const std::vector<syncer::ModelType>& type, |
| 146 ScopedVector<base::ListValue>) > callback) {} | 144 ScopedVector<base::ListValue>)> callback) {} |
| 147 | 145 |
| 148 void SyncBackendHostMock::set_fail_initial_download(bool should_fail) { | 146 void SyncBackendHostMock::set_fail_initial_download(bool should_fail) { |
| 149 fail_initial_download_ = should_fail; | 147 fail_initial_download_ = should_fail; |
| 150 } | 148 } |
| 151 | 149 |
| 152 void SyncBackendHostMock::ClearServerData( | 150 void SyncBackendHostMock::ClearServerData( |
| 153 const syncer::SyncManager::ClearServerDataCallback& callback) { | 151 const syncer::SyncManager::ClearServerDataCallback& callback) { |
| 154 callback.Run(); | 152 callback.Run(); |
| 155 } | 153 } |
| 156 | 154 |
| 157 void SyncBackendHostMock::OnCookieJarChanged(bool account_mismatch, | 155 void SyncBackendHostMock::OnCookieJarChanged(bool account_mismatch, |
| 158 bool empty_jar) {} | 156 bool empty_jar) {} |
| 159 | 157 |
| 160 } // namespace browser_sync | 158 } // namespace browser_sync |
| OLD | NEW |