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),
22 type_(syncer::UNSPECIFIED
) {}
24 FakeGenericChangeProcessor::~FakeGenericChangeProcessor() {}
26 void FakeGenericChangeProcessor::set_process_sync_changes_error(
27 const syncer::SyncError
& error
) {
28 process_sync_changes_error_
= error
;
30 void FakeGenericChangeProcessor::set_get_sync_data_for_type_error(
31 const syncer::SyncError
& error
) {
32 get_sync_data_for_type_error_
= error
;
34 void FakeGenericChangeProcessor::set_sync_model_has_user_created_nodes(
36 sync_model_has_user_created_nodes_
= has_nodes
;
38 void FakeGenericChangeProcessor::set_sync_model_has_user_created_nodes_success(
40 sync_model_has_user_created_nodes_success_
= success
;
42 void FakeGenericChangeProcessor::set_crypto_ready_if_necessary(
44 crypto_ready_if_necessary_
= crypto_ready
;
47 syncer::SyncError
FakeGenericChangeProcessor::ProcessSyncChanges(
48 const tracked_objects::Location
& from_here
,
49 const syncer::SyncChangeList
& change_list
) {
50 return process_sync_changes_error_
;
53 syncer::SyncError
FakeGenericChangeProcessor::GetSyncDataForType(
54 syncer::ModelType type
, syncer::SyncDataList
* current_sync_data
) {
56 return get_sync_data_for_type_error_
;
59 int FakeGenericChangeProcessor::GetSyncCountForType(syncer::ModelType type
) {
63 bool FakeGenericChangeProcessor::SyncModelHasUserCreatedNodes(
64 syncer::ModelType type
, bool* has_nodes
) {
66 *has_nodes
= sync_model_has_user_created_nodes_
;
67 return sync_model_has_user_created_nodes_success_
;
70 bool FakeGenericChangeProcessor::CryptoReadyIfNecessary(
71 syncer::ModelType type
) {
73 return crypto_ready_if_necessary_
;
76 } // namespace browser_sync