| 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 "sync/engine/worker_entity_tracker.h" | 6 #include "sync/engine/worker_entity_tracker.h" |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include <memory> |
| 11 |
| 11 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 12 #include "sync/internal_api/public/base/model_type.h" | 13 #include "sync/internal_api/public/base/model_type.h" |
| 13 #include "sync/internal_api/public/non_blocking_sync_common.h" | 14 #include "sync/internal_api/public/non_blocking_sync_common.h" |
| 14 #include "sync/syncable/syncable_util.h" | 15 #include "sync/syncable/syncable_util.h" |
| 15 #include "sync/util/time.h" | 16 #include "sync/util/time.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 18 |
| 18 namespace syncer_v2 { | 19 namespace syncer_v2 { |
| 19 | 20 |
| 20 // Some simple tests for the WorkerEntityTracker. | 21 // Some simple tests for the WorkerEntityTracker. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 response_data.response_version = response_version; | 70 response_data.response_version = response_version; |
| 70 return response_data; | 71 return response_data; |
| 71 } | 72 } |
| 72 | 73 |
| 73 const std::string kServerId; | 74 const std::string kServerId; |
| 74 const std::string kClientTag; | 75 const std::string kClientTag; |
| 75 const std::string kClientTagHash; | 76 const std::string kClientTagHash; |
| 76 const base::Time kCtime; | 77 const base::Time kCtime; |
| 77 const base::Time kMtime; | 78 const base::Time kMtime; |
| 78 sync_pb::EntitySpecifics specifics; | 79 sync_pb::EntitySpecifics specifics; |
| 79 scoped_ptr<WorkerEntityTracker> entity_; | 80 std::unique_ptr<WorkerEntityTracker> entity_; |
| 80 }; | 81 }; |
| 81 | 82 |
| 82 // Construct a new entity from a server update. Then receive another update. | 83 // Construct a new entity from a server update. Then receive another update. |
| 83 TEST_F(WorkerEntityTrackerTest, FromUpdateResponse) { | 84 TEST_F(WorkerEntityTrackerTest, FromUpdateResponse) { |
| 84 EXPECT_FALSE(entity_->HasPendingCommit()); | 85 EXPECT_FALSE(entity_->HasPendingCommit()); |
| 85 entity_->ReceiveUpdate(20); | 86 entity_->ReceiveUpdate(20); |
| 86 EXPECT_FALSE(entity_->HasPendingCommit()); | 87 EXPECT_FALSE(entity_->HasPendingCommit()); |
| 87 } | 88 } |
| 88 | 89 |
| 89 // Construct a new entity from a commit request. Then serialize it. | 90 // Construct a new entity from a commit request. Then serialize it. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 CommitRequestData data = MakeCommitRequestData(22, 33); | 144 CommitRequestData data = MakeCommitRequestData(22, 33); |
| 144 entity_->RequestCommit(data); | 145 entity_->RequestCommit(data); |
| 145 | 146 |
| 146 EXPECT_TRUE(entity_->HasPendingCommit()); | 147 EXPECT_TRUE(entity_->HasPendingCommit()); |
| 147 | 148 |
| 148 entity_->ReceiveUpdate(33); // Version 33 == 33. | 149 entity_->ReceiveUpdate(33); // Version 33 == 33. |
| 149 EXPECT_TRUE(entity_->HasPendingCommit()); | 150 EXPECT_TRUE(entity_->HasPendingCommit()); |
| 150 } | 151 } |
| 151 | 152 |
| 152 } // namespace syncer_v2 | 153 } // namespace syncer_v2 |
| OLD | NEW |