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

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

Issue 2379433002: [Sync] Refactoring of sync integration test checkers to remove boilerplate await methods. (Closed)
Patch Set: Rebase Created 4 years, 2 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/sync_integration_test_util.h
diff --git a/chrome/browser/sync/test/integration/sync_integration_test_util.h b/chrome/browser/sync/test/integration/sync_integration_test_util.h
index b24758d328ac40d0c370ed92cc3f213245a7350e..c3af2d76cbceb07419832d9dc463e25eb6e2e4b1 100644
--- a/chrome/browser/sync/test/integration/sync_integration_test_util.h
+++ b/chrome/browser/sync/test/integration/sync_integration_test_util.h
@@ -5,31 +5,49 @@
#ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_INTEGRATION_TEST_UTIL_H_
#define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_INTEGRATION_TEST_UTIL_H_
+#include <string>
+
+#include "chrome/browser/sync/test/integration/fake_server_match_status_checker.h"
+#include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
#include "components/sync/base/model_type.h"
namespace browser_sync {
class ProfileSyncService;
} // namespace browser_sync
-namespace fake_server {
-class FakeServer;
-} // namespace fake_server
-
-namespace sync_integration_test_util {
-
-// Wait until the provided |service| is blocked waiting for a passphrase.
-bool AwaitPassphraseRequired(browser_sync::ProfileSyncService* service);
-
-// Wait until the provided |service| has accepted the new passphrase.
-bool AwaitPassphraseAccepted(browser_sync::ProfileSyncService* service);
-
-// Wait until the |service| is fully synced.
-// This can be a bit flaky. See UpdatedProgressMarkerChecker for details.
-bool AwaitCommitActivityCompletion(browser_sync::ProfileSyncService* service);
-
-// Wait until the fake server has a specific count for the given type.
-bool AwaitServerCount(syncer::ModelType type, size_t count);
-
-} // namespace sync_integration_test_util
+// Checker to block until the server has a given number of entities.
+class ServerCountMatchStatusChecker
+ : public fake_server::FakeServerMatchStatusChecker {
+ public:
+ ServerCountMatchStatusChecker(syncer::ModelType type, size_t count);
+
+ // StatusChangeChecker implementation.
+ bool IsExitConditionSatisfied() override;
+ std::string GetDebugMessage() const override;
+
+ private:
+ const syncer::ModelType type_;
+ const size_t count_;
+};
+
+// Checker to block until service is waiting for a passphrase.
+class PassphraseRequiredChecker : public SingleClientStatusChangeChecker {
+ public:
+ explicit PassphraseRequiredChecker(browser_sync::ProfileSyncService* service);
+
+ // StatusChangeChecker implementation.
+ bool IsExitConditionSatisfied() override;
+ std::string GetDebugMessage() const override;
+};
+
+// Checker to block until service has accepted a new passphrase.
+class PassphraseAcceptedChecker : public SingleClientStatusChangeChecker {
+ public:
+ explicit PassphraseAcceptedChecker(browser_sync::ProfileSyncService* service);
+
+ // StatusChangeChecker implementation.
+ bool IsExitConditionSatisfied() override;
+ std::string GetDebugMessage() const override;
+};
#endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_INTEGRATION_TEST_UTIL_H_

Powered by Google App Engine
This is Rietveld 408576698