| 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(); | |
| 2167 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); | 2165 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); |
| 2168 CHECK(dir.good()); | 2166 CHECK(dir.good()); |
| 2169 syncable::Id parent_id = ids_.NewServerId(); | 2167 syncable::Id parent_id = ids_.NewServerId(); |
| 2170 syncable::Id child_id = ids_.NewServerId(); | 2168 syncable::Id child_id = ids_.NewServerId(); |
| 2171 | 2169 |
| 2172 { | 2170 { |
| 2173 WriteTransaction wtrans(FROM_HERE, UNITTEST, dir); | 2171 WriteTransaction wtrans(FROM_HERE, UNITTEST, dir); |
| 2174 MutableEntry parent(&wtrans, CREATE, root_id_, "Folder"); | 2172 MutableEntry parent(&wtrans, CREATE, root_id_, "Folder"); |
| 2175 ASSERT_TRUE(parent.good()); | 2173 ASSERT_TRUE(parent.good()); |
| 2176 parent.Put(IS_DIR, true); | 2174 parent.Put(IS_DIR, true); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2193 SyncShareAsDelegate(); | 2191 SyncShareAsDelegate(); |
| 2194 SyncShareAsDelegate(); | 2192 SyncShareAsDelegate(); |
| 2195 { | 2193 { |
| 2196 ReadTransaction trans(FROM_HERE, dir); | 2194 ReadTransaction trans(FROM_HERE, dir); |
| 2197 Directory::ChildHandles children; | 2195 Directory::ChildHandles children; |
| 2198 dir->GetChildHandlesById(&trans, root_id_, &children); | 2196 dir->GetChildHandlesById(&trans, root_id_, &children); |
| 2199 EXPECT_EQ(1u, children.size()); | 2197 EXPECT_EQ(1u, children.size()); |
| 2200 dir->GetChildHandlesById(&trans, parent_id, &children); | 2198 dir->GetChildHandlesById(&trans, parent_id, &children); |
| 2201 EXPECT_EQ(1u, children.size()); | 2199 EXPECT_EQ(1u, children.size()); |
| 2202 Directory::UnappliedUpdateMetaHandles unapplied; | 2200 Directory::UnappliedUpdateMetaHandles unapplied; |
| 2203 dir->GetUnappliedUpdateMetaHandles(&trans, all_types, &unapplied); | 2201 dir->GetUnappliedUpdateMetaHandles(&trans, &unapplied); |
| 2204 EXPECT_EQ(0u, unapplied.size()); | 2202 EXPECT_EQ(0u, unapplied.size()); |
| 2205 syncable::Directory::UnsyncedMetaHandles unsynced; | 2203 syncable::Directory::UnsyncedMetaHandles unsynced; |
| 2206 dir->GetUnsyncedMetaHandles(&trans, &unsynced); | 2204 dir->GetUnsyncedMetaHandles(&trans, &unsynced); |
| 2207 EXPECT_EQ(0u, unsynced.size()); | 2205 EXPECT_EQ(0u, unsynced.size()); |
| 2208 saw_syncer_event_ = false; | 2206 saw_syncer_event_ = false; |
| 2209 } | 2207 } |
| 2210 } | 2208 } |
| 2211 | 2209 |
| 2212 TEST_F(SyncerTest, CommittingNewDeleted) { | 2210 TEST_F(SyncerTest, CommittingNewDeleted) { |
| 2213 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); | 2211 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); |
| (...skipping 3143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5357 Add(low_id_); | 5355 Add(low_id_); |
| 5358 Add(high_id_); | 5356 Add(high_id_); |
| 5359 SyncShareAsDelegate(); | 5357 SyncShareAsDelegate(); |
| 5360 ExpectLocalOrderIsByServerId(); | 5358 ExpectLocalOrderIsByServerId(); |
| 5361 } | 5359 } |
| 5362 | 5360 |
| 5363 const SyncerTest::CommitOrderingTest | 5361 const SyncerTest::CommitOrderingTest |
| 5364 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; | 5362 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; |
| 5365 | 5363 |
| 5366 } // namespace browser_sync | 5364 } // namespace browser_sync |
| OLD | NEW |