Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / components / sync_driver / fake_generic_change_processor.cc
blobc306758d5665b6794b2700abfc4c806fe7791316
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/syncable_service.h"
10 #include "sync/internal_api/public/attachments/attachment_service_impl.h"
12 namespace sync_driver {
14 FakeGenericChangeProcessor::FakeGenericChangeProcessor(
15 SyncApiComponentFactory* sync_factory)
16 : GenericChangeProcessor(NULL,
17 base::WeakPtr<syncer::SyncableService>(),
18 base::WeakPtr<syncer::SyncMergeResult>(),
19 NULL,
20 sync_factory),
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(
27 bool has_nodes) {
28 sync_model_has_user_created_nodes_ = has_nodes;
30 void FakeGenericChangeProcessor::set_sync_model_has_user_created_nodes_success(
31 bool 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 {
49 return false;
52 int FakeGenericChangeProcessor::GetSyncCountForType(syncer::ModelType type) {
53 return 0;
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) {
64 return true;
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 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 sync_driver