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