Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(863)

Side by Side Diff: sync/api/fake_syncable_service.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sync/api/fake_syncable_service.h ('k') | sync/api/metadata_batch.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 <utility>
8
9 #include "base/location.h"
10 #include "sync/api/sync_error_factory.h"
11
12 namespace syncer {
13
14 FakeSyncableService::FakeSyncableService()
15 : syncing_(false),
16 type_(UNSPECIFIED) {}
17
18 FakeSyncableService::~FakeSyncableService() {}
19
20 void FakeSyncableService::set_merge_data_and_start_syncing_error(
21 const SyncError& error) {
22 merge_data_and_start_syncing_error_ = error;
23 }
24
25 void FakeSyncableService::set_process_sync_changes_error(
26 const SyncError& error) {
27 process_sync_changes_error_ = error;
28 }
29
30 void FakeSyncableService::set_attachment_store(
31 std::unique_ptr<AttachmentStore> attachment_store) {
32 attachment_store_ = std::move(attachment_store);
33 }
34
35 const AttachmentService* FakeSyncableService::attachment_service() const {
36 return attachment_service_.get();
37 }
38
39 bool FakeSyncableService::syncing() const {
40 return syncing_;
41 }
42
43 // SyncableService implementation.
44 SyncMergeResult FakeSyncableService::MergeDataAndStartSyncing(
45 ModelType type,
46 const SyncDataList& initial_sync_data,
47 std::unique_ptr<SyncChangeProcessor> sync_processor,
48 std::unique_ptr<SyncErrorFactory> sync_error_factory) {
49 SyncMergeResult merge_result(type);
50 sync_processor_ = std::move(sync_processor);
51 type_ = type;
52 if (!merge_data_and_start_syncing_error_.IsSet()) {
53 syncing_ = true;
54 } else {
55 merge_result.set_error(merge_data_and_start_syncing_error_);
56 }
57 return merge_result;
58 }
59
60 void FakeSyncableService::StopSyncing(ModelType type) {
61 syncing_ = false;
62 sync_processor_.reset();
63 }
64
65 SyncDataList FakeSyncableService::GetAllSyncData(ModelType type) const {
66 return SyncDataList();
67 }
68
69 SyncError FakeSyncableService::ProcessSyncChanges(
70 const tracked_objects::Location& from_here,
71 const SyncChangeList& change_list) {
72 return process_sync_changes_error_;
73 }
74
75 std::unique_ptr<AttachmentStoreForSync>
76 FakeSyncableService::GetAttachmentStoreForSync() {
77 return attachment_store_ ? attachment_store_->CreateAttachmentStoreForSync()
78 : std::unique_ptr<AttachmentStoreForSync>();
79 }
80
81 void FakeSyncableService::SetAttachmentService(
82 std::unique_ptr<AttachmentService> attachment_service) {
83 attachment_service_ = std::move(attachment_service);
84 }
85
86 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/api/fake_syncable_service.h ('k') | sync/api/metadata_batch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698