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

Side by Side Diff: components/sync/engine_impl/worker_entity_tracker_unittest.cc

Issue 2350803005: [Sync] Fixing two bugs in the worker revealed by trying to add an encryption integration test. (Closed)
Patch Set: Merging conflict. Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « components/sync/engine_impl/worker_entity_tracker.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Copyright 2014 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 #include "components/sync/engine_impl/worker_entity_tracker.h" 6 #include "components/sync/engine_impl/worker_entity_tracker.h"
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 TEST_F(WorkerEntityTrackerTest, ReflectedUpdateDoesntClobberCommit) { 162 TEST_F(WorkerEntityTrackerTest, ReflectedUpdateDoesntClobberCommit) {
163 CommitRequestData data = MakeCommitRequestData(22, 33); 163 CommitRequestData data = MakeCommitRequestData(22, 33);
164 entity_->RequestCommit(data); 164 entity_->RequestCommit(data);
165 165
166 EXPECT_TRUE(entity_->HasPendingCommit()); 166 EXPECT_TRUE(entity_->HasPendingCommit());
167 167
168 entity_->ReceiveUpdate(MakeUpdateResponseData(33)); // Version 33 == 33. 168 entity_->ReceiveUpdate(MakeUpdateResponseData(33)); // Version 33 == 33.
169 EXPECT_TRUE(entity_->HasPendingCommit()); 169 EXPECT_TRUE(entity_->HasPendingCommit());
170 } 170 }
171 171
172 // Request two commits, both with the same old version. The second commit should
173 // have the updated server version.
174 TEST_F(WorkerEntityTrackerTest, QuickCommits) {
175 const int64_t kLocalBaseVersion = 10;
176 const int64_t kCommitResponseVersion = 11;
177 entity_->RequestCommit(MakeCommitRequestData(1, kLocalBaseVersion));
178 CommitResponseData ack;
179 ack.response_version = kCommitResponseVersion;
180 ack.id = kServerId;
181 entity_->ReceiveCommitResponse(&ack);
182
183 entity_->RequestCommit(MakeCommitRequestData(1, kLocalBaseVersion));
184 sync_pb::SyncEntity pb_entity;
185 entity_->PopulateCommitProto(&pb_entity);
186 EXPECT_EQ(kCommitResponseVersion, pb_entity.version());
187 }
188
172 } // namespace syncer_v2 189 } // namespace syncer_v2
OLDNEW
« no previous file with comments | « components/sync/engine_impl/worker_entity_tracker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698