OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Syncer unit tests. Unfortunately a lot of these tests | 5 // Syncer unit tests. Unfortunately a lot of these tests |
6 // are outdated and need to be reworked and updated. | 6 // are outdated and need to be reworked and updated. |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <limits> | 9 #include <limits> |
10 #include <list> | 10 #include <list> |
(...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2155 SyncShareAsDelegate(); | 2155 SyncShareAsDelegate(); |
2156 { | 2156 { |
2157 ReadTransaction trans(FROM_HERE, dir); | 2157 ReadTransaction trans(FROM_HERE, dir); |
2158 Entry entry(&trans, syncable::GET_BY_ID, id); | 2158 Entry entry(&trans, syncable::GET_BY_ID, id); |
2159 ASSERT_TRUE(entry.good()); | 2159 ASSERT_TRUE(entry.good()); |
2160 EXPECT_TRUE(entry.Get(MTIME) == test_time); | 2160 EXPECT_TRUE(entry.Get(MTIME) == test_time); |
2161 } | 2161 } |
2162 } | 2162 } |
2163 | 2163 |
2164 TEST_F(SyncerTest, ParentAndChildBothMatch) { | 2164 TEST_F(SyncerTest, ParentAndChildBothMatch) { |
| 2165 syncable::ModelTypeBitSet all_types; |
| 2166 all_types.set(); |
2165 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); | 2167 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); |
2166 CHECK(dir.good()); | 2168 CHECK(dir.good()); |
2167 syncable::Id parent_id = ids_.NewServerId(); | 2169 syncable::Id parent_id = ids_.NewServerId(); |
2168 syncable::Id child_id = ids_.NewServerId(); | 2170 syncable::Id child_id = ids_.NewServerId(); |
2169 | 2171 |
2170 { | 2172 { |
2171 WriteTransaction wtrans(FROM_HERE, UNITTEST, dir); | 2173 WriteTransaction wtrans(FROM_HERE, UNITTEST, dir); |
2172 MutableEntry parent(&wtrans, CREATE, root_id_, "Folder"); | 2174 MutableEntry parent(&wtrans, CREATE, root_id_, "Folder"); |
2173 ASSERT_TRUE(parent.good()); | 2175 ASSERT_TRUE(parent.good()); |
2174 parent.Put(IS_DIR, true); | 2176 parent.Put(IS_DIR, true); |
(...skipping 16 matching lines...) Expand all Loading... |
2191 SyncShareAsDelegate(); | 2193 SyncShareAsDelegate(); |
2192 SyncShareAsDelegate(); | 2194 SyncShareAsDelegate(); |
2193 { | 2195 { |
2194 ReadTransaction trans(FROM_HERE, dir); | 2196 ReadTransaction trans(FROM_HERE, dir); |
2195 Directory::ChildHandles children; | 2197 Directory::ChildHandles children; |
2196 dir->GetChildHandlesById(&trans, root_id_, &children); | 2198 dir->GetChildHandlesById(&trans, root_id_, &children); |
2197 EXPECT_EQ(1u, children.size()); | 2199 EXPECT_EQ(1u, children.size()); |
2198 dir->GetChildHandlesById(&trans, parent_id, &children); | 2200 dir->GetChildHandlesById(&trans, parent_id, &children); |
2199 EXPECT_EQ(1u, children.size()); | 2201 EXPECT_EQ(1u, children.size()); |
2200 Directory::UnappliedUpdateMetaHandles unapplied; | 2202 Directory::UnappliedUpdateMetaHandles unapplied; |
2201 dir->GetUnappliedUpdateMetaHandles(&trans, &unapplied); | 2203 dir->GetUnappliedUpdateMetaHandles(&trans, all_types, &unapplied); |
2202 EXPECT_EQ(0u, unapplied.size()); | 2204 EXPECT_EQ(0u, unapplied.size()); |
2203 syncable::Directory::UnsyncedMetaHandles unsynced; | 2205 syncable::Directory::UnsyncedMetaHandles unsynced; |
2204 dir->GetUnsyncedMetaHandles(&trans, &unsynced); | 2206 dir->GetUnsyncedMetaHandles(&trans, &unsynced); |
2205 EXPECT_EQ(0u, unsynced.size()); | 2207 EXPECT_EQ(0u, unsynced.size()); |
2206 saw_syncer_event_ = false; | 2208 saw_syncer_event_ = false; |
2207 } | 2209 } |
2208 } | 2210 } |
2209 | 2211 |
2210 TEST_F(SyncerTest, CommittingNewDeleted) { | 2212 TEST_F(SyncerTest, CommittingNewDeleted) { |
2211 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); | 2213 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); |
(...skipping 3143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5355 Add(low_id_); | 5357 Add(low_id_); |
5356 Add(high_id_); | 5358 Add(high_id_); |
5357 SyncShareAsDelegate(); | 5359 SyncShareAsDelegate(); |
5358 ExpectLocalOrderIsByServerId(); | 5360 ExpectLocalOrderIsByServerId(); |
5359 } | 5361 } |
5360 | 5362 |
5361 const SyncerTest::CommitOrderingTest | 5363 const SyncerTest::CommitOrderingTest |
5362 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; | 5364 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; |
5363 | 5365 |
5364 } // namespace browser_sync | 5366 } // namespace browser_sync |
OLD | NEW |