OLD | NEW |
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 Loading... |
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 |
OLD | NEW |