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 std::string
& sync_user_agent
,
22 const syncer::SyncCredentials
& credentials
,
23 bool delete_sync_data_folder
,
24 scoped_ptr
<syncer::SyncManagerFactory
> sync_manager_factory
,
25 const syncer::WeakHandle
<syncer::UnrecoverableErrorHandler
>&
26 unrecoverable_error_handler
,
27 const base::Closure
& report_unrecoverable_error_function
,
28 syncer::NetworkResources
* network_resources
,
29 scoped_ptr
<syncer::SyncEncryptionHandler::NigoriState
> saved_nigori_state
) {
30 frontend
->OnBackendInitialized(
31 syncer::WeakHandle
<syncer::JsBackend
>(),
32 syncer::WeakHandle
<syncer::DataTypeDebugInfoListener
>(),
34 !fail_initial_download_
);
37 void SyncBackendHostMock::UpdateCredentials(
38 const syncer::SyncCredentials
& credentials
) {}
40 void SyncBackendHostMock::StartSyncingWithServer() {}
42 void SyncBackendHostMock::SetEncryptionPassphrase(
43 const std::string
& passphrase
,
46 bool SyncBackendHostMock::SetDecryptionPassphrase(
47 const std::string
& passphrase
) {
51 void SyncBackendHostMock::StopSyncingForShutdown() {}
53 scoped_ptr
<base::Thread
> SyncBackendHostMock::Shutdown(
54 syncer::ShutdownReason reason
) {
55 return scoped_ptr
<base::Thread
>();
58 void SyncBackendHostMock::UnregisterInvalidationIds() {}
60 syncer::ModelTypeSet
SyncBackendHostMock::ConfigureDataTypes(
61 syncer::ConfigureReason reason
,
62 const DataTypeConfigStateMap
& config_state_map
,
63 const base::Callback
<void(syncer::ModelTypeSet
, syncer::ModelTypeSet
)>&
65 const base::Callback
<void()>& retry_callback
) {
66 return syncer::ModelTypeSet();
69 void SyncBackendHostMock::EnableEncryptEverything() {}
71 void SyncBackendHostMock::ActivateDataType(
72 syncer::ModelType type
, syncer::ModelSafeGroup group
,
73 sync_driver::ChangeProcessor
* change_processor
) {}
74 void SyncBackendHostMock::DeactivateDataType(syncer::ModelType type
) {}
76 syncer::UserShare
* SyncBackendHostMock::GetUserShare() const {
80 scoped_ptr
<syncer_v2::SyncContextProxy
>
81 SyncBackendHostMock::GetSyncContextProxy() {
82 return scoped_ptr
<syncer_v2::SyncContextProxy
>();
85 SyncBackendHost::Status
SyncBackendHostMock::GetDetailedStatus() {
86 return SyncBackendHost::Status();
89 syncer::sessions::SyncSessionSnapshot
90 SyncBackendHostMock::GetLastSessionSnapshot() const {
91 return syncer::sessions::SyncSessionSnapshot();
94 bool SyncBackendHostMock::HasUnsyncedItems() const {
98 bool SyncBackendHostMock::IsNigoriEnabled() const {
102 syncer::PassphraseType
SyncBackendHostMock::GetPassphraseType() const {
103 return syncer::IMPLICIT_PASSPHRASE
;
106 base::Time
SyncBackendHostMock::GetExplicitPassphraseTime() const {
110 bool SyncBackendHostMock::IsCryptographerReady(
111 const syncer::BaseTransaction
* trans
) const {
115 void SyncBackendHostMock::GetModelSafeRoutingInfo(
116 syncer::ModelSafeRoutingInfo
* out
) const {}
118 void SyncBackendHostMock::FlushDirectory() const {}
120 base::MessageLoop
* SyncBackendHostMock::GetSyncLoopForTesting() {
124 void SyncBackendHostMock::RefreshTypesForTest(syncer::ModelTypeSet types
) {}
126 void SyncBackendHostMock::RequestBufferedProtocolEventsAndEnableForwarding() {}
128 void SyncBackendHostMock::DisableProtocolEventForwarding() {}
130 void SyncBackendHostMock::EnableDirectoryTypeDebugInfoForwarding() {}
132 void SyncBackendHostMock::DisableDirectoryTypeDebugInfoForwarding() {}
134 void SyncBackendHostMock::GetAllNodesForTypes(
135 syncer::ModelTypeSet types
,
136 base::Callback
<void(const std::vector
<syncer::ModelType
>& type
,
137 ScopedVector
<base::ListValue
>) > callback
) {}
139 void SyncBackendHostMock::set_fail_initial_download(bool should_fail
) {
140 fail_initial_download_
= should_fail
;
143 void SyncBackendHostMock::ClearServerData(
144 const syncer::SyncManager::ClearServerDataCallback
& callback
) {
148 } // namespace browser_sync