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

Unified Diff: sync/engine/sync_scheduler_unittest.cc

Issue 10826194: sync: raise initial backoff interval from 1 second to 5 minutes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo Created 8 years, 4 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
Index: sync/engine/sync_scheduler_unittest.cc
diff --git a/sync/engine/sync_scheduler_unittest.cc b/sync/engine/sync_scheduler_unittest.cc
index 2b9ea8733ef0864bffba36e783819a88469618c1..af76ab1c7d6fd369c4477c7aab756ac9642b793b 100644
--- a/sync/engine/sync_scheduler_unittest.cc
+++ b/sync/engine/sync_scheduler_unittest.cc
@@ -928,7 +928,7 @@ TEST_F(SyncSchedulerTest, BackoffElevation) {
.WillRepeatedly(DoAll(Invoke(sessions::test_util::SimulateCommitFailed),
RecordSyncShareMultiple(&r, kMinNumSamples)));
- const TimeDelta first = TimeDelta::FromSeconds(1);
+ const TimeDelta first = TimeDelta::FromSeconds(kInitialBackoffRetrySeconds);
const TimeDelta second = TimeDelta::FromMilliseconds(2);
const TimeDelta third = TimeDelta::FromMilliseconds(3);
const TimeDelta fourth = TimeDelta::FromMilliseconds(4);
@@ -959,6 +959,38 @@ TEST_F(SyncSchedulerTest, BackoffElevation) {
EXPECT_GE(r.times[4] - r.times[3], fifth);
}
+TEST_F(SyncSchedulerTest, GetInitialBackoffDelay) {
+ sessions::ModelNeutralState state;
+ state.last_get_key_result = SYNC_SERVER_ERROR;
+ EXPECT_EQ(kInitialBackoffRetrySeconds,
+ scheduler()->GetInitialBackoffDelay(state).InSeconds());
+
+ state.last_get_key_result = UNSET;
+ state.last_download_updates_result = SERVER_RETURN_MIGRATION_DONE;
+ EXPECT_EQ(kInitialBackoffImmediateRetrySeconds,
+ scheduler()->GetInitialBackoffDelay(state).InSeconds());
+
+ state.last_download_updates_result = SERVER_RETURN_TRANSIENT_ERROR;
+ EXPECT_EQ(kInitialBackoffRetrySeconds,
+ scheduler()->GetInitialBackoffDelay(state).InSeconds());
+
+ state.last_download_updates_result = SERVER_RESPONSE_VALIDATION_FAILED;
+ EXPECT_EQ(kInitialBackoffRetrySeconds,
+ scheduler()->GetInitialBackoffDelay(state).InSeconds());
+
+ state.last_download_updates_result = SYNCER_OK;
+ // Note that updating credentials triggers a canary job, trumping
+ // the initial delay, but in theory we still expect this function to treat
+ // it like any other error in the system (except migration).
+ state.commit_result = SERVER_RETURN_INVALID_CREDENTIAL;
+ EXPECT_EQ(kInitialBackoffRetrySeconds,
+ scheduler()->GetInitialBackoffDelay(state).InSeconds());
+
+ state.commit_result = SERVER_RETURN_MIGRATION_DONE;
+ EXPECT_EQ(kInitialBackoffImmediateRetrySeconds,
+ scheduler()->GetInitialBackoffDelay(state).InSeconds());
+}
+
// Test that things go back to normal once a retry makes forward progress.
TEST_F(SyncSchedulerTest, BackoffRelief) {
SyncShareRecords r;

Powered by Google App Engine
This is Rietveld 408576698