OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "sync/api/fake_syncable_service.h" | 5 #include "sync/api/fake_syncable_service.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/location.h" | 9 #include "base/location.h" |
8 #include "sync/api/sync_error_factory.h" | 10 #include "sync/api/sync_error_factory.h" |
9 | 11 |
10 namespace syncer { | 12 namespace syncer { |
11 | 13 |
12 FakeSyncableService::FakeSyncableService() | 14 FakeSyncableService::FakeSyncableService() |
13 : syncing_(false), | 15 : syncing_(false), |
14 type_(UNSPECIFIED) {} | 16 type_(UNSPECIFIED) {} |
15 | 17 |
16 FakeSyncableService::~FakeSyncableService() {} | 18 FakeSyncableService::~FakeSyncableService() {} |
17 | 19 |
18 void FakeSyncableService::set_merge_data_and_start_syncing_error( | 20 void FakeSyncableService::set_merge_data_and_start_syncing_error( |
19 const SyncError& error) { | 21 const SyncError& error) { |
20 merge_data_and_start_syncing_error_ = error; | 22 merge_data_and_start_syncing_error_ = error; |
21 } | 23 } |
22 | 24 |
23 void FakeSyncableService::set_process_sync_changes_error( | 25 void FakeSyncableService::set_process_sync_changes_error( |
24 const SyncError& error) { | 26 const SyncError& error) { |
25 process_sync_changes_error_ = error; | 27 process_sync_changes_error_ = error; |
26 } | 28 } |
27 | 29 |
28 void FakeSyncableService::set_attachment_store( | 30 void FakeSyncableService::set_attachment_store( |
29 scoped_ptr<AttachmentStore> attachment_store) { | 31 scoped_ptr<AttachmentStore> attachment_store) { |
30 attachment_store_ = attachment_store.Pass(); | 32 attachment_store_ = std::move(attachment_store); |
31 } | 33 } |
32 | 34 |
33 const AttachmentService* FakeSyncableService::attachment_service() const { | 35 const AttachmentService* FakeSyncableService::attachment_service() const { |
34 return attachment_service_.get(); | 36 return attachment_service_.get(); |
35 } | 37 } |
36 | 38 |
37 bool FakeSyncableService::syncing() const { | 39 bool FakeSyncableService::syncing() const { |
38 return syncing_; | 40 return syncing_; |
39 } | 41 } |
40 | 42 |
41 // SyncableService implementation. | 43 // SyncableService implementation. |
42 SyncMergeResult FakeSyncableService::MergeDataAndStartSyncing( | 44 SyncMergeResult FakeSyncableService::MergeDataAndStartSyncing( |
43 ModelType type, | 45 ModelType type, |
44 const SyncDataList& initial_sync_data, | 46 const SyncDataList& initial_sync_data, |
45 scoped_ptr<SyncChangeProcessor> sync_processor, | 47 scoped_ptr<SyncChangeProcessor> sync_processor, |
46 scoped_ptr<SyncErrorFactory> sync_error_factory) { | 48 scoped_ptr<SyncErrorFactory> sync_error_factory) { |
47 SyncMergeResult merge_result(type); | 49 SyncMergeResult merge_result(type); |
48 sync_processor_ = sync_processor.Pass(); | 50 sync_processor_ = std::move(sync_processor); |
49 type_ = type; | 51 type_ = type; |
50 if (!merge_data_and_start_syncing_error_.IsSet()) { | 52 if (!merge_data_and_start_syncing_error_.IsSet()) { |
51 syncing_ = true; | 53 syncing_ = true; |
52 } else { | 54 } else { |
53 merge_result.set_error(merge_data_and_start_syncing_error_); | 55 merge_result.set_error(merge_data_and_start_syncing_error_); |
54 } | 56 } |
55 return merge_result; | 57 return merge_result; |
56 } | 58 } |
57 | 59 |
58 void FakeSyncableService::StopSyncing(ModelType type) { | 60 void FakeSyncableService::StopSyncing(ModelType type) { |
(...skipping 12 matching lines...) Expand all Loading... |
71 } | 73 } |
72 | 74 |
73 scoped_ptr<AttachmentStoreForSync> | 75 scoped_ptr<AttachmentStoreForSync> |
74 FakeSyncableService::GetAttachmentStoreForSync() { | 76 FakeSyncableService::GetAttachmentStoreForSync() { |
75 return attachment_store_ ? attachment_store_->CreateAttachmentStoreForSync() | 77 return attachment_store_ ? attachment_store_->CreateAttachmentStoreForSync() |
76 : scoped_ptr<AttachmentStoreForSync>(); | 78 : scoped_ptr<AttachmentStoreForSync>(); |
77 } | 79 } |
78 | 80 |
79 void FakeSyncableService::SetAttachmentService( | 81 void FakeSyncableService::SetAttachmentService( |
80 scoped_ptr<AttachmentService> attachment_service) { | 82 scoped_ptr<AttachmentService> attachment_service) { |
81 attachment_service_ = attachment_service.Pass(); | 83 attachment_service_ = std::move(attachment_service); |
82 } | 84 } |
83 | 85 |
84 } // namespace syncer | 86 } // namespace syncer |
OLD | NEW |