OLD | NEW |
| (Empty) |
1 // Copyright 2014 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_driver/fake_generic_change_processor.h" | |
6 | |
7 #include <utility> | |
8 | |
9 #include "base/location.h" | |
10 #include "base/memory/weak_ptr.h" | |
11 #include "components/sync/api/syncable_service.h" | |
12 #include "components/sync/core/attachments/attachment_service_impl.h" | |
13 | |
14 namespace sync_driver { | |
15 | |
16 FakeGenericChangeProcessor::FakeGenericChangeProcessor( | |
17 syncer::ModelType type, | |
18 SyncClient* sync_client) | |
19 : GenericChangeProcessor(type, | |
20 NULL, | |
21 base::WeakPtr<syncer::SyncableService>(), | |
22 base::WeakPtr<syncer::SyncMergeResult>(), | |
23 NULL, | |
24 sync_client, | |
25 nullptr), | |
26 sync_model_has_user_created_nodes_(true), | |
27 sync_model_has_user_created_nodes_success_(true) { | |
28 } | |
29 | |
30 FakeGenericChangeProcessor::~FakeGenericChangeProcessor() {} | |
31 | |
32 void FakeGenericChangeProcessor::set_sync_model_has_user_created_nodes( | |
33 bool has_nodes) { | |
34 sync_model_has_user_created_nodes_ = has_nodes; | |
35 } | |
36 void FakeGenericChangeProcessor::set_sync_model_has_user_created_nodes_success( | |
37 bool success) { | |
38 sync_model_has_user_created_nodes_success_ = success; | |
39 } | |
40 | |
41 syncer::SyncError FakeGenericChangeProcessor::ProcessSyncChanges( | |
42 const tracked_objects::Location& from_here, | |
43 const syncer::SyncChangeList& change_list) { | |
44 return syncer::SyncError(); | |
45 } | |
46 | |
47 syncer::SyncError FakeGenericChangeProcessor::GetAllSyncDataReturnError( | |
48 syncer::SyncDataList* current_sync_data) const { | |
49 return syncer::SyncError(); | |
50 } | |
51 | |
52 bool FakeGenericChangeProcessor::GetDataTypeContext( | |
53 std::string* context) const { | |
54 return false; | |
55 } | |
56 | |
57 int FakeGenericChangeProcessor::GetSyncCount() { | |
58 return 0; | |
59 } | |
60 | |
61 bool FakeGenericChangeProcessor::SyncModelHasUserCreatedNodes(bool* has_nodes) { | |
62 *has_nodes = sync_model_has_user_created_nodes_; | |
63 return sync_model_has_user_created_nodes_success_; | |
64 } | |
65 | |
66 bool FakeGenericChangeProcessor::CryptoReadyIfNecessary() { | |
67 return true; | |
68 } | |
69 | |
70 FakeGenericChangeProcessorFactory::FakeGenericChangeProcessorFactory( | |
71 std::unique_ptr<FakeGenericChangeProcessor> processor) | |
72 : processor_(std::move(processor)) {} | |
73 | |
74 FakeGenericChangeProcessorFactory::~FakeGenericChangeProcessorFactory() {} | |
75 | |
76 std::unique_ptr<GenericChangeProcessor> | |
77 FakeGenericChangeProcessorFactory::CreateGenericChangeProcessor( | |
78 syncer::ModelType type, | |
79 syncer::UserShare* user_share, | |
80 syncer::DataTypeErrorHandler* error_handler, | |
81 const base::WeakPtr<syncer::SyncableService>& local_service, | |
82 const base::WeakPtr<syncer::SyncMergeResult>& merge_result, | |
83 SyncClient* sync_client) { | |
84 return std::move(processor_); | |
85 } | |
86 | |
87 } // namespace sync_driver | |
OLD | NEW |