Chromium Code Reviews| 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 d2fb640cb77d0fde11ff636d7c3f41ad9ec997c6..522bd1f7cb59ca49dd947d52df41e2ef5e00dfc9 100644 |
| --- a/chrome/browser/sync/profile_sync_service_harness.cc |
| +++ b/chrome/browser/sync/profile_sync_service_harness.cc |
| @@ -25,9 +25,13 @@ |
| using browser_sync::sessions::SyncSessionSnapshot; |
| +// TODO(rsimha): Remove the following lines once crbug.com/91863 is fixed. |
| // 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 test cases 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. |
| @@ -327,6 +331,17 @@ bool ProfileSyncServiceHarness::RunStateChangeMachine() { |
| } |
| break; |
| } |
| + case WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION: { |
| + VLOG(1) << GetClientInfoString( |
| + "WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION"); |
| + const browser_sync::sessions::SyncSessionSnapshot *snap = |
| + GetLastSessionSnapshot(); |
| + CHECK(snap); |
| + retry_verifier_.VerifyRetryInterval(*snap); |
| + if (retry_verifier_.Done()) |
| + SignalStateCompleteWithNextState(WAITING_FOR_NOTHING); |
| + break; |
| + } |
| case SERVER_UNREACHABLE: { |
| VLOG(1) << GetClientInfoString("SERVER_UNREACHABLE"); |
| if (GetStatus().server_reachable) { |
| @@ -352,6 +367,12 @@ bool ProfileSyncServiceHarness::RunStateChangeMachine() { |
| VLOG(1) << GetClientInfoString("SYNC_DISABLED"); |
| break; |
| } |
| + case WAITING_FOR_NOTHING: { |
| + // We don't care about the state of the syncer for the rest of the test |
| + // case. |
| + VLOG(1) << GetClientInfoString("WAIT_FOR_NOTHING"); |
|
Raghu Simha
2011/08/05 23:23:58
s/WAIT_FOR_NOTHING/WAITING_FOR_NOTHING/
lipalani1
2011/08/09 01:39:02
Done.
|
| + break; |
| + } |
| default: |
| // Invalid state during observer callback which may be triggered by other |
| // classes using the the UI message loop. Defer to their handling. |
| @@ -477,6 +498,14 @@ bool ProfileSyncServiceHarness::AwaitSyncDisabled(const std::string& reason) { |
| return wait_state_ == SYNC_DISABLED; |
| } |
| +bool ProfileSyncServiceHarness::AwaitExponentialBackoffVerification() { |
| + retry_verifier_.Initialize(*GetLastSessionSnapshot()); |
| + wait_state_ = WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION; |
| + AwaitStatusChangeWithTimeout(kExponentialBackoffVerificationTimeoutMs, |
| + "Verify Exponential backoff"); |
| + return (retry_verifier_.Success()); |
| +} |
| + |
| bool ProfileSyncServiceHarness::AwaitMutualSyncCycleCompletion( |
| ProfileSyncServiceHarness* partner) { |
| VLOG(1) << GetClientInfoString("AwaitMutualSyncCycleCompletion"); |