summaryrefslogtreecommitdiffstats
path: root/sync/api/fake_sync_change_processor.h
blob: d34c4fc8bc21710171f54df1ff7fdce59f6a68da (plain)
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
// Copyright 2013 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.

#ifndef SYNC_API_FAKE_SYNC_CHANGE_PROCESSOR_H_
#define SYNC_API_FAKE_SYNC_CHANGE_PROCESSOR_H_

#include <string>

#include "base/macros.h"
#include "sync/api/sync_change_processor.h"

namespace syncer {

class FakeSyncChangeProcessor : public SyncChangeProcessor {
 public:
  FakeSyncChangeProcessor();
  ~FakeSyncChangeProcessor() override;

  // SyncChangeProcessor implementation.
  //
  // ProcessSyncChanges will accumulate changes in changes() until they are
  // cleared.
  syncer::SyncError ProcessSyncChanges(
      const tracked_objects::Location& from_here,
      const syncer::SyncChangeList& change_list) override;

  // SyncChangeProcessor implementation.
  //
  // Returns data().
  syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override;

  // SyncChangeProcessor implementation.
  //
  // Updates context().
  syncer::SyncError UpdateDataTypeContext(ModelType type,
                                          ContextRefreshStatus refresh_status,
                                          const std::string& context) override;

  virtual const syncer::SyncChangeList& changes() const;
  virtual syncer::SyncChangeList& changes();

  virtual const syncer::SyncDataList& data() const;
  virtual syncer::SyncDataList& data();

  virtual const std::string& context() const;
  virtual std::string& context();

 private:
  syncer::SyncChangeList changes_;
  syncer::SyncDataList data_;
  std::string context_;

  DISALLOW_COPY_AND_ASSIGN(FakeSyncChangeProcessor);
};

}  // namespace syncer

#endif  // SYNC_API_FAKE_SYNC_CHANGE_PROCESSOR_H_