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

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

Issue 2401223002: [Sync] Renaming sync/api* to sync/model*. (Closed)
Patch Set: Missed a comment in a DEPS file, and rebasing. Created 4 years, 2 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
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 "components/sync/api/fake_syncable_service.h"
6
7 #include <utility>
8
9 #include "base/location.h"
10 #include "components/sync/api/sync_error_factory.h"
11
12 namespace syncer {
13
14 FakeSyncableService::FakeSyncableService()
15 : syncing_(false), type_(UNSPECIFIED) {}
16
17 FakeSyncableService::~FakeSyncableService() {}
18
19 void FakeSyncableService::set_merge_data_and_start_syncing_error(
20 const SyncError& error) {
21 merge_data_and_start_syncing_error_ = error;
22 }
23
24 void FakeSyncableService::set_process_sync_changes_error(
25 const SyncError& error) {
26 process_sync_changes_error_ = error;
27 }
28
29 void FakeSyncableService::set_attachment_store(
30 std::unique_ptr<AttachmentStore> attachment_store) {
31 attachment_store_ = std::move(attachment_store);
32 }
33
34 const AttachmentService* FakeSyncableService::attachment_service() const {
35 return attachment_service_.get();
36 }
37
38 bool FakeSyncableService::syncing() const {
39 return syncing_;
40 }
41
42 // SyncableService implementation.
43 SyncMergeResult FakeSyncableService::MergeDataAndStartSyncing(
44 ModelType type,
45 const SyncDataList& initial_sync_data,
46 std::unique_ptr<SyncChangeProcessor> sync_processor,
47 std::unique_ptr<SyncErrorFactory> sync_error_factory) {
48 SyncMergeResult merge_result(type);
49 sync_processor_ = std::move(sync_processor);
50 type_ = type;
51 if (!merge_data_and_start_syncing_error_.IsSet()) {
52 syncing_ = true;
53 } else {
54 merge_result.set_error(merge_data_and_start_syncing_error_);
55 }
56 return merge_result;
57 }
58
59 void FakeSyncableService::StopSyncing(ModelType type) {
60 syncing_ = false;
61 sync_processor_.reset();
62 }
63
64 SyncDataList FakeSyncableService::GetAllSyncData(ModelType type) const {
65 return SyncDataList();
66 }
67
68 SyncError FakeSyncableService::ProcessSyncChanges(
69 const tracked_objects::Location& from_here,
70 const SyncChangeList& change_list) {
71 return process_sync_changes_error_;
72 }
73
74 std::unique_ptr<AttachmentStoreForSync>
75 FakeSyncableService::GetAttachmentStoreForSync() {
76 return attachment_store_ ? attachment_store_->CreateAttachmentStoreForSync()
77 : std::unique_ptr<AttachmentStoreForSync>();
78 }
79
80 void FakeSyncableService::SetAttachmentService(
81 std::unique_ptr<AttachmentService> attachment_service) {
82 attachment_service_ = std::move(attachment_service);
83 }
84
85 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/api/fake_syncable_service.h ('k') | components/sync/api/local_change_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698