summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/sessions/sync_session_unittest.cc
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-16 21:40:05 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-16 21:40:05 +0000
commit034565e3656a7d1227ff77e8eb3f6f06e4b64ff6 (patch)
tree77e02774c532271f9a192fb9c904a7343708a407 /chrome/browser/sync/sessions/sync_session_unittest.cc
parent47e9c75cebaa22ecb24c7bb4cde81f2cf507590b (diff)
downloadchromium_src-034565e3656a7d1227ff77e8eb3f6f06e4b64ff6.zip
chromium_src-034565e3656a7d1227ff77e8eb3f6f06e4b64ff6.tar.gz
chromium_src-034565e3656a7d1227ff77e8eb3f6f06e4b64ff6.tar.bz2
For sync, make ProcessCommitResponseCommand handle commit entries one ModelSafeGroup at a time.
Enforce ModelSafeGroup restrictions in the StatusController by DCHECKing if out-of-bounds. Move OrderedCommitSet to its own file. Removed some unused error counters and ResetTransientState calls that were useless. BUG=31911 TEST=ProcessCommitResponseTest, OrderedCommitSetTest Review URL: http://codereview.chromium.org/604045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39139 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/sessions/sync_session_unittest.cc')
-rw-r--r--chrome/browser/sync/sessions/sync_session_unittest.cc25
1 files changed, 10 insertions, 15 deletions
diff --git a/chrome/browser/sync/sessions/sync_session_unittest.cc b/chrome/browser/sync/sessions/sync_session_unittest.cc
index 8c9cfe3..a50a06b 100644
--- a/chrome/browser/sync/sessions/sync_session_unittest.cc
+++ b/chrome/browser/sync/sessions/sync_session_unittest.cc
@@ -22,7 +22,9 @@ class SyncSessionTest : public testing::Test,
public SyncSession::Delegate,
public ModelSafeWorkerRegistrar {
public:
- SyncSessionTest() : controller_invocations_allowed_(false) {}
+ SyncSessionTest() : controller_invocations_allowed_(false) {
+ GetModelSafeRoutingInfo(&routes_);
+ }
virtual void SetUp() {
context_.reset(new SyncSessionContext(NULL, NULL, this));
session_.reset(new SyncSession(context_.get(), this));
@@ -50,7 +52,9 @@ class SyncSessionTest : public testing::Test,
// ModelSafeWorkerRegistrar implementation.
virtual void GetWorkers(std::vector<ModelSafeWorker*>* out) {}
- virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) {}
+ virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) {
+ (*out)[syncable::BOOKMARKS] = GROUP_UI;
+ }
StatusController* status() { return session_->status_controller(); }
protected:
@@ -61,6 +65,7 @@ class SyncSessionTest : public testing::Test,
bool controller_invocations_allowed_;
scoped_ptr<SyncSession> session_;
scoped_ptr<SyncSessionContext> context_;
+ ModelSafeRoutingInfo routes_;
};
TEST_F(SyncSessionTest, ScopedContextHelpers) {
@@ -107,9 +112,9 @@ TEST_F(SyncSessionTest, MoreToSyncIfUnsyncedGreaterThanCommitted) {
// more to sync. For example, this occurs if we had more commit ids
// than could fit in a single commit batch.
EXPECT_FALSE(session_->HasMoreToSync());
- std::vector<syncable::Id> commit_ids;
- commit_ids.push_back(syncable::Id());
- status()->set_commit_ids(commit_ids);
+ OrderedCommitSet commit_set(routes_);
+ commit_set.AddCommitItem(0, syncable::Id(), syncable::BOOKMARKS);
+ status()->set_commit_set(commit_set);
EXPECT_FALSE(session_->HasMoreToSync());
std::vector<int64> unsynced_handles;
@@ -119,8 +124,6 @@ TEST_F(SyncSessionTest, MoreToSyncIfUnsyncedGreaterThanCommitted) {
EXPECT_FALSE(session_->HasMoreToSync());
status()->increment_num_successful_commits();
EXPECT_TRUE(session_->HasMoreToSync());
- status()->ResetTransientState();
- EXPECT_FALSE(session_->HasMoreToSync());
}
TEST_F(SyncSessionTest, MoreToSyncIfConflictSetsBuilt) {
@@ -128,8 +131,6 @@ TEST_F(SyncSessionTest, MoreToSyncIfConflictSetsBuilt) {
// to get updates & commit again.
status()->set_conflict_sets_built(true);
EXPECT_TRUE(session_->HasMoreToSync());
- status()->ResetTransientState();
- EXPECT_FALSE(session_->HasMoreToSync());
}
TEST_F(SyncSessionTest, MoreToSyncIfDidNotGetZeroUpdates) {
@@ -142,8 +143,6 @@ TEST_F(SyncSessionTest, MoreToSyncIfDidNotGetZeroUpdates) {
EXPECT_FALSE(session_->HasMoreToSync());
status()->mutable_updates_response()->CopyFrom(response);
EXPECT_TRUE(session_->HasMoreToSync());
- status()->ResetTransientState();
- EXPECT_FALSE(session_->HasMoreToSync());
}
TEST_F(SyncSessionTest, MoreToSyncIfConflictsResolved) {
@@ -152,8 +151,6 @@ TEST_F(SyncSessionTest, MoreToSyncIfConflictsResolved) {
// that we have made forward progress.
status()->set_conflicts_resolved(true);
EXPECT_TRUE(session_->HasMoreToSync());
- status()->ResetTransientState();
- EXPECT_FALSE(session_->HasMoreToSync());
}
TEST_F(SyncSessionTest, MoreToSyncIfTimestampDirty) {
@@ -163,8 +160,6 @@ TEST_F(SyncSessionTest, MoreToSyncIfTimestampDirty) {
status()->set_timestamp_dirty(true);
status()->set_conflicts_resolved(true);
EXPECT_TRUE(session_->HasMoreToSync());
- status()->ResetTransientState();
- EXPECT_FALSE(session_->HasMoreToSync());
}