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

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

Issue 2379433002: [Sync] Refactoring of sync integration test checkers to remove boilerplate await methods. (Closed)
Patch Set: Fixing another ChromeOS test. Created 4 years, 3 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/bookmarks_helper.h
diff --git a/chrome/browser/sync/test/integration/bookmarks_helper.h b/chrome/browser/sync/test/integration/bookmarks_helper.h
index 7a1a5036a50f3f74042a1074f890b14d1ee8ce8c..37892ab192562d3250ead8b0bd1d7a06e6f597e5 100644
--- a/chrome/browser/sync/test/integration/bookmarks_helper.h
+++ b/chrome/browser/sync/test/integration/bookmarks_helper.h
@@ -8,6 +8,9 @@
#include <string>
#include "base/compiler_specific.h"
+#include "chrome/browser/sync/test/integration/await_match_status_change_checker.h"
+#include "chrome/browser/sync/test/integration/multi_client_status_change_checker.h"
+#include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
#include "third_party/skia/include/core/SkColor.h"
class GURL;
@@ -157,24 +160,6 @@ bool ModelsMatch(int profile_a, int profile_b) WARN_UNUSED_RESULT;
// match.
bool AllModelsMatch() WARN_UNUSED_RESULT;
-// Check if the bookmarks models of all sync profiles match each other, using
-// AllModelsMatch. Returns true if bookmark models match and don't timeout
-// while checking.
-bool AwaitAllModelsMatch() WARN_UNUSED_RESULT;
-
-// Blocks the caller until the given |profile| contains |expected_count|
-// bookmarks with |title| or until waiting times out.
-bool AwaitCountBookmarksWithTitlesMatching(int profile,
- const std::string& title,
- int expected_count)
- WARN_UNUSED_RESULT;
-
-// Blocks the caller until the given |profile| contains |expected_count|
-// bookmarks with |url| or until waiting times out.
-bool AwaitCountBookmarksWithUrlsMatching(int profile,
- const GURL& url,
- int expected_count) WARN_UNUSED_RESULT;
-
// Checks if the bookmark model of profile |profile| contains any instances of
// two bookmarks with the same URL under the same parent folder. Returns true
// if even one instance is found.
@@ -232,4 +217,39 @@ std::string IndexedSubsubfolderName(int i);
} // namespace bookmarks_helper
+// Checker used to block until bookmarks match on all clients.
+class BookmarksMatchChecker : public MultiClientStatusChangeChecker {
+ public:
+ BookmarksMatchChecker();
+
+ // StatusChangeChecker implementation.
+ bool IsExitConditionSatisfied() override;
+ std::string GetDebugMessage() const override;
+};
+
+// TODO(pvalenzuela): Remove this class and instead use
+// AwaitMatchStatusChangeChecker.
+class BookmarksTitleChecker : public SingleClientStatusChangeChecker {
maxbogue 2016/09/30 16:27:55 Give this guy a real class comment in addition to
skym 2016/09/30 17:43:21 Done.
+ public:
+ BookmarksTitleChecker(int profile_index,
+ const std::string& title,
+ int expected_count);
+
+ // StatusChangeChecker implementation.
+ bool IsExitConditionSatisfied() override;
+ std::string GetDebugMessage() const override;
+
+ private:
+ const int profile_index_;
+ const std::string title_;
+ const int expected_count_;
+};
+
+// Checker used to block until the actual number of bookmarks with the given url
+// match the expected count.
+class BookmarksUrlChecker : public AwaitMatchStatusChangeChecker {
+ public:
+ BookmarksUrlChecker(int profile, const GURL& url, int expected_count);
+};
+
#endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_BOOKMARKS_HELPER_H_

Powered by Google App Engine
This is Rietveld 408576698