| 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 |
| 11 class OrderedCommitSetTest : public testing::Test { | 11 class OrderedCommitSetTest : public testing::Test { |
| 12 public: | 12 public: |
| 13 OrderedCommitSetTest() { | 13 OrderedCommitSetTest() { |
| 14 routes_[syncable::BOOKMARKS] = csync::GROUP_UI; | 14 routes_[syncable::BOOKMARKS] = syncer::GROUP_UI; |
| 15 routes_[syncable::PREFERENCES] = csync::GROUP_UI; | 15 routes_[syncable::PREFERENCES] = syncer::GROUP_UI; |
| 16 routes_[syncable::AUTOFILL] = csync::GROUP_DB; | 16 routes_[syncable::AUTOFILL] = syncer::GROUP_DB; |
| 17 routes_[syncable::TOP_LEVEL_FOLDER] = csync::GROUP_PASSIVE; | 17 routes_[syncable::TOP_LEVEL_FOLDER] = syncer::GROUP_PASSIVE; |
| 18 } | 18 } |
| 19 protected: | 19 protected: |
| 20 csync::TestIdFactory ids_; | 20 syncer::TestIdFactory ids_; |
| 21 csync::ModelSafeRoutingInfo routes_; | 21 syncer::ModelSafeRoutingInfo routes_; |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 namespace csync { | 24 namespace syncer { |
| 25 namespace sessions { | 25 namespace sessions { |
| 26 | 26 |
| 27 TEST_F(OrderedCommitSetTest, Projections) { | 27 TEST_F(OrderedCommitSetTest, Projections) { |
| 28 vector<syncable::Id> expected; | 28 vector<syncable::Id> expected; |
| 29 for (int i = 0; i < 8; i++) | 29 for (int i = 0; i < 8; i++) |
| 30 expected.push_back(ids_.NewLocalId()); | 30 expected.push_back(ids_.NewLocalId()); |
| 31 | 31 |
| 32 OrderedCommitSet commit_set1(routes_), commit_set2(routes_); | 32 OrderedCommitSet commit_set1(routes_), commit_set2(routes_); |
| 33 commit_set1.AddCommitItem(0, expected[0], syncable::BOOKMARKS); | 33 commit_set1.AddCommitItem(0, expected[0], syncable::BOOKMARKS); |
| 34 commit_set1.AddCommitItem(1, expected[1], syncable::BOOKMARKS); | 34 commit_set1.AddCommitItem(1, expected[1], syncable::BOOKMARKS); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 ASSERT_TRUE(commit_set.Empty()); | 121 ASSERT_TRUE(commit_set.Empty()); |
| 122 | 122 |
| 123 commit_set.AddCommitItem(0, ids_.NewLocalId(), syncable::AUTOFILL); | 123 commit_set.AddCommitItem(0, ids_.NewLocalId(), syncable::AUTOFILL); |
| 124 ASSERT_EQ(static_cast<size_t>(1), commit_set.Size()); | 124 ASSERT_EQ(static_cast<size_t>(1), commit_set.Size()); |
| 125 | 125 |
| 126 commit_set.Clear(); | 126 commit_set.Clear(); |
| 127 ASSERT_TRUE(commit_set.Empty()); | 127 ASSERT_TRUE(commit_set.Empty()); |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace sessions | 130 } // namespace sessions |
| 131 } // namespace csync | 131 } // namespace syncer |
| 132 | 132 |
| OLD | NEW |