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()
15 : error_(GoogleServiceAuthError::NONE
),
16 user_share_(make_scoped_ptr(new syncer::UserShare())) {}
18 FakeSyncService::~FakeSyncService() {
21 bool FakeSyncService::HasSyncSetupCompleted() const {
25 bool FakeSyncService::IsSyncAllowed() const {
29 bool FakeSyncService::IsSyncActive() const {
33 syncer::ModelTypeSet
FakeSyncService::GetActiveDataTypes() const {
34 return syncer::ModelTypeSet();
37 void FakeSyncService::AddObserver(SyncServiceObserver
* observer
) {
40 void FakeSyncService::RemoveObserver(SyncServiceObserver
* observer
) {
43 bool FakeSyncService::HasObserver(const SyncServiceObserver
* observer
) const {
47 bool FakeSyncService::CanSyncStart() const {
51 void FakeSyncService::OnDataTypeRequestsSyncStartup(syncer::ModelType type
) {
54 void FakeSyncService::RequestStop(
55 sync_driver::SyncService::SyncStopDataFate data_fate
) {
58 void FakeSyncService::RequestStart() {
61 syncer::ModelTypeSet
FakeSyncService::GetPreferredDataTypes() const {
62 return syncer::ModelTypeSet();
65 void FakeSyncService::OnUserChoseDatatypes(bool sync_everything
,
66 syncer::ModelTypeSet chosen_types
) {
69 void FakeSyncService::SetSyncSetupCompleted() {
72 bool FakeSyncService::IsFirstSetupInProgress() const {
76 void FakeSyncService::SetSetupInProgress(bool setup_in_progress
) {
79 bool FakeSyncService::IsSetupInProgress() const {
83 bool FakeSyncService::ConfigurationDone() const {
87 const GoogleServiceAuthError
& FakeSyncService::GetAuthError() const {
91 bool FakeSyncService::HasUnrecoverableError() const {
95 bool FakeSyncService::IsBackendInitialized() const {
99 OpenTabsUIDelegate
* FakeSyncService::GetOpenTabsUIDelegate() {
103 bool FakeSyncService::IsPassphraseRequiredForDecryption() const {
107 base::Time
FakeSyncService::GetExplicitPassphraseTime() const {
111 bool FakeSyncService::IsUsingSecondaryPassphrase() const {
115 void FakeSyncService::EnableEncryptEverything() {
118 bool FakeSyncService::IsEncryptEverythingEnabled() const {
122 void FakeSyncService::SetEncryptionPassphrase(const std::string
& passphrase
,
123 PassphraseType type
) {
126 bool FakeSyncService::SetDecryptionPassphrase(const std::string
& passphrase
) {
130 bool FakeSyncService::IsCryptographerReady(
131 const syncer::BaseTransaction
* trans
) const {
135 syncer::UserShare
* FakeSyncService::GetUserShare() const {
136 return user_share_
.get();
139 LocalDeviceInfoProvider
* FakeSyncService::GetLocalDeviceInfoProvider() const {
143 void FakeSyncService::RegisterDataTypeController(
144 sync_driver::DataTypeController
* data_type_controller
) {
147 void FakeSyncService::ReenableDatatype(syncer::ModelType type
) {}
149 void FakeSyncService::DeactivateDataType(syncer::ModelType type
) {}
151 bool FakeSyncService::IsPassphraseRequired() const {
155 syncer::ModelTypeSet
FakeSyncService::GetEncryptedDataTypes() const {
156 return syncer::ModelTypeSet();
159 FakeSyncService::SyncTokenStatus
FakeSyncService::GetSyncTokenStatus() const {
160 return FakeSyncService::SyncTokenStatus();
163 std::string
FakeSyncService::QuerySyncStatusSummaryString() {
167 bool FakeSyncService::QueryDetailedSyncStatus(syncer::SyncStatus
* result
) {
171 base::string16
FakeSyncService::GetLastSyncedTimeString() const {
172 return base::string16();
175 std::string
FakeSyncService::GetBackendInitializationStateString() const {
176 return std::string();
179 syncer::sessions::SyncSessionSnapshot
FakeSyncService::GetLastSessionSnapshot()
181 return syncer::sessions::SyncSessionSnapshot();
184 base::Value
* FakeSyncService::GetTypeStatusMap() const {
185 return new base::ListValue();
188 const GURL
& FakeSyncService::sync_service_url() const {
189 return sync_service_url_
;
192 std::string
FakeSyncService::unrecoverable_error_message() const {
193 return unrecoverable_error_message_
;
196 tracked_objects::Location
FakeSyncService::unrecoverable_error_location()
198 return tracked_objects::Location();
201 } // namespace sync_driver