| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "sync/sessions/ordered_commit_set.h" | 5 #include "sync/sessions/ordered_commit_set.h" |
| 6 #include "sync/test/engine/test_id_factory.h" | 6 #include "sync/test/engine/test_id_factory.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 using std::vector; | 9 using std::vector; |
| 10 | 10 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 commit_set.AddCommitItem(3, ids_.NewLocalId(), syncable::PREFERENCES); | 108 commit_set.AddCommitItem(3, ids_.NewLocalId(), syncable::PREFERENCES); |
| 109 EXPECT_FALSE(commit_set.HasBookmarkCommitId()); | 109 EXPECT_FALSE(commit_set.HasBookmarkCommitId()); |
| 110 | 110 |
| 111 commit_set.AddCommitItem(4, ids_.NewLocalId(), syncable::BOOKMARKS); | 111 commit_set.AddCommitItem(4, ids_.NewLocalId(), syncable::BOOKMARKS); |
| 112 EXPECT_TRUE(commit_set.HasBookmarkCommitId()); | 112 EXPECT_TRUE(commit_set.HasBookmarkCommitId()); |
| 113 | 113 |
| 114 commit_set.Truncate(4); | 114 commit_set.Truncate(4); |
| 115 EXPECT_FALSE(commit_set.HasBookmarkCommitId()); | 115 EXPECT_FALSE(commit_set.HasBookmarkCommitId()); |
| 116 } | 116 } |
| 117 | 117 |
| 118 TEST_F(OrderedCommitSetTest, AddAndRemoveEntries) { |
| 119 OrderedCommitSet commit_set(routes_); |
| 120 |
| 121 ASSERT_TRUE(commit_set.Empty()); |
| 122 |
| 123 commit_set.AddCommitItem(0, ids_.NewLocalId(), syncable::AUTOFILL); |
| 124 ASSERT_EQ(static_cast<size_t>(1), commit_set.Size()); |
| 125 |
| 126 commit_set.Clear(); |
| 127 ASSERT_TRUE(commit_set.Empty()); |
| 128 } |
| 129 |
| 118 } // namespace sessions | 130 } // namespace sessions |
| 119 } // namespace browser_sync | 131 } // namespace browser_sync |
| 120 | 132 |
| OLD | NEW |