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.
5 #include "sync/api/fake_syncable_service.h"
7 #include "base/location.h"
8 #include "sync/api/sync_error_factory.h"
12 FakeSyncableService::FakeSyncableService()
16 FakeSyncableService::~FakeSyncableService() {}
18 void FakeSyncableService::set_merge_data_and_start_syncing_error(
19 const SyncError
& error
) {
20 merge_data_and_start_syncing_error_
= error
;
23 void FakeSyncableService::set_process_sync_changes_error(
24 const SyncError
& error
) {
25 process_sync_changes_error_
= error
;
28 bool FakeSyncableService::syncing() const {
32 // SyncableService implementation.
33 SyncMergeResult
FakeSyncableService::MergeDataAndStartSyncing(
35 const SyncDataList
& initial_sync_data
,
36 scoped_ptr
<SyncChangeProcessor
> sync_processor
,
37 scoped_ptr
<SyncErrorFactory
> sync_error_factory
) {
38 SyncMergeResult
merge_result(type
);
39 sync_processor_
= sync_processor
.Pass();
41 if (!merge_data_and_start_syncing_error_
.IsSet()) {
44 merge_result
.set_error(merge_data_and_start_syncing_error_
);
49 void FakeSyncableService::StopSyncing(ModelType type
) {
51 sync_processor_
.reset();
54 SyncDataList
FakeSyncableService::GetAllSyncData(ModelType type
) const {
55 return SyncDataList();
58 SyncError
FakeSyncableService::ProcessSyncChanges(
59 const tracked_objects::Location
& from_here
,
60 const SyncChangeList
& change_list
) {
61 return process_sync_changes_error_
;