| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/sync/core/data_batch_impl.h" | 5 #include "components/sync/core/data_batch_impl.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace syncer_v2 { | 10 namespace syncer { |
| 11 | 11 |
| 12 TEST(DataBatchImplTest, PutAndNextWithReuse) { | 12 TEST(DataBatchImplTest, PutAndNextWithReuse) { |
| 13 EntityData* entity1 = new EntityData(); | 13 EntityData* entity1 = new EntityData(); |
| 14 EntityData* entity2 = new EntityData(); | 14 EntityData* entity2 = new EntityData(); |
| 15 | 15 |
| 16 DataBatchImpl batch; | 16 DataBatchImpl batch; |
| 17 EXPECT_FALSE(batch.HasNext()); | 17 EXPECT_FALSE(batch.HasNext()); |
| 18 | 18 |
| 19 batch.Put("one", base::WrapUnique(entity1)); | 19 batch.Put("one", base::WrapUnique(entity1)); |
| 20 EXPECT_TRUE(batch.HasNext()); | 20 EXPECT_TRUE(batch.HasNext()); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 EXPECT_TRUE(batch.HasNext()); | 81 EXPECT_TRUE(batch.HasNext()); |
| 82 EXPECT_EQ("same", pair1.first); | 82 EXPECT_EQ("same", pair1.first); |
| 83 EXPECT_EQ(entity1, pair1.second.get()); | 83 EXPECT_EQ(entity1, pair1.second.get()); |
| 84 | 84 |
| 85 const KeyAndData& pair2 = batch.Next(); | 85 const KeyAndData& pair2 = batch.Next(); |
| 86 EXPECT_FALSE(batch.HasNext()); | 86 EXPECT_FALSE(batch.HasNext()); |
| 87 EXPECT_EQ("same", pair2.first); | 87 EXPECT_EQ("same", pair2.first); |
| 88 EXPECT_EQ(entity2, pair2.second.get()); | 88 EXPECT_EQ(entity2, pair2.second.get()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace syncer_v2 | 91 } // namespace syncer |
| OLD | NEW |