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 914dcd0ab0d9aaf18f2b845e5ea392e51864f378..9c671249dd790fba74829715da81295dea03eb42 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; |
|
tim (not reviewing)
2011/08/10 00:08:29
couldn't we use the TestTimeouts value rather than
|
| + |
| // 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. |
| @@ -107,6 +111,8 @@ ProfileSyncServiceHarness::ProfileSyncServiceHarness( |
| } |
| } |
| +ProfileSyncServiceHarness::~ProfileSyncServiceHarness() {} |
| + |
| // static |
| ProfileSyncServiceHarness* ProfileSyncServiceHarness::CreateAndAttach( |
| Profile* profile) { |
| @@ -327,6 +333,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); |
|
tim (not reviewing)
2011/08/10 00:08:29
the deref below is probably more useful than this
|
| + retry_verifier_.VerifyRetryInterval(*snap); |
| + if (retry_verifier_.done()) |
| + SignalStateCompleteWithNextState(WAITING_FOR_NOTHING); |
|
tim (not reviewing)
2011/08/10 00:08:29
nit - indent
|
| + break; |
| + } |
| case SERVER_UNREACHABLE: { |
| VLOG(1) << GetClientInfoString("SERVER_UNREACHABLE"); |
| if (GetStatus().server_reachable) { |
| @@ -352,6 +369,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("WAITING_FOR_NOTHING"); |
| + 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 +500,17 @@ bool ProfileSyncServiceHarness::AwaitSyncDisabled(const std::string& reason) { |
| return wait_state_ == SYNC_DISABLED; |
| } |
| +bool ProfileSyncServiceHarness::AwaitExponentialBackoffVerification() { |
| + const browser_sync::sessions::SyncSessionSnapshot *snap = |
| + GetLastSessionSnapshot(); |
| + CHECK(snap); |
| + retry_verifier_.Initialize(*snap); |
| + wait_state_ = WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION; |
| + AwaitStatusChangeWithTimeout(kExponentialBackoffVerificationTimeoutMs, |
| + "Verify Exponential backoff"); |
| + return (retry_verifier_.Succeeded()); |
| +} |
| + |
| bool ProfileSyncServiceHarness::AwaitMutualSyncCycleCompletion( |
| ProfileSyncServiceHarness* partner) { |
| VLOG(1) << GetClientInfoString("AwaitMutualSyncCycleCompletion"); |