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..9bb7f4cab0dc607b2300f3fe951b4ed93974c61f 100644 |
| --- a/chrome/browser/sync/profile_sync_service_harness.cc |
| +++ b/chrome/browser/sync/profile_sync_service_harness.cc |
| @@ -17,6 +17,7 @@ |
| #include "base/memory/ref_counted.h" |
| #include "base/message_loop.h" |
| #include "base/task.h" |
| +#include "base/test/test_timeouts.h" |
|
Raghu Simha
2011/08/05 22:45:09
Does this need to be included?
lipalani1
2011/08/05 23:09:29
Done.
|
| #include "base/tracked.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/sync/sessions/session_state.h" |
| @@ -25,9 +26,13 @@ |
| using browser_sync::sessions::SyncSessionSnapshot; |
| +// TODO (rsimha): Remove the following lines once crbug.com/91863 is fixed. |
|
Raghu Simha
2011/08/05 22:45:09
No space between TODO and open paren. (The "TODOs"
lipalani1
2011/08/05 23:09:29
Done.
|
| // 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. |
|
Raghu Simha
2011/08/05 22:45:09
nit: s/testcases/test cases/
lipalani1
2011/08/05 23:09:29
Done.
|
| +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 +332,14 @@ bool ProfileSyncServiceHarness::RunStateChangeMachine() { |
| } |
| break; |
| } |
| + case WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION: { |
| + VLOG(1) << GetClientInfoString( |
| + "WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION"); |
| + retry_verifier_.VerifyRetryInterval(*GetLastSessionSnapshot()); |
|
Raghu Simha
2011/08/05 22:45:09
This will segfault if GetLastSessionSnapshot() ret
lipalani1
2011/08/05 23:09:29
Done.
|
| + if (retry_verifier_.Done()) |
| + SignalStateCompleteWithNextState(WAITING_FOR_NOTHING); |
| + break; |
| + } |
| case SERVER_UNREACHABLE: { |
| VLOG(1) << GetClientInfoString("SERVER_UNREACHABLE"); |
| if (GetStatus().server_reachable) { |
| @@ -477,6 +490,14 @@ bool ProfileSyncServiceHarness::AwaitSyncDisabled(const std::string& reason) { |
| return wait_state_ == SYNC_DISABLED; |
| } |
| +bool ProfileSyncServiceHarness::AwaitExponentialBackoffVerification() { |
| + retry_verifier_.Initialize(*GetLastSessionSnapshot()); |
|
Raghu Simha
2011/08/05 22:45:09
This will segfault if GetLastSessionSnapshot() ret
lipalani1
2011/08/05 23:09:29
Done.
Raghu Simha
2011/08/05 23:23:58
Still need a null check here.
|
| + 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"); |