Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4730)

Unified Diff: chrome/browser/sync/test/integration/status_change_checker.h

Issue 299843007: sync: Refactor StatusChangeChecker hierarchy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Undo unrelated changes Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698