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/fake_attachment_service.h"
10 #include "sync/api/syncable_service.h"
12 namespace browser_sync
{
14 FakeGenericChangeProcessor::FakeGenericChangeProcessor()
15 : GenericChangeProcessor(NULL
,
16 base::WeakPtr
<syncer::SyncableService
>(),
17 base::WeakPtr
<syncer::SyncMergeResult
>(),
19 syncer::FakeAttachmentService::CreateForTest()),
20 sync_model_has_user_created_nodes_(true),
21 sync_model_has_user_created_nodes_success_(true) {}
23 FakeGenericChangeProcessor::~FakeGenericChangeProcessor() {}
25 void FakeGenericChangeProcessor::set_sync_model_has_user_created_nodes(
27 sync_model_has_user_created_nodes_
= has_nodes
;
29 void FakeGenericChangeProcessor::set_sync_model_has_user_created_nodes_success(
31 sync_model_has_user_created_nodes_success_
= success
;
34 syncer::SyncError
FakeGenericChangeProcessor::ProcessSyncChanges(
35 const tracked_objects::Location
& from_here
,
36 const syncer::SyncChangeList
& change_list
) {
37 return syncer::SyncError();
40 syncer::SyncError
FakeGenericChangeProcessor::GetAllSyncDataReturnError(
41 syncer::ModelType type
, syncer::SyncDataList
* current_sync_data
) const {
42 return syncer::SyncError();
45 bool FakeGenericChangeProcessor::GetDataTypeContext(
46 syncer::ModelType type
,
47 std::string
* context
) const {
51 int FakeGenericChangeProcessor::GetSyncCountForType(syncer::ModelType type
) {
55 bool FakeGenericChangeProcessor::SyncModelHasUserCreatedNodes(
56 syncer::ModelType type
, bool* has_nodes
) {
57 *has_nodes
= sync_model_has_user_created_nodes_
;
58 return sync_model_has_user_created_nodes_success_
;
61 bool FakeGenericChangeProcessor::CryptoReadyIfNecessary(
62 syncer::ModelType type
) {
66 FakeGenericChangeProcessorFactory::FakeGenericChangeProcessorFactory(
67 scoped_ptr
<FakeGenericChangeProcessor
> processor
)
68 : processor_(processor
.Pass()) {}
70 FakeGenericChangeProcessorFactory::~FakeGenericChangeProcessorFactory() {}
72 scoped_ptr
<GenericChangeProcessor
>
73 FakeGenericChangeProcessorFactory::CreateGenericChangeProcessor(
74 syncer::UserShare
* user_share
,
75 browser_sync::DataTypeErrorHandler
* error_handler
,
76 const base::WeakPtr
<syncer::SyncableService
>& local_service
,
77 const base::WeakPtr
<syncer::SyncMergeResult
>& merge_result
,
78 scoped_ptr
<syncer::AttachmentService
> attachment_service
) {
79 return processor_
.PassAs
<GenericChangeProcessor
>();
82 } // namespace browser_sync