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

Unified Diff: sync/engine/syncer_unittest.cc

Issue 10933075: FYI: Remove PerModelSafeGroupState + move ConflictResolution (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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/syncer_util.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 34ed1fd12fb6975e9e92d0ca11bfe78bc0937af7..6750042021b9936a3864e25790ba79b9fc2f7652 100644
--- a/sync/engine/syncer_unittest.cc
+++ b/sync/engine/syncer_unittest.cc
@@ -105,7 +105,6 @@ using syncable::SPECIFICS;
using syncable::SYNCING;
using syncable::UNITTEST;
-using sessions::ConflictProgress;
using sessions::ScopedSetSessionWriteTransaction;
using sessions::StatusController;
using sessions::SyncSessionContext;
@@ -185,7 +184,7 @@ class SyncerTest : public testing::Test,
info, workers);
}
- bool SyncShareAsDelegate(
+ void SyncShareAsDelegate(
SyncSchedulerImpl::SyncSessionJob::SyncSessionJobPurpose purpose) {
SyncerStep start;
SyncerStep end;
@@ -193,27 +192,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() {
@@ -390,7 +378,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.
@@ -1705,12 +1693,7 @@ TEST_F(SyncerTest, IllegalAndLegalUpdates) {
// Id 3 should be in conflict now.
EXPECT_EQ(1, status().TotalNumConflictingItems());
- {
- sessions::ScopedModelSafeGroupRestriction r(
- session_->mutable_status_controller(), GROUP_PASSIVE);
- ASSERT_TRUE(status().conflict_progress());
- EXPECT_EQ(1, status().conflict_progress()->HierarchyConflictingItemsSize());
- }
+ EXPECT_EQ(1, status().num_hierarchy_conflicts());
// These entries will be used in the second set of updates.
mock_server_->AddUpdateDirectory(4, 0, "newer_version", 20, 10);
@@ -1724,12 +1707,7 @@ TEST_F(SyncerTest, IllegalAndLegalUpdates) {
// The three items with an unresolved parent should be unapplied (3, 9, 100).
// The name clash should also still be in conflict.
EXPECT_EQ(3, status().TotalNumConflictingItems());
- {
- sessions::ScopedModelSafeGroupRestriction r(
- session_->mutable_status_controller(), GROUP_PASSIVE);
- ASSERT_TRUE(status().conflict_progress());
- EXPECT_EQ(3, status().conflict_progress()->HierarchyConflictingItemsSize());
- }
+ EXPECT_EQ(3, status().num_hierarchy_conflicts());
{
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
@@ -1819,12 +1797,7 @@ TEST_F(SyncerTest, IllegalAndLegalUpdates) {
EXPECT_FALSE(saw_syncer_event_);
EXPECT_EQ(4, status().TotalNumConflictingItems());
- {
- sessions::ScopedModelSafeGroupRestriction r(
- session_->mutable_status_controller(), GROUP_PASSIVE);
- ASSERT_TRUE(status().conflict_progress());
- EXPECT_EQ(4, status().conflict_progress()->HierarchyConflictingItemsSize());
- }
+ EXPECT_EQ(4, status().num_hierarchy_conflicts());
}
TEST_F(SyncerTest, CommitTimeRename) {
@@ -2135,7 +2108,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);
@@ -2175,7 +2148,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);
@@ -2202,7 +2175,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(
@@ -2323,7 +2296,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());
@@ -2514,7 +2487,7 @@ TEST_F(SyncerTest, DeletingEntryInFolder) {
existing.Put(IS_DEL, true);
}
syncer_->SyncShare(session_.get(), SYNCER_BEGIN, SYNCER_END);
- EXPECT_EQ(0, status().TotalNumServerConflictingItems());
+ EXPECT_EQ(0, status().num_server_conflicts());
}
TEST_F(SyncerTest, DeletingEntryWithLocalEdits) {
@@ -2623,7 +2596,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());
}
@@ -3163,8 +3136,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/syncer_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698