Chromium Code Reviews| Index: chrome/browser/sync/test/integration/status_change_checker.h |
| diff --git a/chrome/browser/sync/test/integration/status_change_checker.h b/chrome/browser/sync/test/integration/status_change_checker.h |
| index 9f8c10867d689052c880a6dce17cd208a19f8e59..52dbcf49a05b1a77c2aa6c7ffff8a32840cd8b0d 100644 |
| --- a/chrome/browser/sync/test/integration/status_change_checker.h |
| +++ b/chrome/browser/sync/test/integration/status_change_checker.h |
| @@ -7,6 +7,8 @@ |
| #include <string> |
| +#include "base/time/time.h" |
| + |
| class ProfileSyncServiceHarness; |
| // Interface for a helper class that can be used to check if a desired change in |
| @@ -20,17 +22,41 @@ class StatusChangeChecker { |
| public: |
| explicit StatusChangeChecker(); |
| - // Called every time ProfileSyncServiceHarness is notified of a change in the |
| - // state of the sync engine. Returns true if the desired change has occurred. |
| - virtual bool IsExitConditionSatisfied() = 0; |
| - |
| // Returns a string representing this current StatusChangeChecker, and |
| // possibly some small part of its state. For example: "AwaitPassphraseError" |
| // or "AwaitMigrationDone(BOOKMARKS)". |
| virtual std::string GetDebugMessage() const = 0; |
| + // Returns true if the blocking wait was exited because of a timeout. |
| + bool TimedOut() const; |
| + |
| + virtual bool IsExitConditionSatisfied() = 0; |
| + |
| protected: |
| virtual ~StatusChangeChecker(); |
| + |
| + // Timeout length when blocking. Default is 45s. |
|
pval...(no longer on Chromium)
2014/05/22 21:07:12
"Default is 45s." doesn't seem very future proof.
rlarocque
2014/05/22 21:29:30
Done.
|
| + virtual base::TimeDelta GetTimeoutDuration(); |
| + |
| + // Helper function to start running the nested message loop. |
| + // |
| + // Will exit if IsExitConditionSatisfied() returns true when called from |
| + // CheckExitCondition(), if a timeout occurs, or if Unblock() is called. |
| + // |
| + // The timeout length is specified with GetTimeoutDuration(). |
| + void StartBlockingWait(); |
| + |
| + // Stop the nested running of the message loop started in StartBlockingWait(). |
| + void Unblock(); |
|
pval...(no longer on Chromium)
2014/05/22 21:07:12
is StopBlockingWait() or StopWaiting() a better na
rlarocque
2014/05/22 21:29:30
Done. Changed name to StopWaiting().
|
| + |
| + // Checks IsExitConditionSatisfied() and calls Unblock() if it returns true. |
| + void CheckExitCondition(); |
| + |
| + // Called when the blocking wait timeout is exceeded. |
| + void OnTimeout(); |
| + |
| + bool timed_out_; |
| + bool wait_started_; |
| }; |
| #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_STATUS_CHANGE_CHECKER_H_ |