Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: chrome/browser/sync/engine/syncer_unittest.cc

Issue 6104003: sync: use progress markers instead of timestamps during GetUpdates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 3549 matching lines...) Expand 10 before | Expand all | Expand 10 after
3560 mock_server_->AddUpdateBookmark(1, 0, "Copy of base", 50, 50); 3560 mock_server_->AddUpdateBookmark(1, 0, "Copy of base", 50, 50);
3561 SyncRepeatedlyToTriggerConflictResolution(session_.get()); 3561 SyncRepeatedlyToTriggerConflictResolution(session_.get());
3562 } 3562 }
3563 3563
3564 // In this test a long changelog contains a child at the start of the changelog 3564 // In this test a long changelog contains a child at the start of the changelog
3565 // and a parent at the end. While these updates are in progress the client would 3565 // and a parent at the end. While these updates are in progress the client would
3566 // appear stuck. 3566 // appear stuck.
3567 TEST_F(SyncerTest, LongChangelistWithApplicationConflict) { 3567 TEST_F(SyncerTest, LongChangelistWithApplicationConflict) {
3568 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); 3568 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name());
3569 CHECK(dir.good()); 3569 CHECK(dir.good());
3570 const int DEPTH = 400; 3570 const int DEPTH = 400;
tim (not reviewing) 2011/01/11 19:14:23 would you be so kind as to lower case this?
ncarter (slow) 2011/01/13 00:06:13 Done.
3571 syncable::Id folder_id = ids_.FromNumber(1); 3571 syncable::Id folder_id = ids_.FromNumber(1);
3572 3572
3573 // First we an item in a folder in the root. However the folder won't come 3573 // First we an item in a folder in the root. However the folder won't come
3574 // till much later. 3574 // till much later.
3575 syncable::Id stuck_entry_id = TestIdFactory::FromNumber(99999); 3575 syncable::Id stuck_entry_id = TestIdFactory::FromNumber(99999);
3576 mock_server_->AddUpdateDirectory(stuck_entry_id, 3576 mock_server_->AddUpdateDirectory(stuck_entry_id,
3577 folder_id, "stuck", 1, 1); 3577 folder_id, "stuck", 1, 1);
3578 mock_server_->SetChangesRemaining(DEPTH - 1); 3578 mock_server_->SetChangesRemaining(DEPTH - 1);
3579 syncer_->SyncShare(session_.get()); 3579 syncer_->SyncShare(session_.get());
3580 3580
3581 // Very long changelist. We should never be stuck. 3581 // Buffer up a very long series of downloads.
3582 // We should never be stuck (conflict resolution shouldn't
3583 // kick in so long as we're making forward progress).
3582 for (int i = 0; i < DEPTH; i++) { 3584 for (int i = 0; i < DEPTH; i++) {
3583 mock_server_->SetNewTimestamp(i); 3585 mock_server_->NextUpdateBatch();
3586 mock_server_->SetNewTimestamp(i + 1);
3584 mock_server_->SetChangesRemaining(DEPTH - i); 3587 mock_server_->SetChangesRemaining(DEPTH - i);
3585 syncer_->SyncShare(session_.get()); 3588 }
3586 EXPECT_FALSE(session_->status_controller()->syncer_status().syncer_stuck);
3587 3589
3588 // Ensure our folder hasn't somehow applied. 3590 syncer_->SyncShare(session_.get());
3591 EXPECT_FALSE(session_->status_controller()->syncer_status().syncer_stuck);
3592
3593 // Ensure our folder hasn't somehow applied.
3594 {
3589 ReadTransaction trans(dir, __FILE__, __LINE__); 3595 ReadTransaction trans(dir, __FILE__, __LINE__);
3590 Entry child(&trans, GET_BY_ID, stuck_entry_id); 3596 Entry child(&trans, GET_BY_ID, stuck_entry_id);
3591 EXPECT_TRUE(child.good()); 3597 EXPECT_TRUE(child.good());
3592 EXPECT_TRUE(child.Get(IS_UNAPPLIED_UPDATE)); 3598 EXPECT_TRUE(child.Get(IS_UNAPPLIED_UPDATE));
3593 EXPECT_TRUE(child.Get(IS_DEL)); 3599 EXPECT_TRUE(child.Get(IS_DEL));
3594 EXPECT_FALSE(child.Get(IS_UNSYNCED)); 3600 EXPECT_FALSE(child.Get(IS_UNSYNCED));
3595 } 3601 }
3596 3602
3597 // And finally the folder. 3603 // And finally the folder.
3598 mock_server_->AddUpdateDirectory(folder_id, 3604 mock_server_->AddUpdateDirectory(folder_id,
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after
5163 Add(low_id_); 5169 Add(low_id_);
5164 Add(high_id_); 5170 Add(high_id_);
5165 SyncShareAsDelegate(); 5171 SyncShareAsDelegate();
5166 ExpectLocalOrderIsByServerId(); 5172 ExpectLocalOrderIsByServerId();
5167 } 5173 }
5168 5174
5169 const SyncerTest::CommitOrderingTest 5175 const SyncerTest::CommitOrderingTest
5170 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; 5176 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()};
5171 5177
5172 } // namespace browser_sync 5178 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698