| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "sync/api/fake_syncable_service.h" | 5 #include "sync/api/fake_syncable_service.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "sync/api/sync_error_factory.h" | 8 #include "sync/api/sync_error_factory.h" |
| 9 | 9 |
| 10 namespace syncer { | 10 namespace syncer { |
| 11 | 11 |
| 12 FakeSyncableService::FakeSyncableService() | 12 FakeSyncableService::FakeSyncableService() |
| 13 : syncing_(false), | 13 : syncing_(false), |
| 14 type_(syncer::UNSPECIFIED) {} | 14 type_(UNSPECIFIED) {} |
| 15 | 15 |
| 16 FakeSyncableService::~FakeSyncableService() {} | 16 FakeSyncableService::~FakeSyncableService() {} |
| 17 | 17 |
| 18 void FakeSyncableService::set_merge_data_and_start_syncing_error( | 18 void FakeSyncableService::set_merge_data_and_start_syncing_error( |
| 19 const SyncError& error) { | 19 const SyncError& error) { |
| 20 merge_data_and_start_syncing_error_ = error; | 20 merge_data_and_start_syncing_error_ = error; |
| 21 } | 21 } |
| 22 | 22 |
| 23 void FakeSyncableService::set_process_sync_changes_error( | 23 void FakeSyncableService::set_process_sync_changes_error( |
| 24 const SyncError& error) { | 24 const SyncError& error) { |
| 25 process_sync_changes_error_ = error; | 25 process_sync_changes_error_ = error; |
| 26 } | 26 } |
| 27 | 27 |
| 28 bool FakeSyncableService::syncing() const { | 28 bool FakeSyncableService::syncing() const { |
| 29 return syncing_; | 29 return syncing_; |
| 30 } | 30 } |
| 31 | 31 |
| 32 // SyncableService implementation. | 32 // SyncableService implementation. |
| 33 SyncError FakeSyncableService::MergeDataAndStartSyncing( | 33 SyncError FakeSyncableService::MergeDataAndStartSyncing( |
| 34 syncer::ModelType type, | 34 ModelType type, |
| 35 const SyncDataList& initial_sync_data, | 35 const SyncDataList& initial_sync_data, |
| 36 scoped_ptr<SyncChangeProcessor> sync_processor, | 36 scoped_ptr<SyncChangeProcessor> sync_processor, |
| 37 scoped_ptr<SyncErrorFactory> sync_error_factory) { | 37 scoped_ptr<SyncErrorFactory> sync_error_factory) { |
| 38 sync_processor_ = sync_processor.Pass(); | 38 sync_processor_ = sync_processor.Pass(); |
| 39 type_ = type; | 39 type_ = type; |
| 40 if (!merge_data_and_start_syncing_error_.IsSet()) { | 40 if (!merge_data_and_start_syncing_error_.IsSet()) { |
| 41 syncing_ = true; | 41 syncing_ = true; |
| 42 } | 42 } |
| 43 return merge_data_and_start_syncing_error_; | 43 return merge_data_and_start_syncing_error_; |
| 44 } | 44 } |
| 45 | 45 |
| 46 void FakeSyncableService::StopSyncing(syncer::ModelType type) { | 46 void FakeSyncableService::StopSyncing(ModelType type) { |
| 47 syncing_ = false; | 47 syncing_ = false; |
| 48 sync_processor_.reset(); | 48 sync_processor_.reset(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 SyncDataList FakeSyncableService::GetAllSyncData( | 51 SyncDataList FakeSyncableService::GetAllSyncData(ModelType type) const { |
| 52 syncer::ModelType type) const { | |
| 53 return SyncDataList(); | 52 return SyncDataList(); |
| 54 } | 53 } |
| 55 | 54 |
| 56 SyncError FakeSyncableService::ProcessSyncChanges( | 55 SyncError FakeSyncableService::ProcessSyncChanges( |
| 57 const tracked_objects::Location& from_here, | 56 const tracked_objects::Location& from_here, |
| 58 const SyncChangeList& change_list) { | 57 const SyncChangeList& change_list) { |
| 59 return process_sync_changes_error_; | 58 return process_sync_changes_error_; |
| 60 } | 59 } |
| 61 | 60 |
| 62 } // namespace syncer | 61 } // namespace syncer |
| OLD | NEW |