Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(989)

Unified Diff: sync/internal_api/public/test/fake_metadata_change_list.h

Issue 1565503003: Use MetadataChangeList and EntityChangeList in SharedModelTypeProcessor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added ClearDataTypeState Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sync/internal_api/public/test/fake_metadata_change_list.h
diff --git a/sync/internal_api/public/test/fake_metadata_change_list.h b/sync/internal_api/public/test/fake_metadata_change_list.h
new file mode 100644
index 0000000000000000000000000000000000000000..6359602ac96532533f4f3f97f748bfeca7db2826
--- /dev/null
+++ b/sync/internal_api/public/test/fake_metadata_change_list.h
@@ -0,0 +1,57 @@
+// Copyright 2016 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_INTERNAL_API_PUBLIC_TEST_FAKE_METADATA_CHANGE_LIST_H_
+#define SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_METADATA_CHANGE_LIST_H_
+
+#include <vector>
+
+#include "sync/api/metadata_change_list.h"
+#include "sync/internal_api/public/non_blocking_sync_common.h"
+#include "sync/protocol/entity_metadata.pb.h"
+
+namespace syncer_v2 {
+
+// A non-functional implementation of MetadataChangeList for
+// testing purposes.
+// This class simply records all calls with all arguments for further
+// analysis by the test code.
+class FakeMetadataChangeList : public MetadataChangeList {
+ public:
+ FakeMetadataChangeList();
+ ~FakeMetadataChangeList() override;
+
+ void UpdateDataTypeState(const DataTypeState& data_type_state) override;
+ void ClearDataTypeState() override;
+ void UpdateMetadata(const std::string& client_tag,
+ const sync_pb::EntityMetadata& metadata) override;
+ void ClearMetadata(const std::string& client_tag) override;
+
+ enum Action {
+ UPDATE_DATA_TYPE_STATE,
+ CLEAR_DATA_TYPE_STATE,
+ UPDATE_METADATA,
+ CLEAR_METADATA
+ };
+
+ struct Record {
+ Record();
+ virtual ~Record();
+
+ Action action;
+ std::string tag;
+ DataTypeState data_type_state;
+ sync_pb::EntityMetadata metadata;
+ };
+
+ size_t GetNumRecords() const;
+ const Record& GetNthRecord(size_t n) const;
+
+ private:
+ std::vector<Record> records_;
+};
+
+} // namespace syncer_v2
+
+#endif // SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_METADATA_CHANGE_LIST_H_
« no previous file with comments | « sync/internal_api/public/simple_metadata_change_list.cc ('k') | sync/internal_api/public/test/fake_model_type_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698