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

Side by Side Diff: chrome/browser/sync/test/integration/status_change_checker.h

Issue 474273003: sync: Refactor bookmarks integration tests Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use RunLoop for favicon wait Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_STATUS_CHANGE_CHECKER_H_ 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_STATUS_CHANGE_CHECKER_H_
6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_STATUS_CHANGE_CHECKER_H_ 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_STATUS_CHANGE_CHECKER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/run_loop.h"
10 #include "base/time/time.h" 11 #include "base/time/time.h"
11 12
12 class ProfileSyncServiceHarness; 13 class ProfileSyncServiceHarness;
13 14
14 // Interface for a helper class that can pump the message loop while waiting 15 // Interface for a helper class that can pump the message loop while waiting
15 // for a certain state transition to take place. 16 // for a certain state transition to take place.
16 // 17 //
17 // This is a template that should be filled in by child classes so they can 18 // This is a template that should be filled in by child classes so they can
18 // observe specific kinds of changes and await specific conditions. 19 // observe specific kinds of changes and await specific conditions.
19 // 20 //
20 // The instances of this class are intended to be single-use. It doesn't make 21 // The instances of this class are intended to be single-use. It doesn't make
21 // sense to call StartBlockingWait() more than once. 22 // sense to call StartBlockingWait() more than once.
22 class StatusChangeChecker { 23 class StatusChangeChecker {
23 public: 24 public:
24 explicit StatusChangeChecker(); 25 StatusChangeChecker();
25 26
26 // Returns a string representing this current StatusChangeChecker, and 27 // Returns a string representing this current StatusChangeChecker, and
27 // possibly some small part of its state. For example: "AwaitPassphraseError" 28 // possibly some small part of its state. For example: "AwaitPassphraseError"
28 // or "AwaitMigrationDone(BOOKMARKS)". 29 // or "AwaitMigrationDone(BOOKMARKS)".
29 virtual std::string GetDebugMessage() const = 0; 30 virtual std::string GetDebugMessage() const = 0;
30 31
31 // Returns true if the blocking wait was exited because of a timeout. 32 // Returns true if the blocking wait was exited because of a timeout.
32 bool TimedOut() const; 33 bool TimedOut() const;
33 34
34 virtual bool IsExitConditionSatisfied() = 0; 35 virtual bool IsExitConditionSatisfied() = 0;
(...skipping 15 matching lines...) Expand all
50 // Stop the nested running of the message loop started in StartBlockingWait(). 51 // Stop the nested running of the message loop started in StartBlockingWait().
51 void StopWaiting(); 52 void StopWaiting();
52 53
53 // Checks IsExitConditionSatisfied() and calls StopWaiting() if it returns 54 // Checks IsExitConditionSatisfied() and calls StopWaiting() if it returns
54 // true. 55 // true.
55 void CheckExitCondition(); 56 void CheckExitCondition();
56 57
57 // Called when the blocking wait timeout is exceeded. 58 // Called when the blocking wait timeout is exceeded.
58 void OnTimeout(); 59 void OnTimeout();
59 60
61 // True if the checker stopped waiting because of timeout.
60 bool timed_out_; 62 bool timed_out_;
63
64 // The RunLoop used for waiting.
65 base::RunLoop run_loop_;
61 }; 66 };
62 67
63 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_STATUS_CHANGE_CHECKER_H_ 68 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_STATUS_CHANGE_CHECKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698