OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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. |
| 4 |
| 5 #ifndef SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_METADATA_CHANGE_LIST_H_ |
| 6 #define SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_METADATA_CHANGE_LIST_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "sync/api/metadata_change_list.h" |
| 11 #include "sync/internal_api/public/non_blocking_sync_common.h" |
| 12 #include "sync/protocol/entity_metadata.pb.h" |
| 13 |
| 14 namespace syncer_v2 { |
| 15 |
| 16 // A non-functional implementation of MetadataChangeList for |
| 17 // testing purposes. |
| 18 // This class simply records all calls with all arguments for further |
| 19 // analysis by the test code. |
| 20 class FakeMetadataChangeList : public MetadataChangeList { |
| 21 public: |
| 22 FakeMetadataChangeList(); |
| 23 ~FakeMetadataChangeList() override; |
| 24 |
| 25 void UpdateDataTypeState(const DataTypeState& data_type_state) override; |
| 26 void ClearDataTypeState() override; |
| 27 void UpdateMetadata(const std::string& client_tag, |
| 28 const sync_pb::EntityMetadata& metadata) override; |
| 29 void ClearMetadata(const std::string& client_tag) override; |
| 30 |
| 31 enum Action { |
| 32 UPDATE_DATA_TYPE_STATE, |
| 33 CLEAR_DATA_TYPE_STATE, |
| 34 UPDATE_METADATA, |
| 35 CLEAR_METADATA |
| 36 }; |
| 37 |
| 38 struct Record { |
| 39 Record(); |
| 40 virtual ~Record(); |
| 41 |
| 42 Action action; |
| 43 std::string tag; |
| 44 DataTypeState data_type_state; |
| 45 sync_pb::EntityMetadata metadata; |
| 46 }; |
| 47 |
| 48 size_t GetNumRecords() const; |
| 49 const Record& GetNthRecord(size_t n) const; |
| 50 |
| 51 private: |
| 52 std::vector<Record> records_; |
| 53 }; |
| 54 |
| 55 } // namespace syncer_v2 |
| 56 |
| 57 #endif // SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_METADATA_CHANGE_LIST_H_ |
OLD | NEW |