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