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

Unified Diff: chrome/browser/sync/engine/syncer_thread_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: Tim's fixes 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/engine/syncer_thread.cc ('k') | chrome/browser/sync/engine/syncer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/engine/syncer_thread_unittest.cc
diff --git a/chrome/browser/sync/engine/syncer_thread_unittest.cc b/chrome/browser/sync/engine/syncer_thread_unittest.cc
index df0733ba19219343f36e1bb29951f9b411aeea85..4b13e8ff46b5947a6e5699ac9361c924db07ab69 100644
--- a/chrome/browser/sync/engine/syncer_thread_unittest.cc
+++ b/chrome/browser/sync/engine/syncer_thread_unittest.cc
@@ -42,11 +42,23 @@ ACTION_P(SignalEvent, event) {
}
SyncSessionSnapshot SessionSnapshotForTest(
- int64 num_server_changes_remaining, int64 max_local_timestamp,
+ int64 num_server_changes_remaining,
int64 unsynced_count) {
+ std::string download_progress_markers[syncable::MODEL_TYPE_COUNT];
+ for (int i = syncable::FIRST_REAL_MODEL_TYPE;
+ i < syncable::MODEL_TYPE_COUNT;
+ ++i) {
+ syncable::ModelType type(syncable::ModelTypeFromInt(i));
+ sync_pb::DataTypeProgressMarker token;
+ token.set_data_type_id(
+ syncable::GetExtensionFieldNumberFromModelType(type));
+ token.set_token("foobar");
+ token.SerializeToString(&download_progress_markers[i]);
+ }
return SyncSessionSnapshot(SyncerStatus(), ErrorCounters(),
- num_server_changes_remaining, max_local_timestamp, false,
- syncable::ModelTypeBitSet(), false, false, unsynced_count, 0, false);
+ num_server_changes_remaining, false,
+ syncable::ModelTypeBitSet(), download_progress_markers,
+ false, false, unsynced_count, 0, false);
}
class ListenerMock : public SyncEngineEventListener {
@@ -393,7 +405,7 @@ TEST_F(SyncerThreadTest, CalculatePollingWaitTime) {
// non-zero.
{
// More server changes remaining to download.
- context->set_last_snapshot(SessionSnapshotForTest(1, 0, 0));
+ context->set_last_snapshot(SessionSnapshotForTest(1, 0));
bool continue_sync_cycle_param = false;
WaitInterval interval = syncer_thread->CalculatePollingWaitTime(
@@ -441,7 +453,7 @@ TEST_F(SyncerThreadTest, CalculatePollingWaitTime) {
ASSERT_TRUE(continue_sync_cycle_param);
// Now simulate no more server changes remaining.
- context->set_last_snapshot(SessionSnapshotForTest(1, 1, 0));
+ context->set_last_snapshot(SessionSnapshotForTest(0, 0));
interval = syncer_thread->CalculatePollingWaitTime(
0,
&user_idle_milliseconds_param,
@@ -458,7 +470,7 @@ TEST_F(SyncerThreadTest, CalculatePollingWaitTime) {
{
// Now try with unsynced local items.
- context->set_last_snapshot(SessionSnapshotForTest(0, 0, 1));
+ context->set_last_snapshot(SessionSnapshotForTest(0, 1));
bool continue_sync_cycle_param = false;
WaitInterval interval = syncer_thread->CalculatePollingWaitTime(
@@ -484,7 +496,7 @@ TEST_F(SyncerThreadTest, CalculatePollingWaitTime) {
ASSERT_FALSE(interval.had_nudge_during_backoff);
ASSERT_TRUE(continue_sync_cycle_param);
- context->set_last_snapshot(SessionSnapshotForTest(0, 0, 0));
+ context->set_last_snapshot(SessionSnapshotForTest(0, 0));
interval = syncer_thread->CalculatePollingWaitTime(
4,
&user_idle_milliseconds_param,
@@ -501,7 +513,7 @@ TEST_F(SyncerThreadTest, CalculatePollingWaitTime) {
// Regression for exponential backoff reset when the syncer is nudged.
{
- context->set_last_snapshot(SessionSnapshotForTest(0, 0, 1));
+ context->set_last_snapshot(SessionSnapshotForTest(0, 1));
bool continue_sync_cycle_param = false;
// Expect move from default polling interval to exponential backoff due to
@@ -623,7 +635,7 @@ TEST_F(SyncerThreadTest, CalculatePollingWaitTime) {
ASSERT_TRUE(continue_sync_cycle_param);
// Setting unsynced_count = 0 returns us to the default polling interval.
- context->set_last_snapshot(SessionSnapshotForTest(0, 0, 0));
+ context->set_last_snapshot(SessionSnapshotForTest(0, 0));
interval = syncer_thread->CalculatePollingWaitTime(
4,
&user_idle_milliseconds_param,
« no previous file with comments | « chrome/browser/sync/engine/syncer_thread.cc ('k') | chrome/browser/sync/engine/syncer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698