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

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

Issue 165393010: Draft: Moving code out of ProfileSyncServiceHarness (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 5d34c0b480d4df5c6b89bac369e59b22dc90fd96..342808eedd4c5a30db064a93b19a14f390145a26 100644
--- a/chrome/browser/sync/test/integration/status_change_checker.h
+++ b/chrome/browser/sync/test/integration/status_change_checker.h
@@ -7,6 +7,10 @@
#include <string>
+#include "base/time/time.h"
+
+class ProfileSyncServiceObserver;
+
// Interface for a helper class that can be used to check if a desired change in
// the state of the sync engine has taken place. Used by the desktop sync
// integration tests.
@@ -16,22 +20,40 @@
// ProfileSyncServiceHarness::AwaitStatusChange().
class StatusChangeChecker {
public:
- explicit StatusChangeChecker(const std::string& source);
+ 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;
- std::string source() const { return source_; }
+ // 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;
+
+ // The maximum length of time to wait for this operation before timing out.
+ virtual base::TimeDelta GetTimeoutDuration() = 0;
+
+ virtual void InitObserver(ProfileSyncServiceObserver*) = 0;
+ virtual void UninitObserver(ProfileSyncServiceObserver*) = 0;
+
+ // Exposed only for the StatusChangeCheckerRunner. Please don't call this.
+ void set_is_waiting(bool value);
+
+ // Runs the StatusChangeChecker to completion.
+ static bool Run(StatusChangeChecker* checker);
protected:
virtual ~StatusChangeChecker();
+ // Returns true if the 'wait' is in progress.
+ bool IsWaiting();
+
+ // Asks that we stop waiting and return a successfully. (ie. Don't time out).
+ void StopWaitingAndSucceed();
+
private:
- // Used for logging / debugging. Can be used to hold the name of the internal
- // function called by IsExitConditionSatisfied. Logged along with select info
- // when ProfileSyncServiceHarness observes a change in ProfileSyncService.
- std::string source_;
+ bool is_waiting_;
};
#endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_STATUS_CHANGE_CHECKER_H_

Powered by Google App Engine
This is Rietveld 408576698