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#include "chrome/browser/sync/glue/sync_backend_host_mock.h" 6 7#include "chrome/browser/sync/glue/sync_frontend.h" 8 9namespace browser_sync { 10 11SyncBackendHostMock::SyncBackendHostMock() : fail_initial_download_(false) {} 12SyncBackendHostMock::~SyncBackendHostMock() {} 13 14void SyncBackendHostMock::Initialize( 15 SyncFrontend* frontend, 16 scoped_ptr<base::Thread> sync_thread, 17 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, 18 const GURL& service_url, 19 const syncer::SyncCredentials& credentials, 20 bool delete_sync_data_folder, 21 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, 22 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler, 23 syncer::ReportUnrecoverableErrorFunction 24 report_unrecoverable_error_function, 25 syncer::NetworkResources* network_resources) { 26 frontend->OnBackendInitialized( 27 syncer::WeakHandle<syncer::JsBackend>(), 28 syncer::WeakHandle<syncer::DataTypeDebugInfoListener>(), 29 !fail_initial_download_); 30} 31 32void SyncBackendHostMock::UpdateCredentials( 33 const syncer::SyncCredentials& credentials) {} 34 35void SyncBackendHostMock::StartSyncingWithServer() {} 36 37void SyncBackendHostMock::SetEncryptionPassphrase( 38 const std::string& passphrase, 39 bool is_explicit) {} 40 41bool SyncBackendHostMock::SetDecryptionPassphrase( 42 const std::string& passphrase) { 43 return false; 44} 45 46void SyncBackendHostMock::StopSyncingForShutdown() {} 47 48scoped_ptr<base::Thread> SyncBackendHostMock::Shutdown(ShutdownOption option) { 49 return scoped_ptr<base::Thread>(); 50} 51 52void SyncBackendHostMock::UnregisterInvalidationIds() {} 53 54void SyncBackendHostMock::ConfigureDataTypes( 55 syncer::ConfigureReason reason, 56 const DataTypeConfigStateMap& config_state_map, 57 const base::Callback<void(syncer::ModelTypeSet, 58 syncer::ModelTypeSet)>& ready_task, 59 const base::Callback<void()>& retry_callback) {} 60 61void SyncBackendHostMock::EnableEncryptEverything() {} 62 63void SyncBackendHostMock::ActivateDataType( 64 syncer::ModelType type, syncer::ModelSafeGroup group, 65 ChangeProcessor* change_processor) {} 66void SyncBackendHostMock::DeactivateDataType(syncer::ModelType type) {} 67 68syncer::UserShare* SyncBackendHostMock::GetUserShare() const { 69 return NULL; 70} 71 72SyncBackendHost::Status SyncBackendHostMock::GetDetailedStatus() { 73 return SyncBackendHost::Status(); 74} 75 76syncer::sessions::SyncSessionSnapshot 77 SyncBackendHostMock::GetLastSessionSnapshot() const { 78 return syncer::sessions::SyncSessionSnapshot(); 79} 80 81bool SyncBackendHostMock::HasUnsyncedItems() const { 82 return false; 83} 84 85bool SyncBackendHostMock::IsNigoriEnabled() const { 86 return false; 87} 88 89syncer::PassphraseType SyncBackendHostMock::GetPassphraseType() const { 90 return syncer::IMPLICIT_PASSPHRASE; 91} 92 93base::Time SyncBackendHostMock::GetExplicitPassphraseTime() const { 94 return base::Time(); 95} 96 97bool SyncBackendHostMock::IsCryptographerReady( 98 const syncer::BaseTransaction* trans) const { 99 return false; 100} 101 102void SyncBackendHostMock::GetModelSafeRoutingInfo( 103 syncer::ModelSafeRoutingInfo* out) const {} 104 105SyncedDeviceTracker* SyncBackendHostMock::GetSyncedDeviceTracker() const { 106 return NULL; 107} 108 109base::MessageLoop* SyncBackendHostMock::GetSyncLoopForTesting() { 110 return NULL; 111} 112 113void SyncBackendHostMock::set_fail_initial_download(bool should_fail) { 114 fail_initial_download_ = should_fail; 115} 116 117} // namespace browser_sync 118 119