Roll leveldb 3f7758:803d69 (v1.17 -> v1.18)
[chromium-blink-merge.git] / sync / api / fake_syncable_service.h
blob8ecf05e2741b2c5becdf74548ed7209e9e673632
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 #ifndef SYNC_API_FAKE_SYNCABLE_SERVICE_H_
6 #define SYNC_API_FAKE_SYNCABLE_SERVICE_H_
8 #include "sync/api/syncable_service.h"
10 namespace syncer {
12 class SyncErrorFactory;
14 // A fake SyncableService that can return arbitrary values and maintains the
15 // syncing status.
16 class FakeSyncableService : public SyncableService {
17 public:
18 FakeSyncableService();
19 ~FakeSyncableService() override;
21 // Setters for SyncableService implementation results.
22 void set_merge_data_and_start_syncing_error(const SyncError& error);
23 void set_process_sync_changes_error(const SyncError& error);
25 // Whether we're syncing or not. Set on a successful MergeDataAndStartSyncing,
26 // unset on StopSyncing. False by default.
27 bool syncing() const;
29 // SyncableService implementation.
30 SyncMergeResult MergeDataAndStartSyncing(
31 ModelType type,
32 const SyncDataList& initial_sync_data,
33 scoped_ptr<SyncChangeProcessor> sync_processor,
34 scoped_ptr<SyncErrorFactory> sync_error_factory) override;
35 void StopSyncing(ModelType type) override;
36 SyncDataList GetAllSyncData(ModelType type) const override;
37 SyncError ProcessSyncChanges(const tracked_objects::Location& from_here,
38 const SyncChangeList& change_list) override;
40 private:
41 scoped_ptr<SyncChangeProcessor> sync_processor_;
42 SyncError merge_data_and_start_syncing_error_;
43 SyncError process_sync_changes_error_;
44 bool syncing_;
45 ModelType type_;
48 } // namespace syncer
50 #endif // SYNC_API_FAKE_SYNCABLE_SERVICE_H_