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.
5 #include "chrome/browser/sync/glue/sync_backend_host_mock.h"
7 #include "chrome/browser/sync/glue/sync_frontend.h"
9 namespace browser_sync
{
11 SyncBackendHostMock::SyncBackendHostMock() : fail_initial_download_(false) {}
12 SyncBackendHostMock::~SyncBackendHostMock() {}
14 void 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_
);
32 void SyncBackendHostMock::UpdateCredentials(
33 const syncer::SyncCredentials
& credentials
) {}
35 void SyncBackendHostMock::StartSyncingWithServer() {}
37 void SyncBackendHostMock::SetEncryptionPassphrase(
38 const std::string
& passphrase
,
41 bool SyncBackendHostMock::SetDecryptionPassphrase(
42 const std::string
& passphrase
) {
46 void SyncBackendHostMock::StopSyncingForShutdown() {}
48 scoped_ptr
<base::Thread
> SyncBackendHostMock::Shutdown(ShutdownOption option
) {
49 return scoped_ptr
<base::Thread
>();
52 void SyncBackendHostMock::UnregisterInvalidationIds() {}
54 void 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
) {}
61 void SyncBackendHostMock::EnableEncryptEverything() {}
63 void SyncBackendHostMock::ActivateDataType(
64 syncer::ModelType type
, syncer::ModelSafeGroup group
,
65 ChangeProcessor
* change_processor
) {}
66 void SyncBackendHostMock::DeactivateDataType(syncer::ModelType type
) {}
68 syncer::UserShare
* SyncBackendHostMock::GetUserShare() const {
72 SyncBackendHost::Status
SyncBackendHostMock::GetDetailedStatus() {
73 return SyncBackendHost::Status();
76 syncer::sessions::SyncSessionSnapshot
77 SyncBackendHostMock::GetLastSessionSnapshot() const {
78 return syncer::sessions::SyncSessionSnapshot();
81 bool SyncBackendHostMock::HasUnsyncedItems() const {
85 bool SyncBackendHostMock::IsNigoriEnabled() const {
89 syncer::PassphraseType
SyncBackendHostMock::GetPassphraseType() const {
90 return syncer::IMPLICIT_PASSPHRASE
;
93 base::Time
SyncBackendHostMock::GetExplicitPassphraseTime() const {
97 bool SyncBackendHostMock::IsCryptographerReady(
98 const syncer::BaseTransaction
* trans
) const {
102 void SyncBackendHostMock::GetModelSafeRoutingInfo(
103 syncer::ModelSafeRoutingInfo
* out
) const {}
105 SyncedDeviceTracker
* SyncBackendHostMock::GetSyncedDeviceTracker() const {
109 base::MessageLoop
* SyncBackendHostMock::GetSyncLoopForTesting() {
113 void SyncBackendHostMock::set_fail_initial_download(bool should_fail
) {
114 fail_initial_download_
= should_fail
;
117 } // namespace browser_sync