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