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

Unified Diff: components/sync/test/engine/mock_model_type_worker.h

Issue 2222373003: [Sync] Adding storage key concept for ModelTypeServices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing redundant hash value. Created 4 years, 4 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: components/sync/test/engine/mock_model_type_worker.h
diff --git a/components/sync/test/engine/mock_model_type_worker.h b/components/sync/test/engine/mock_model_type_worker.h
index b4a98793ccc28c0c86a277109a414e5c8d50d3ca..7f9e0900ffaa5c2fefb18d9b5b3622c5d1b34352 100644
--- a/components/sync/test/engine/mock_model_type_worker.h
+++ b/components/sync/test/engine/mock_model_type_worker.h
@@ -18,6 +18,7 @@
#include "components/sync/core/non_blocking_sync_common.h"
#include "components/sync/engine_impl/commit_queue.h"
#include "components/sync/protocol/data_type_state.pb.h"
+#include "components/sync/protocol/sync.pb.h"
namespace syncer_v2 {
@@ -38,47 +39,50 @@ class MockModelTypeWorker : public CommitQueue {
// Getters to inspect the requests sent to this object.
size_t GetNumPendingCommits() const;
CommitRequestDataList GetNthPendingCommit(size_t n) const;
- bool HasPendingCommitForTag(const std::string& tag) const;
- CommitRequestData GetLatestPendingCommitForTag(const std::string& tag) const;
+ bool HasPendingCommitForHash(const std::string& tag_hash) const;
+ CommitRequestData GetLatestPendingCommitForHash(
+ const std::string& tag_hash) const;
// Expect that the |n|th commit request list has one commit request for |tag|
// with |value| set.
void ExpectNthPendingCommit(size_t n,
- const std::string& tag,
- const std::string& value);
+ const std::string& tag_hash,
+ const sync_pb::EntitySpecifics& specifics);
- // For each tag in |tags|, expect a corresponding request list of length one.
- void ExpectPendingCommits(const std::vector<std::string>& tags);
+ // For each hash in |tag_hashes|, expect a corresponding request list of
+ // length one.
+ void ExpectPendingCommits(const std::vector<std::string>& tag_hashes);
// Trigger an update from the server containing a single entity. See
// GenerateUpdateData for parameter descriptions. |version_offset| defaults to
// 1 and |ekn| defaults to the current encryption key name the worker has.
- void UpdateFromServer(const std::string& tag, const std::string& value);
- void UpdateFromServer(const std::string& tag,
- const std::string& value,
+ void UpdateFromServer(const std::string& tag_hash,
+ const sync_pb::EntitySpecifics& specifics);
+ void UpdateFromServer(const std::string& tag_hash,
+ const sync_pb::EntitySpecifics& specifics,
int64_t version_offset);
- void UpdateFromServer(const std::string& tag,
- const std::string& value,
+ void UpdateFromServer(const std::string& tag_hash,
+ const sync_pb::EntitySpecifics& specifics,
int64_t version_offset,
const std::string& ekn);
// Returns an UpdateResponseData representing an update received from
- // the server. Updates server state accordingly. |tag| is used to generate the
- // tag hash and the specifics along with |value|.
+ // the server. Updates server state accordingly.
//
// The |version_offset| field can be used to emulate stale data (ie. versions
// going backwards), reflections and redeliveries (ie. several instances of
// the same version) or new updates.
//
// |ekn| is the encryption key name this item will fake having.
- UpdateResponseData GenerateUpdateData(const std::string& tag,
- const std::string& value,
- int64_t version_offset,
- const std::string& ekn);
+ UpdateResponseData GenerateUpdateData(
+ const std::string& tag_hash,
+ const sync_pb::EntitySpecifics& specifics,
+ int64_t version_offset,
+ const std::string& ekn);
- // Triggers a server-side deletion of the entity with |tag|; updates server
- // state accordingly.
- void TombstoneFromServer(const std::string& tag);
+ // Triggers a server-side deletion of the entity with |tag_hash|; updates
+ // server state accordingly.
+ void TombstoneFromServer(const std::string& tag_hash);
// Pops one pending commit from the front of the queue and send a commit
// response to the processor for it.
@@ -111,7 +115,7 @@ class MockModelTypeWorker : public CommitQueue {
// A record of past commits requests.
std::deque<CommitRequestDataList> pending_commits_;
- // Map of versions by client tag.
+ // Map of versions by client tag hash.
// This is an essential part of the mocked server state.
std::map<const std::string, int64_t> server_versions_;
« no previous file with comments | « components/sync/core/shared_model_type_processor_unittest.cc ('k') | components/sync/test/engine/mock_model_type_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698