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

Unified Diff: sync/engine/syncer_unittest.cc

Issue 11192071: sync: Merge apply updates and resolve conflicts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Retry (base files were missing) Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/engine/syncer_proto_util_unittest.cc ('k') | sync/engine/update_applicator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/syncer_unittest.cc
diff --git a/sync/engine/syncer_unittest.cc b/sync/engine/syncer_unittest.cc
index feef9459da4d32a89b99530016679165741f63df..5f0a8f3661e9eaedbd339405de5fdaf8b7bc0af1 100644
--- a/sync/engine/syncer_unittest.cc
+++ b/sync/engine/syncer_unittest.cc
@@ -186,7 +186,7 @@ class SyncerTest : public testing::Test,
info, workers);
}
- bool SyncShareAsDelegate(
+ void SyncShareAsDelegate(
SyncSchedulerImpl::SyncSessionJob::SyncSessionJobPurpose purpose) {
SyncerStep start;
SyncerStep end;
@@ -194,27 +194,16 @@ class SyncerTest : public testing::Test,
session_.reset(MakeSession());
syncer_->SyncShare(session_.get(), start, end);
- return session_->HasMoreToSync();
}
- bool SyncShareNudge() {
+ void SyncShareNudge() {
session_.reset(MakeSession());
- return SyncShareAsDelegate(SyncSchedulerImpl::SyncSessionJob::NUDGE);
+ SyncShareAsDelegate(SyncSchedulerImpl::SyncSessionJob::NUDGE);
}
- bool SyncShareConfigure() {
+ void SyncShareConfigure() {
session_.reset(MakeSession());
- return SyncShareAsDelegate(
- SyncSchedulerImpl::SyncSessionJob::CONFIGURATION);
- }
-
- void LoopSyncShare() {
- bool should_loop = false;
- int loop_iterations = 0;
- do {
- ASSERT_LT(++loop_iterations, 100) << "infinite loop detected. please fix";
- should_loop = SyncShareNudge();
- } while (should_loop);
+ SyncShareAsDelegate(SyncSchedulerImpl::SyncSessionJob::CONFIGURATION);
}
virtual void SetUp() {
@@ -414,7 +403,7 @@ class SyncerTest : public testing::Test,
test++;
}
}
- LoopSyncShare();
+ SyncShareNudge();
ASSERT_TRUE(expected_positions.size() ==
mock_server_->committed_ids().size());
// If this test starts failing, be aware other sort orders could be valid.
@@ -2030,7 +2019,7 @@ TEST_F(SyncerTest, ConflictMatchingEntryHandlesUnsanitizedNames) {
B.Put(IS_UNAPPLIED_UPDATE, true);
B.Put(SERVER_VERSION, 20);
}
- LoopSyncShare();
+ SyncShareNudge();
saw_syncer_event_ = false;
mock_server_->set_conflict_all_commits(false);
@@ -2070,7 +2059,7 @@ TEST_F(SyncerTest, ConflictMatchingEntryHandlesNormalNames) {
B.Put(IS_UNAPPLIED_UPDATE, true);
B.Put(SERVER_VERSION, 20);
}
- LoopSyncShare();
+ SyncShareNudge();
saw_syncer_event_ = false;
mock_server_->set_conflict_all_commits(false);
@@ -2097,7 +2086,7 @@ TEST_F(SyncerTest, ReverseFolderOrderingTest) {
mock_server_->AddUpdateDirectory(5, 4, "gggchild", 10, 10);
mock_server_->AddUpdateDirectory(2, 1, "child", 10, 10);
mock_server_->AddUpdateDirectory(1, 0, "parent", 10, 10);
- LoopSyncShare();
+ SyncShareNudge();
syncable::ReadTransaction trans(FROM_HERE, directory());
Id child_id = GetOnlyEntryWithName(
@@ -2218,7 +2207,7 @@ TEST_F(SyncerTest, DoublyChangedWithResolver) {
}
mock_server_->AddUpdateBookmark(child_id_, parent_id_, "Pete2.htm", 11, 10);
mock_server_->set_conflict_all_commits(true);
- LoopSyncShare();
+ SyncShareNudge();
syncable::Directory::ChildHandles children;
{
syncable::ReadTransaction trans(FROM_HERE, directory());
@@ -2520,7 +2509,7 @@ TEST_F(SyncerTest, CommitManyItemsInOneGo_Success) {
}
ASSERT_EQ(items_to_commit, directory()->unsynced_entity_count());
- EXPECT_FALSE(SyncShareNudge());
+ SyncShareNudge();
EXPECT_EQ(num_batches, mock_server_->commit_messages().size());
EXPECT_EQ(0, directory()->unsynced_entity_count());
}
@@ -3065,8 +3054,8 @@ TEST_F(SyncerTest, LongChangelistWithApplicationConflict) {
mock_server_->AddUpdateDirectory(folder_id,
TestIdFactory::root(), "folder", 1, 1);
mock_server_->SetChangesRemaining(0);
- LoopSyncShare();
- LoopSyncShare();
+ SyncShareNudge();
+ SyncShareNudge();
// Check that everything is as expected after the commit.
{
syncable::ReadTransaction trans(FROM_HERE, directory());
« no previous file with comments | « sync/engine/syncer_proto_util_unittest.cc ('k') | sync/engine/update_applicator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698