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 "components/sync_driver/sync_frontend.h"
9 namespace browser_sync
{
11 const char kTestCacheGuid
[] = "test-guid";
13 SyncBackendHostMock::SyncBackendHostMock() : fail_initial_download_(false) {}
14 SyncBackendHostMock::~SyncBackendHostMock() {}
16 void SyncBackendHostMock::Initialize(
17 sync_driver::SyncFrontend
* frontend
,
18 scoped_ptr
<base::Thread
> sync_thread
,
19 const syncer::WeakHandle
<syncer::JsEventHandler
>& event_handler
,
20 const GURL
& service_url
,
21 const syncer::SyncCredentials
& credentials
,
22 bool delete_sync_data_folder
,
23 scoped_ptr
<syncer::SyncManagerFactory
> sync_manager_factory
,
24 scoped_ptr
<syncer::UnrecoverableErrorHandler
> unrecoverable_error_handler
,
25 syncer::ReportUnrecoverableErrorFunction
26 report_unrecoverable_error_function
,
27 syncer::NetworkResources
* network_resources
) {
28 frontend
->OnBackendInitialized(
29 syncer::WeakHandle
<syncer::JsBackend
>(),
30 syncer::WeakHandle
<syncer::DataTypeDebugInfoListener
>(),
32 !fail_initial_download_
);
35 void SyncBackendHostMock::UpdateCredentials(
36 const syncer::SyncCredentials
& credentials
) {}
38 void SyncBackendHostMock::StartSyncingWithServer() {}
40 void SyncBackendHostMock::SetEncryptionPassphrase(
41 const std::string
& passphrase
,
44 bool SyncBackendHostMock::SetDecryptionPassphrase(
45 const std::string
& passphrase
) {
49 void SyncBackendHostMock::StopSyncingForShutdown() {}
51 scoped_ptr
<base::Thread
> SyncBackendHostMock::Shutdown(
52 syncer::ShutdownReason reason
) {
53 return scoped_ptr
<base::Thread
>();
56 void SyncBackendHostMock::UnregisterInvalidationIds() {}
58 void SyncBackendHostMock::ConfigureDataTypes(
59 syncer::ConfigureReason reason
,
60 const DataTypeConfigStateMap
& config_state_map
,
61 const base::Callback
<void(syncer::ModelTypeSet
,
62 syncer::ModelTypeSet
)>& ready_task
,
63 const base::Callback
<void()>& retry_callback
) {}
65 void SyncBackendHostMock::EnableEncryptEverything() {}
67 void SyncBackendHostMock::ActivateDataType(
68 syncer::ModelType type
, syncer::ModelSafeGroup group
,
69 sync_driver::ChangeProcessor
* change_processor
) {}
70 void SyncBackendHostMock::DeactivateDataType(syncer::ModelType type
) {}
72 syncer::UserShare
* SyncBackendHostMock::GetUserShare() const {
76 scoped_ptr
<syncer::SyncContextProxy
>
77 SyncBackendHostMock::GetSyncContextProxy() {
78 return scoped_ptr
<syncer::SyncContextProxy
>();
81 SyncBackendHost::Status
SyncBackendHostMock::GetDetailedStatus() {
82 return SyncBackendHost::Status();
85 syncer::sessions::SyncSessionSnapshot
86 SyncBackendHostMock::GetLastSessionSnapshot() const {
87 return syncer::sessions::SyncSessionSnapshot();
90 bool SyncBackendHostMock::HasUnsyncedItems() const {
94 bool SyncBackendHostMock::IsNigoriEnabled() const {
98 syncer::PassphraseType
SyncBackendHostMock::GetPassphraseType() const {
99 return syncer::IMPLICIT_PASSPHRASE
;
102 base::Time
SyncBackendHostMock::GetExplicitPassphraseTime() const {
106 bool SyncBackendHostMock::IsCryptographerReady(
107 const syncer::BaseTransaction
* trans
) const {
111 void SyncBackendHostMock::GetModelSafeRoutingInfo(
112 syncer::ModelSafeRoutingInfo
* out
) const {}
114 void SyncBackendHostMock::FlushDirectory() const {}
116 base::MessageLoop
* SyncBackendHostMock::GetSyncLoopForTesting() {
120 void SyncBackendHostMock::RequestBufferedProtocolEventsAndEnableForwarding() {}
122 void SyncBackendHostMock::DisableProtocolEventForwarding() {}
124 void SyncBackendHostMock::EnableDirectoryTypeDebugInfoForwarding() {}
126 void SyncBackendHostMock::DisableDirectoryTypeDebugInfoForwarding() {}
128 void SyncBackendHostMock::GetAllNodesForTypes(
129 syncer::ModelTypeSet types
,
130 base::Callback
<void(const std::vector
<syncer::ModelType
>& type
,
131 ScopedVector
<base::ListValue
>) > callback
) {}
133 void SyncBackendHostMock::set_fail_initial_download(bool should_fail
) {
134 fail_initial_download_
= should_fail
;
137 } // namespace browser_sync