| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 3550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3561 SyncShareAsDelegate(); | 3561 SyncShareAsDelegate(); |
| 3562 { | 3562 { |
| 3563 WriteTransaction trans(dir, UNITTEST, __FILE__, __LINE__); | 3563 WriteTransaction trans(dir, UNITTEST, __FILE__, __LINE__); |
| 3564 MutableEntry entry(&trans, CREATE, trans.root_id(), "Copy of base"); | 3564 MutableEntry entry(&trans, CREATE, trans.root_id(), "Copy of base"); |
| 3565 WriteTestDataToEntry(&trans, &entry); | 3565 WriteTestDataToEntry(&trans, &entry); |
| 3566 } | 3566 } |
| 3567 mock_server_->AddUpdateBookmark(1, 0, "Copy of base", 50, 50); | 3567 mock_server_->AddUpdateBookmark(1, 0, "Copy of base", 50, 50); |
| 3568 SyncRepeatedlyToTriggerConflictResolution(session_.get()); | 3568 SyncRepeatedlyToTriggerConflictResolution(session_.get()); |
| 3569 } | 3569 } |
| 3570 | 3570 |
| 3571 TEST_F(SyncerTest, DISABLED_OneBajillionUpdates) { | 3571 TEST_F(SyncerTest, OneBajillionUpdates) { |
| 3572 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); | 3572 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); |
| 3573 CHECK(dir.good()); | 3573 CHECK(dir.good()); |
| 3574 int one_bajillion = 4000; | 3574 int one_bajillion = 4000; |
| 3575 | 3575 |
| 3576 syncable::Id parent_id = ids_.MakeServer("Parent"); | 3576 syncable::Id parent_id = ids_.MakeServer("Parent"); |
| 3577 mock_server_->AddUpdateDirectory(parent_id, ids_.root(), "foo", 1, 1); | 3577 mock_server_->AddUpdateDirectory(parent_id, ids_.root(), "foo", 1, 1); |
| 3578 | 3578 |
| 3579 for (int i = 1; i <= one_bajillion; ++i) { | 3579 for (int i = 1; i <= one_bajillion; ++i) { |
| 3580 syncable::Id item_id = ids_.FromNumber(i); | 3580 syncable::Id item_id = ids_.FromNumber(i); |
| 3581 mock_server_->AddUpdateDirectory(item_id, parent_id, "dude", 1, 1); | 3581 mock_server_->AddUpdateDirectory(item_id, parent_id, "dude", 1, 1); |
| (...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4993 EXPECT_TRUE(dir.good()); | 4993 EXPECT_TRUE(dir.good()); |
| 4994 ReadTransaction trans(dir, __FILE__, __LINE__); | 4994 ReadTransaction trans(dir, __FILE__, __LINE__); |
| 4995 | 4995 |
| 4996 Id prev_id; | 4996 Id prev_id; |
| 4997 DCHECK(prev_id.IsRoot()); | 4997 DCHECK(prev_id.IsRoot()); |
| 4998 PosMap::iterator next = position_map_.begin(); | 4998 PosMap::iterator next = position_map_.begin(); |
| 4999 for (PosMap::iterator i = next++; i != position_map_.end(); ++i) { | 4999 for (PosMap::iterator i = next++; i != position_map_.end(); ++i) { |
| 5000 Id id = i->second; | 5000 Id id = i->second; |
| 5001 Entry entry_with_id(&trans, GET_BY_ID, id); | 5001 Entry entry_with_id(&trans, GET_BY_ID, id); |
| 5002 EXPECT_TRUE(entry_with_id.good()); | 5002 EXPECT_TRUE(entry_with_id.good()); |
| 5003 EXPECT_TRUE(entry_with_id.Get(PREV_ID) == prev_id); | 5003 EXPECT_EQ(prev_id, entry_with_id.Get(PREV_ID)); |
| 5004 EXPECT_TRUE(entry_with_id.Get(SERVER_POSITION_IN_PARENT) == i->first); | 5004 EXPECT_EQ(i->first, entry_with_id.Get(SERVER_POSITION_IN_PARENT)); |
| 5005 if (next == position_map_.end()) { | 5005 if (next == position_map_.end()) { |
| 5006 EXPECT_TRUE(entry_with_id.Get(NEXT_ID).IsRoot()); | 5006 EXPECT_EQ(Id(), entry_with_id.Get(NEXT_ID)); |
| 5007 } else { | 5007 } else { |
| 5008 EXPECT_TRUE(entry_with_id.Get(NEXT_ID) == next->second); | 5008 EXPECT_EQ(next->second, entry_with_id.Get(NEXT_ID)); |
| 5009 next++; | 5009 next++; |
| 5010 } | 5010 } |
| 5011 prev_id = id; | 5011 prev_id = id; |
| 5012 } | 5012 } |
| 5013 } | 5013 } |
| 5014 | 5014 |
| 5015 void AddRootItemWithPosition(int64 position) { | 5015 void AddRootItemWithPosition(int64 position) { |
| 5016 string id = string("ServerId") + base::Int64ToString(next_update_id_++); | 5016 string id = string("ServerId") + base::Int64ToString(next_update_id_++); |
| 5017 string name = "my name is my id -- " + id; | 5017 string name = "my name is my id -- " + id; |
| 5018 int revision = next_revision_++; | 5018 int revision = next_revision_++; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5193 Add(low_id_); | 5193 Add(low_id_); |
| 5194 Add(high_id_); | 5194 Add(high_id_); |
| 5195 SyncShareAsDelegate(); | 5195 SyncShareAsDelegate(); |
| 5196 ExpectLocalOrderIsByServerId(); | 5196 ExpectLocalOrderIsByServerId(); |
| 5197 } | 5197 } |
| 5198 | 5198 |
| 5199 const SyncerTest::CommitOrderingTest | 5199 const SyncerTest::CommitOrderingTest |
| 5200 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; | 5200 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; |
| 5201 | 5201 |
| 5202 } // namespace browser_sync | 5202 } // namespace browser_sync |
| OLD | NEW |