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