| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/sync/driver/fake_sync_service.h" | 5 #include "components/sync/driver/fake_sync_service.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "components/sync/core/base_transaction.h" | 9 #include "components/sync/core/base_transaction.h" |
| 10 #include "components/sync/core/user_share.h" | 10 #include "components/sync/core/user_share.h" |
| 11 #include "components/sync/driver/data_type_controller.h" | 11 #include "components/sync/driver/data_type_controller.h" |
| 12 | 12 |
| 13 namespace sync_driver { | 13 namespace syncer { |
| 14 | 14 |
| 15 FakeSyncService::FakeSyncService() | 15 FakeSyncService::FakeSyncService() |
| 16 : error_(GoogleServiceAuthError::NONE), | 16 : error_(GoogleServiceAuthError::NONE), |
| 17 user_share_(base::MakeUnique<syncer::UserShare>()) {} | 17 user_share_(base::MakeUnique<UserShare>()) {} |
| 18 | 18 |
| 19 FakeSyncService::~FakeSyncService() {} | 19 FakeSyncService::~FakeSyncService() {} |
| 20 | 20 |
| 21 bool FakeSyncService::IsFirstSetupComplete() const { | 21 bool FakeSyncService::IsFirstSetupComplete() const { |
| 22 return false; | 22 return false; |
| 23 } | 23 } |
| 24 | 24 |
| 25 bool FakeSyncService::IsSyncAllowed() const { | 25 bool FakeSyncService::IsSyncAllowed() const { |
| 26 return false; | 26 return false; |
| 27 } | 27 } |
| 28 | 28 |
| 29 bool FakeSyncService::IsSyncActive() const { | 29 bool FakeSyncService::IsSyncActive() const { |
| 30 return false; | 30 return false; |
| 31 } | 31 } |
| 32 | 32 |
| 33 void FakeSyncService::TriggerRefresh(const syncer::ModelTypeSet& types) {} | 33 void FakeSyncService::TriggerRefresh(const ModelTypeSet& types) {} |
| 34 | 34 |
| 35 syncer::ModelTypeSet FakeSyncService::GetActiveDataTypes() const { | 35 ModelTypeSet FakeSyncService::GetActiveDataTypes() const { |
| 36 return syncer::ModelTypeSet(); | 36 return ModelTypeSet(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 SyncClient* FakeSyncService::GetSyncClient() const { | 39 SyncClient* FakeSyncService::GetSyncClient() const { |
| 40 return nullptr; | 40 return nullptr; |
| 41 } | 41 } |
| 42 | 42 |
| 43 void FakeSyncService::AddObserver(SyncServiceObserver* observer) {} | 43 void FakeSyncService::AddObserver(SyncServiceObserver* observer) {} |
| 44 | 44 |
| 45 void FakeSyncService::RemoveObserver(SyncServiceObserver* observer) {} | 45 void FakeSyncService::RemoveObserver(SyncServiceObserver* observer) {} |
| 46 | 46 |
| 47 bool FakeSyncService::HasObserver(const SyncServiceObserver* observer) const { | 47 bool FakeSyncService::HasObserver(const SyncServiceObserver* observer) const { |
| 48 return false; | 48 return false; |
| 49 } | 49 } |
| 50 | 50 |
| 51 bool FakeSyncService::CanSyncStart() const { | 51 bool FakeSyncService::CanSyncStart() const { |
| 52 return false; | 52 return false; |
| 53 } | 53 } |
| 54 | 54 |
| 55 void FakeSyncService::OnDataTypeRequestsSyncStartup(syncer::ModelType type) {} | 55 void FakeSyncService::OnDataTypeRequestsSyncStartup(ModelType type) {} |
| 56 | 56 |
| 57 void FakeSyncService::RequestStop( | 57 void FakeSyncService::RequestStop(SyncService::SyncStopDataFate data_fate) {} |
| 58 sync_driver::SyncService::SyncStopDataFate data_fate) {} | |
| 59 | 58 |
| 60 void FakeSyncService::RequestStart() {} | 59 void FakeSyncService::RequestStart() {} |
| 61 | 60 |
| 62 syncer::ModelTypeSet FakeSyncService::GetPreferredDataTypes() const { | 61 ModelTypeSet FakeSyncService::GetPreferredDataTypes() const { |
| 63 return syncer::ModelTypeSet(); | 62 return ModelTypeSet(); |
| 64 } | 63 } |
| 65 | 64 |
| 66 void FakeSyncService::OnUserChoseDatatypes(bool sync_everything, | 65 void FakeSyncService::OnUserChoseDatatypes(bool sync_everything, |
| 67 syncer::ModelTypeSet chosen_types) {} | 66 ModelTypeSet chosen_types) {} |
| 68 | 67 |
| 69 void FakeSyncService::SetFirstSetupComplete() {} | 68 void FakeSyncService::SetFirstSetupComplete() {} |
| 70 | 69 |
| 71 bool FakeSyncService::IsFirstSetupInProgress() const { | 70 bool FakeSyncService::IsFirstSetupInProgress() const { |
| 72 return false; | 71 return false; |
| 73 } | 72 } |
| 74 | 73 |
| 75 std::unique_ptr<SyncSetupInProgressHandle> | 74 std::unique_ptr<SyncSetupInProgressHandle> |
| 76 FakeSyncService::GetSetupInProgressHandle() { | 75 FakeSyncService::GetSetupInProgressHandle() { |
| 77 return nullptr; | 76 return nullptr; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 return false; | 118 return false; |
| 120 } | 119 } |
| 121 | 120 |
| 122 void FakeSyncService::SetEncryptionPassphrase(const std::string& passphrase, | 121 void FakeSyncService::SetEncryptionPassphrase(const std::string& passphrase, |
| 123 PassphraseType type) {} | 122 PassphraseType type) {} |
| 124 | 123 |
| 125 bool FakeSyncService::SetDecryptionPassphrase(const std::string& passphrase) { | 124 bool FakeSyncService::SetDecryptionPassphrase(const std::string& passphrase) { |
| 126 return false; | 125 return false; |
| 127 } | 126 } |
| 128 | 127 |
| 129 bool FakeSyncService::IsCryptographerReady( | 128 bool FakeSyncService::IsCryptographerReady(const BaseTransaction* trans) const { |
| 130 const syncer::BaseTransaction* trans) const { | |
| 131 return false; | 129 return false; |
| 132 } | 130 } |
| 133 | 131 |
| 134 syncer::UserShare* FakeSyncService::GetUserShare() const { | 132 UserShare* FakeSyncService::GetUserShare() const { |
| 135 return user_share_.get(); | 133 return user_share_.get(); |
| 136 } | 134 } |
| 137 | 135 |
| 138 LocalDeviceInfoProvider* FakeSyncService::GetLocalDeviceInfoProvider() const { | 136 LocalDeviceInfoProvider* FakeSyncService::GetLocalDeviceInfoProvider() const { |
| 139 return nullptr; | 137 return nullptr; |
| 140 } | 138 } |
| 141 | 139 |
| 142 void FakeSyncService::RegisterDataTypeController( | 140 void FakeSyncService::RegisterDataTypeController( |
| 143 std::unique_ptr<sync_driver::DataTypeController> data_type_controller) {} | 141 std::unique_ptr<DataTypeController> data_type_controller) {} |
| 144 | 142 |
| 145 void FakeSyncService::ReenableDatatype(syncer::ModelType type) {} | 143 void FakeSyncService::ReenableDatatype(ModelType type) {} |
| 146 | 144 |
| 147 bool FakeSyncService::IsPassphraseRequired() const { | 145 bool FakeSyncService::IsPassphraseRequired() const { |
| 148 return false; | 146 return false; |
| 149 } | 147 } |
| 150 | 148 |
| 151 syncer::ModelTypeSet FakeSyncService::GetEncryptedDataTypes() const { | 149 ModelTypeSet FakeSyncService::GetEncryptedDataTypes() const { |
| 152 return syncer::ModelTypeSet(); | 150 return ModelTypeSet(); |
| 153 } | 151 } |
| 154 | 152 |
| 155 FakeSyncService::SyncTokenStatus FakeSyncService::GetSyncTokenStatus() const { | 153 FakeSyncService::SyncTokenStatus FakeSyncService::GetSyncTokenStatus() const { |
| 156 return FakeSyncService::SyncTokenStatus(); | 154 return FakeSyncService::SyncTokenStatus(); |
| 157 } | 155 } |
| 158 | 156 |
| 159 std::string FakeSyncService::QuerySyncStatusSummaryString() { | 157 std::string FakeSyncService::QuerySyncStatusSummaryString() { |
| 160 return ""; | 158 return ""; |
| 161 } | 159 } |
| 162 | 160 |
| 163 bool FakeSyncService::QueryDetailedSyncStatus(syncer::SyncStatus* result) { | 161 bool FakeSyncService::QueryDetailedSyncStatus(SyncStatus* result) { |
| 164 return false; | 162 return false; |
| 165 } | 163 } |
| 166 | 164 |
| 167 base::string16 FakeSyncService::GetLastSyncedTimeString() const { | 165 base::string16 FakeSyncService::GetLastSyncedTimeString() const { |
| 168 return base::string16(); | 166 return base::string16(); |
| 169 } | 167 } |
| 170 | 168 |
| 171 std::string FakeSyncService::GetBackendInitializationStateString() const { | 169 std::string FakeSyncService::GetBackendInitializationStateString() const { |
| 172 return std::string(); | 170 return std::string(); |
| 173 } | 171 } |
| 174 | 172 |
| 175 syncer::SyncCycleSnapshot FakeSyncService::GetLastCycleSnapshot() const { | 173 SyncCycleSnapshot FakeSyncService::GetLastCycleSnapshot() const { |
| 176 return syncer::SyncCycleSnapshot(); | 174 return SyncCycleSnapshot(); |
| 177 } | 175 } |
| 178 | 176 |
| 179 base::Value* FakeSyncService::GetTypeStatusMap() const { | 177 base::Value* FakeSyncService::GetTypeStatusMap() const { |
| 180 return new base::ListValue(); | 178 return new base::ListValue(); |
| 181 } | 179 } |
| 182 | 180 |
| 183 const GURL& FakeSyncService::sync_service_url() const { | 181 const GURL& FakeSyncService::sync_service_url() const { |
| 184 return sync_service_url_; | 182 return sync_service_url_; |
| 185 } | 183 } |
| 186 | 184 |
| 187 std::string FakeSyncService::unrecoverable_error_message() const { | 185 std::string FakeSyncService::unrecoverable_error_message() const { |
| 188 return unrecoverable_error_message_; | 186 return unrecoverable_error_message_; |
| 189 } | 187 } |
| 190 | 188 |
| 191 tracked_objects::Location FakeSyncService::unrecoverable_error_location() | 189 tracked_objects::Location FakeSyncService::unrecoverable_error_location() |
| 192 const { | 190 const { |
| 193 return tracked_objects::Location(); | 191 return tracked_objects::Location(); |
| 194 } | 192 } |
| 195 | 193 |
| 196 void FakeSyncService::AddProtocolEventObserver( | 194 void FakeSyncService::AddProtocolEventObserver( |
| 197 browser_sync::ProtocolEventObserver* observer) {} | 195 ProtocolEventObserver* observer) {} |
| 198 | 196 |
| 199 void FakeSyncService::RemoveProtocolEventObserver( | 197 void FakeSyncService::RemoveProtocolEventObserver( |
| 200 browser_sync::ProtocolEventObserver* observer) {} | 198 ProtocolEventObserver* observer) {} |
| 201 | 199 |
| 202 void FakeSyncService::AddTypeDebugInfoObserver( | 200 void FakeSyncService::AddTypeDebugInfoObserver( |
| 203 syncer::TypeDebugInfoObserver* observer) {} | 201 TypeDebugInfoObserver* observer) {} |
| 204 | 202 |
| 205 void FakeSyncService::RemoveTypeDebugInfoObserver( | 203 void FakeSyncService::RemoveTypeDebugInfoObserver( |
| 206 syncer::TypeDebugInfoObserver* observer) {} | 204 TypeDebugInfoObserver* observer) {} |
| 207 | 205 |
| 208 base::WeakPtr<syncer::JsController> FakeSyncService::GetJsController() { | 206 base::WeakPtr<JsController> FakeSyncService::GetJsController() { |
| 209 return base::WeakPtr<syncer::JsController>(); | 207 return base::WeakPtr<JsController>(); |
| 210 } | 208 } |
| 211 | 209 |
| 212 void FakeSyncService::GetAllNodes( | 210 void FakeSyncService::GetAllNodes( |
| 213 const base::Callback<void(std::unique_ptr<base::ListValue>)>& callback) {} | 211 const base::Callback<void(std::unique_ptr<base::ListValue>)>& callback) {} |
| 214 | 212 |
| 215 } // namespace sync_driver | 213 } // namespace syncer |
| OLD | NEW |