1 // Copyright (c) 2012 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 "chrome/browser/sync/glue/fake_generic_change_processor.h"
7 #include "base/location.h"
8 #include "base/memory/weak_ptr.h"
9 #include "sync/api/syncable_service.h"
11 namespace browser_sync
{
13 FakeGenericChangeProcessor::FakeGenericChangeProcessor()
14 : GenericChangeProcessor(
16 base::WeakPtr
<syncer::SyncableService
>(),
17 base::WeakPtr
<syncer::SyncMergeResult
>(),
19 sync_model_has_user_created_nodes_(true),
20 sync_model_has_user_created_nodes_success_(true),
21 crypto_ready_if_necessary_(true) {}
23 FakeGenericChangeProcessor::~FakeGenericChangeProcessor() {}
25 void FakeGenericChangeProcessor::set_process_sync_changes_error(
26 const syncer::SyncError
& error
) {
27 process_sync_changes_error_
= error
;
29 void FakeGenericChangeProcessor::set_get_sync_data_for_type_error(
30 const syncer::SyncError
& error
) {
31 get_sync_data_for_type_error_
= error
;
33 void FakeGenericChangeProcessor::set_sync_model_has_user_created_nodes(
35 sync_model_has_user_created_nodes_
= has_nodes
;
37 void FakeGenericChangeProcessor::set_sync_model_has_user_created_nodes_success(
39 sync_model_has_user_created_nodes_success_
= success
;
41 void FakeGenericChangeProcessor::set_crypto_ready_if_necessary(
43 crypto_ready_if_necessary_
= crypto_ready
;
46 syncer::SyncError
FakeGenericChangeProcessor::ProcessSyncChanges(
47 const tracked_objects::Location
& from_here
,
48 const syncer::SyncChangeList
& change_list
) {
49 return process_sync_changes_error_
;
52 syncer::SyncError
FakeGenericChangeProcessor::GetAllSyncDataReturnError(
53 syncer::ModelType type
, syncer::SyncDataList
* current_sync_data
) const {
54 return get_sync_data_for_type_error_
;
57 int FakeGenericChangeProcessor::GetSyncCountForType(syncer::ModelType type
) {
61 bool FakeGenericChangeProcessor::SyncModelHasUserCreatedNodes(
62 syncer::ModelType type
, bool* has_nodes
) {
63 *has_nodes
= sync_model_has_user_created_nodes_
;
64 return sync_model_has_user_created_nodes_success_
;
67 bool FakeGenericChangeProcessor::CryptoReadyIfNecessary(
68 syncer::ModelType type
) {
69 return crypto_ready_if_necessary_
;
72 } // namespace browser_sync