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

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

Issue 2690913005: [Sync] Update EntityData on all codepaths from model type sync bridge (Closed)
Patch Set: Address comments Created 3 years, 10 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
« no previous file with comments | « components/sync/model_impl/shared_model_type_processor_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/test/engine/mock_model_type_worker.cc
diff --git a/components/sync/test/engine/mock_model_type_worker.cc b/components/sync/test/engine/mock_model_type_worker.cc
index 72476408e52054607f14e2eb8579dd81bb330443..2d87fc28b867e04558597c6659becc76adc11a38 100644
--- a/components/sync/test/engine/mock_model_type_worker.cc
+++ b/components/sync/test/engine/mock_model_type_worker.cc
@@ -25,6 +25,11 @@ MockModelTypeWorker::MockModelTypeWorker(
MockModelTypeWorker::~MockModelTypeWorker() {}
void MockModelTypeWorker::EnqueueForCommit(const CommitRequestDataList& list) {
+ // Verify that all request entities have valid id, version combinations.
+ for (const CommitRequestData& commit_request_data : list) {
+ EXPECT_TRUE(commit_request_data.base_version == -1 ||
+ !commit_request_data.entity->id.empty());
+ }
pending_commits_.push_back(list);
}
@@ -188,13 +193,13 @@ CommitResponseData MockModelTypeWorker::SuccessfulCommitResponse(
CommitResponseData response_data;
- if (request_data.base_version == 0) {
+ if (request_data.base_version == kUncommittedVersion) {
// Server assigns new ID to newly committed items.
DCHECK(entity.id.empty());
- response_data.id = entity.id;
+ response_data.id = GenerateId(client_tag_hash);
} else {
// Otherwise we reuse the ID from the request.
- response_data.id = GenerateId(client_tag_hash);
+ response_data.id = entity.id;
}
response_data.client_tag_hash = client_tag_hash;
« no previous file with comments | « components/sync/model_impl/shared_model_type_processor_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698