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.
5 #include "components/sync_driver/fake_generic_change_processor.h"
7 #include "base/location.h"
8 #include "base/memory/weak_ptr.h"
9 #include "sync/api/attachments/attachment_service_impl.h"
10 #include "sync/api/syncable_service.h"
12 namespace browser_sync
{
14 FakeGenericChangeProcessor::FakeGenericChangeProcessor(
15 SyncApiComponentFactory
* sync_factory
)
16 : GenericChangeProcessor(NULL
,
17 base::WeakPtr
<syncer::SyncableService
>(),
18 base::WeakPtr
<syncer::SyncMergeResult
>(),
21 sync_model_has_user_created_nodes_(true),
22 sync_model_has_user_created_nodes_success_(true) {}
24 FakeGenericChangeProcessor::~FakeGenericChangeProcessor() {}
26 void FakeGenericChangeProcessor::set_sync_model_has_user_created_nodes(
28 sync_model_has_user_created_nodes_
= has_nodes
;
30 void FakeGenericChangeProcessor::set_sync_model_has_user_created_nodes_success(
32 sync_model_has_user_created_nodes_success_
= success
;
35 syncer::SyncError
FakeGenericChangeProcessor::ProcessSyncChanges(
36 const tracked_objects::Location
& from_here
,
37 const syncer::SyncChangeList
& change_list
) {
38 return syncer::SyncError();
41 syncer::SyncError
FakeGenericChangeProcessor::GetAllSyncDataReturnError(
42 syncer::ModelType type
, syncer::SyncDataList
* current_sync_data
) const {
43 return syncer::SyncError();
46 bool FakeGenericChangeProcessor::GetDataTypeContext(
47 syncer::ModelType type
,
48 std::string
* context
) const {
52 int FakeGenericChangeProcessor::GetSyncCountForType(syncer::ModelType type
) {
56 bool FakeGenericChangeProcessor::SyncModelHasUserCreatedNodes(
57 syncer::ModelType type
, bool* has_nodes
) {
58 *has_nodes
= sync_model_has_user_created_nodes_
;
59 return sync_model_has_user_created_nodes_success_
;
62 bool FakeGenericChangeProcessor::CryptoReadyIfNecessary(
63 syncer::ModelType type
) {
67 FakeGenericChangeProcessorFactory::FakeGenericChangeProcessorFactory(
68 scoped_ptr
<FakeGenericChangeProcessor
> processor
)
69 : processor_(processor
.Pass()) {}
71 FakeGenericChangeProcessorFactory::~FakeGenericChangeProcessorFactory() {}
73 scoped_ptr
<GenericChangeProcessor
>
74 FakeGenericChangeProcessorFactory::CreateGenericChangeProcessor(
75 syncer::UserShare
* user_share
,
76 browser_sync::DataTypeErrorHandler
* error_handler
,
77 const base::WeakPtr
<syncer::SyncableService
>& local_service
,
78 const base::WeakPtr
<syncer::SyncMergeResult
>& merge_result
,
79 SyncApiComponentFactory
* sync_factory
) {
80 return processor_
.PassAs
<GenericChangeProcessor
>();
83 } // namespace browser_sync