Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / sync / glue / sync_backend_host_mock.cc
blob2aecfea2b11c804bda45f010321fafd023fceef5
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 scoped_refptr<base::SingleThreadTaskRunner>& db_thread,
20 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread,
21 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler,
22 const GURL& service_url,
23 const std::string& sync_user_agent,
24 const syncer::SyncCredentials& credentials,
25 bool delete_sync_data_folder,
26 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory,
27 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>&
28 unrecoverable_error_handler,
29 const base::Closure& report_unrecoverable_error_function,
30 syncer::NetworkResources* network_resources,
31 scoped_ptr<syncer::SyncEncryptionHandler::NigoriState> saved_nigori_state) {
32 frontend->OnBackendInitialized(
33 syncer::WeakHandle<syncer::JsBackend>(),
34 syncer::WeakHandle<syncer::DataTypeDebugInfoListener>(),
35 kTestCacheGuid,
36 !fail_initial_download_);
39 void SyncBackendHostMock::UpdateCredentials(
40 const syncer::SyncCredentials& credentials) {}
42 void SyncBackendHostMock::StartSyncingWithServer() {}
44 void SyncBackendHostMock::SetEncryptionPassphrase(
45 const std::string& passphrase,
46 bool is_explicit) {}
48 bool SyncBackendHostMock::SetDecryptionPassphrase(
49 const std::string& passphrase) {
50 return false;
53 void SyncBackendHostMock::StopSyncingForShutdown() {}
55 scoped_ptr<base::Thread> SyncBackendHostMock::Shutdown(
56 syncer::ShutdownReason reason) {
57 return scoped_ptr<base::Thread>();
60 void SyncBackendHostMock::UnregisterInvalidationIds() {}
62 syncer::ModelTypeSet SyncBackendHostMock::ConfigureDataTypes(
63 syncer::ConfigureReason reason,
64 const DataTypeConfigStateMap& config_state_map,
65 const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>&
66 ready_task,
67 const base::Callback<void()>& retry_callback) {
68 return syncer::ModelTypeSet();
71 void SyncBackendHostMock::EnableEncryptEverything() {}
73 void SyncBackendHostMock::ActivateDataType(
74 syncer::ModelType type, syncer::ModelSafeGroup group,
75 sync_driver::ChangeProcessor* change_processor) {}
76 void SyncBackendHostMock::DeactivateDataType(syncer::ModelType type) {}
78 syncer::UserShare* SyncBackendHostMock::GetUserShare() const {
79 return NULL;
82 scoped_ptr<syncer_v2::SyncContextProxy>
83 SyncBackendHostMock::GetSyncContextProxy() {
84 return scoped_ptr<syncer_v2::SyncContextProxy>();
87 SyncBackendHost::Status SyncBackendHostMock::GetDetailedStatus() {
88 return SyncBackendHost::Status();
91 syncer::sessions::SyncSessionSnapshot
92 SyncBackendHostMock::GetLastSessionSnapshot() const {
93 return syncer::sessions::SyncSessionSnapshot();
96 bool SyncBackendHostMock::HasUnsyncedItems() const {
97 return false;
100 bool SyncBackendHostMock::IsNigoriEnabled() const {
101 return true;
104 syncer::PassphraseType SyncBackendHostMock::GetPassphraseType() const {
105 return syncer::IMPLICIT_PASSPHRASE;
108 base::Time SyncBackendHostMock::GetExplicitPassphraseTime() const {
109 return base::Time();
112 bool SyncBackendHostMock::IsCryptographerReady(
113 const syncer::BaseTransaction* trans) const {
114 return false;
117 void SyncBackendHostMock::GetModelSafeRoutingInfo(
118 syncer::ModelSafeRoutingInfo* out) const {}
120 void SyncBackendHostMock::FlushDirectory() const {}
122 base::MessageLoop* SyncBackendHostMock::GetSyncLoopForTesting() {
123 return NULL;
126 void SyncBackendHostMock::RefreshTypesForTest(syncer::ModelTypeSet types) {}
128 void SyncBackendHostMock::RequestBufferedProtocolEventsAndEnableForwarding() {}
130 void SyncBackendHostMock::DisableProtocolEventForwarding() {}
132 void SyncBackendHostMock::EnableDirectoryTypeDebugInfoForwarding() {}
134 void SyncBackendHostMock::DisableDirectoryTypeDebugInfoForwarding() {}
136 void SyncBackendHostMock::GetAllNodesForTypes(
137 syncer::ModelTypeSet types,
138 base::Callback<void(const std::vector<syncer::ModelType>& type,
139 ScopedVector<base::ListValue>) > callback) {}
141 void SyncBackendHostMock::set_fail_initial_download(bool should_fail) {
142 fail_initial_download_ = should_fail;
145 void SyncBackendHostMock::ClearServerData(
146 const syncer::SyncManager::ClearServerDataCallback& callback) {
147 callback.Run();
150 } // namespace browser_sync