Index: chrome/browser/sync/profile_sync_service_harness.cc |
diff --git a/chrome/browser/sync/profile_sync_service_harness.cc b/chrome/browser/sync/profile_sync_service_harness.cc |
index cce0aa069d05106869a01bf67d5179cfff150b95..add9335c1cad31cef45e43bac93e67f66485267f 100644 |
--- a/chrome/browser/sync/profile_sync_service_harness.cc |
+++ b/chrome/browser/sync/profile_sync_service_harness.cc |
@@ -28,6 +28,9 @@ using browser_sync::sessions::SyncSessionSnapshot; |
// The amount of time for which we wait for a live sync operation to complete. |
static const int kLiveSyncOperationTimeoutMs = 45000; |
+// The amount of time we wait for testcases that verify exponential backoff. |
+static const int kExponentialBackoffVerificationTimeoutMs = 60000; |
+ |
// Simple class to implement a timeout using PostDelayedTask. If it is not |
// aborted before picked up by a message queue, then it asserts with the message |
// provided. This class is not thread safe. |
@@ -318,6 +321,20 @@ bool ProfileSyncServiceHarness::RunStateChangeMachine() { |
SignalStateCompleteWithNextState(SYNC_DISABLED); |
} |
} |
+ case WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION: { |
+ if (retry_verifier_.VerifyRetryInterval(*GetLastSessionSnapshot()) |
+ == false) { |
+ SignalStateCompleteWithNextState( |
+ EXPONENTIAL_BACKOFF_VERIFICATION_FAILED); |
+ } else { |
+ // We only verify the first 5 retries. |
+ if (retry_verifier_.RetryCount() >= 5) { |
+ SignalStateCompleteWithNextState( |
+ EXPONENTIAL_BACKOFF_VERIFICATION_SUCEEDED); |
+ } |
+ } |
+ } |
+ break; |
case SERVER_UNREACHABLE: { |
VLOG(1) << GetClientInfoString("SERVER_UNREACHABLE"); |
if (GetStatus().server_reachable) { |
@@ -472,6 +489,14 @@ bool ProfileSyncServiceHarness::AwaitSyncDisabled(const std::string& reason) { |
} |
} |
+bool ProfileSyncServiceHarness::AwaitExponentialBackoffVerification() { |
+ retry_verifier_.Initialize(*GetLastSessionSnapshot()); |
+ wait_state_ = WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION; |
+ AwaitStatusChangeWithTimeout(kExponentialBackoffVerificationTimeoutMs, |
+ "Verify Exponential backoff"); |
+ return (wait_state_ == EXPONENTIAL_BACKOFF_VERIFICATION_SUCEEDED); |
+} |
+ |
bool ProfileSyncServiceHarness::AwaitMutualSyncCycleCompletion( |
ProfileSyncServiceHarness* partner) { |
VLOG(1) << GetClientInfoString("AwaitMutualSyncCycleCompletion"); |