| 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> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "sync/api/sync_error_factory.h" | 10 #include "sync/api/sync_error_factory.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 const SyncError& error) { | 21 const SyncError& error) { |
| 22 merge_data_and_start_syncing_error_ = error; | 22 merge_data_and_start_syncing_error_ = error; |
| 23 } | 23 } |
| 24 | 24 |
| 25 void FakeSyncableService::set_process_sync_changes_error( | 25 void FakeSyncableService::set_process_sync_changes_error( |
| 26 const SyncError& error) { | 26 const SyncError& error) { |
| 27 process_sync_changes_error_ = error; | 27 process_sync_changes_error_ = error; |
| 28 } | 28 } |
| 29 | 29 |
| 30 void FakeSyncableService::set_attachment_store( | 30 void FakeSyncableService::set_attachment_store( |
| 31 scoped_ptr<AttachmentStore> attachment_store) { | 31 std::unique_ptr<AttachmentStore> attachment_store) { |
| 32 attachment_store_ = std::move(attachment_store); | 32 attachment_store_ = std::move(attachment_store); |
| 33 } | 33 } |
| 34 | 34 |
| 35 const AttachmentService* FakeSyncableService::attachment_service() const { | 35 const AttachmentService* FakeSyncableService::attachment_service() const { |
| 36 return attachment_service_.get(); | 36 return attachment_service_.get(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool FakeSyncableService::syncing() const { | 39 bool FakeSyncableService::syncing() const { |
| 40 return syncing_; | 40 return syncing_; |
| 41 } | 41 } |
| 42 | 42 |
| 43 // SyncableService implementation. | 43 // SyncableService implementation. |
| 44 SyncMergeResult FakeSyncableService::MergeDataAndStartSyncing( | 44 SyncMergeResult FakeSyncableService::MergeDataAndStartSyncing( |
| 45 ModelType type, | 45 ModelType type, |
| 46 const SyncDataList& initial_sync_data, | 46 const SyncDataList& initial_sync_data, |
| 47 scoped_ptr<SyncChangeProcessor> sync_processor, | 47 std::unique_ptr<SyncChangeProcessor> sync_processor, |
| 48 scoped_ptr<SyncErrorFactory> sync_error_factory) { | 48 std::unique_ptr<SyncErrorFactory> sync_error_factory) { |
| 49 SyncMergeResult merge_result(type); | 49 SyncMergeResult merge_result(type); |
| 50 sync_processor_ = std::move(sync_processor); | 50 sync_processor_ = std::move(sync_processor); |
| 51 type_ = type; | 51 type_ = type; |
| 52 if (!merge_data_and_start_syncing_error_.IsSet()) { | 52 if (!merge_data_and_start_syncing_error_.IsSet()) { |
| 53 syncing_ = true; | 53 syncing_ = true; |
| 54 } else { | 54 } else { |
| 55 merge_result.set_error(merge_data_and_start_syncing_error_); | 55 merge_result.set_error(merge_data_and_start_syncing_error_); |
| 56 } | 56 } |
| 57 return merge_result; | 57 return merge_result; |
| 58 } | 58 } |
| 59 | 59 |
| 60 void FakeSyncableService::StopSyncing(ModelType type) { | 60 void FakeSyncableService::StopSyncing(ModelType type) { |
| 61 syncing_ = false; | 61 syncing_ = false; |
| 62 sync_processor_.reset(); | 62 sync_processor_.reset(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 SyncDataList FakeSyncableService::GetAllSyncData(ModelType type) const { | 65 SyncDataList FakeSyncableService::GetAllSyncData(ModelType type) const { |
| 66 return SyncDataList(); | 66 return SyncDataList(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 SyncError FakeSyncableService::ProcessSyncChanges( | 69 SyncError FakeSyncableService::ProcessSyncChanges( |
| 70 const tracked_objects::Location& from_here, | 70 const tracked_objects::Location& from_here, |
| 71 const SyncChangeList& change_list) { | 71 const SyncChangeList& change_list) { |
| 72 return process_sync_changes_error_; | 72 return process_sync_changes_error_; |
| 73 } | 73 } |
| 74 | 74 |
| 75 scoped_ptr<AttachmentStoreForSync> | 75 std::unique_ptr<AttachmentStoreForSync> |
| 76 FakeSyncableService::GetAttachmentStoreForSync() { | 76 FakeSyncableService::GetAttachmentStoreForSync() { |
| 77 return attachment_store_ ? attachment_store_->CreateAttachmentStoreForSync() | 77 return attachment_store_ ? attachment_store_->CreateAttachmentStoreForSync() |
| 78 : scoped_ptr<AttachmentStoreForSync>(); | 78 : std::unique_ptr<AttachmentStoreForSync>(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void FakeSyncableService::SetAttachmentService( | 81 void FakeSyncableService::SetAttachmentService( |
| 82 scoped_ptr<AttachmentService> attachment_service) { | 82 std::unique_ptr<AttachmentService> attachment_service) { |
| 83 attachment_service_ = std::move(attachment_service); | 83 attachment_service_ = std::move(attachment_service); |
| 84 } | 84 } |
| 85 | 85 |
| 86 } // namespace syncer | 86 } // namespace syncer |
| OLD | NEW |