1 // Copyright 2015 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 "components/sync_driver/fake_sync_service.h"
7 #include "base/values.h"
8 #include "sync/internal_api/public/base_transaction.h"
9 #include "sync/internal_api/public/sessions/sync_session_snapshot.h"
10 #include "sync/internal_api/public/user_share.h"
12 namespace sync_driver
{
14 FakeSyncService::FakeSyncService() : error_(GoogleServiceAuthError::NONE
) {
17 FakeSyncService::~FakeSyncService() {
20 bool FakeSyncService::HasSyncSetupCompleted() const {
24 bool FakeSyncService::IsSyncAllowed() const {
28 bool FakeSyncService::IsSyncActive() const {
32 syncer::ModelTypeSet
FakeSyncService::GetActiveDataTypes() const {
33 return syncer::ModelTypeSet();
36 void FakeSyncService::AddObserver(SyncServiceObserver
* observer
) {
39 void FakeSyncService::RemoveObserver(SyncServiceObserver
* observer
) {
42 bool FakeSyncService::HasObserver(const SyncServiceObserver
* observer
) const {
46 bool FakeSyncService::CanSyncStart() const {
50 void FakeSyncService::OnDataTypeRequestsSyncStartup(syncer::ModelType type
) {
53 void FakeSyncService::RequestStop(
54 sync_driver::SyncService::SyncStopDataFate data_fate
) {
57 void FakeSyncService::RequestStart() {
60 syncer::ModelTypeSet
FakeSyncService::GetPreferredDataTypes() const {
61 return syncer::ModelTypeSet();
64 void FakeSyncService::OnUserChoseDatatypes(bool sync_everything
,
65 syncer::ModelTypeSet chosen_types
) {
68 void FakeSyncService::SetSyncSetupCompleted() {
71 bool FakeSyncService::FirstSetupInProgress() const {
75 void FakeSyncService::SetSetupInProgress(bool setup_in_progress
) {
78 bool FakeSyncService::setup_in_progress() const {
82 bool FakeSyncService::ConfigurationDone() const {
86 const GoogleServiceAuthError
& FakeSyncService::GetAuthError() const {
90 bool FakeSyncService::HasUnrecoverableError() const {
94 bool FakeSyncService::backend_initialized() const {
98 OpenTabsUIDelegate
* FakeSyncService::GetOpenTabsUIDelegate() {
102 bool FakeSyncService::IsPassphraseRequiredForDecryption() const {
106 base::Time
FakeSyncService::GetExplicitPassphraseTime() const {
110 bool FakeSyncService::IsUsingSecondaryPassphrase() const {
114 void FakeSyncService::EnableEncryptEverything() {
117 bool FakeSyncService::EncryptEverythingEnabled() const {
121 void FakeSyncService::SetEncryptionPassphrase(const std::string
& passphrase
,
122 PassphraseType type
) {
125 bool FakeSyncService::SetDecryptionPassphrase(const std::string
& passphrase
) {
129 bool FakeSyncService::IsCryptographerReady(
130 const syncer::BaseTransaction
* trans
) const {
134 syncer::UserShare
* FakeSyncService::GetUserShare() const {
135 return new syncer::UserShare();
138 LocalDeviceInfoProvider
* FakeSyncService::GetLocalDeviceInfoProvider() const {
142 void FakeSyncService::RegisterDataTypeController(
143 sync_driver::DataTypeController
* data_type_controller
) {
146 void FakeSyncService::ReenableDatatype(syncer::ModelType type
) {}
148 void FakeSyncService::DeactivateDataType(syncer::ModelType type
) {}
150 bool FakeSyncService::IsPassphraseRequired() const {
154 syncer::ModelTypeSet
FakeSyncService::GetEncryptedDataTypes() const {
155 return syncer::ModelTypeSet();
158 FakeSyncService::SyncTokenStatus
FakeSyncService::GetSyncTokenStatus() const {
159 return FakeSyncService::SyncTokenStatus();
162 std::string
FakeSyncService::QuerySyncStatusSummaryString() {
166 bool FakeSyncService::QueryDetailedSyncStatus(syncer::SyncStatus
* result
) {
170 base::string16
FakeSyncService::GetLastSyncedTimeString() const {
171 return base::string16();
174 std::string
FakeSyncService::GetBackendInitializationStateString() const {
175 return std::string();
178 syncer::sessions::SyncSessionSnapshot
FakeSyncService::GetLastSessionSnapshot()
180 return syncer::sessions::SyncSessionSnapshot();
183 base::Value
* FakeSyncService::GetTypeStatusMap() const {
184 return new base::ListValue();
187 const GURL
& FakeSyncService::sync_service_url() const {
188 return sync_service_url_
;
191 std::string
FakeSyncService::unrecoverable_error_message() const {
192 return unrecoverable_error_message_
;
195 tracked_objects::Location
FakeSyncService::unrecoverable_error_location()
197 return tracked_objects::Location();
200 } // namespace sync_driver