Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / sync / api / fake_syncable_service.cc
blob342dd2db008d2ecafa6c03fffa6a0596567dcdf5
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"
10 namespace syncer {
12 FakeSyncableService::FakeSyncableService()
13 : syncing_(false),
14 type_(UNSPECIFIED) {}
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 void FakeSyncableService::set_attachment_store(
29 scoped_ptr<AttachmentStore> attachment_store) {
30 attachment_store_ = attachment_store.Pass();
33 const AttachmentService* FakeSyncableService::attachment_service() const {
34 return attachment_service_.get();
37 bool FakeSyncableService::syncing() const {
38 return syncing_;
41 // SyncableService implementation.
42 SyncMergeResult FakeSyncableService::MergeDataAndStartSyncing(
43 ModelType type,
44 const SyncDataList& initial_sync_data,
45 scoped_ptr<SyncChangeProcessor> sync_processor,
46 scoped_ptr<SyncErrorFactory> sync_error_factory) {
47 SyncMergeResult merge_result(type);
48 sync_processor_ = sync_processor.Pass();
49 type_ = type;
50 if (!merge_data_and_start_syncing_error_.IsSet()) {
51 syncing_ = true;
52 } else {
53 merge_result.set_error(merge_data_and_start_syncing_error_);
55 return merge_result;
58 void FakeSyncableService::StopSyncing(ModelType type) {
59 syncing_ = false;
60 sync_processor_.reset();
63 SyncDataList FakeSyncableService::GetAllSyncData(ModelType type) const {
64 return SyncDataList();
67 SyncError FakeSyncableService::ProcessSyncChanges(
68 const tracked_objects::Location& from_here,
69 const SyncChangeList& change_list) {
70 return process_sync_changes_error_;
73 scoped_ptr<AttachmentStoreForSync>
74 FakeSyncableService::GetAttachmentStoreForSync() {
75 return attachment_store_ ? attachment_store_->CreateAttachmentStoreForSync()
76 : scoped_ptr<AttachmentStoreForSync>();
79 void FakeSyncableService::SetAttachmentService(
80 scoped_ptr<AttachmentService> attachment_service) {
81 attachment_service_ = attachment_service.Pass();
84 } // namespace syncer