OLD | NEW |
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 // Interface for a helper class that can be used to check if a desired change in | 10 // Interface for a helper class that can be used to check if a desired change in |
11 // the state of the sync engine has taken place. Used by the desktop sync | 11 // the state of the sync engine has taken place. Used by the desktop sync |
12 // integration tests. | 12 // integration tests. |
13 // | 13 // |
14 // Usage: Tests that want to use this class to wait for an arbitrary sync state | 14 // Usage: Tests that want to use this class to wait for an arbitrary sync state |
15 // must implement a concrete StatusChangeChecker object and pass it to | 15 // must implement a concrete StatusChangeChecker object and pass it to |
16 // ProfileSyncServiceHarness::AwaitStatusChange(). | 16 // ProfileSyncServiceHarness::AwaitStatusChange(). |
17 class StatusChangeChecker { | 17 class StatusChangeChecker { |
18 public: | 18 public: |
19 explicit StatusChangeChecker(const std::string& source); | 19 explicit StatusChangeChecker(); |
20 | 20 |
21 // Called every time ProfileSyncServiceHarness is notified of a change in the | 21 // Called every time ProfileSyncServiceHarness is notified of a change in the |
22 // state of the sync engine. Returns true if the desired change has occurred. | 22 // state of the sync engine. Returns true if the desired change has occurred. |
23 virtual bool IsExitConditionSatisfied() = 0; | 23 virtual bool IsExitConditionSatisfied() = 0; |
24 | 24 |
25 std::string source() const { return source_; } | 25 // Returns a string representing this current StatusChangeChecker, and |
| 26 // possibly some small part of its state. For example: "AwaitPassphraseError" |
| 27 // or "AwaitMigrationDone(BOOKMARKS)". |
| 28 virtual std::string GetDebugMessage() const = 0; |
26 | 29 |
27 protected: | 30 protected: |
28 virtual ~StatusChangeChecker(); | 31 virtual ~StatusChangeChecker(); |
29 | |
30 private: | |
31 // Used for logging / debugging. Can be used to hold the name of the internal | |
32 // function called by IsExitConditionSatisfied. Logged along with select info | |
33 // when ProfileSyncServiceHarness observes a change in ProfileSyncService. | |
34 std::string source_; | |
35 }; | 32 }; |
36 | 33 |
37 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_STATUS_CHANGE_CHECKER_H_ | 34 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_STATUS_CHANGE_CHECKER_H_ |
OLD | NEW |