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

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: 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/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..ae9fd7f8d60ed7669c4e60ec183616d142f9025f 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,41 @@ 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;
+};
+
+// Checker used to block until the actual number of bookmarks with the given
+// title match the expected count.
+// TODO(pvalenzuela): Remove this class and instead use
+// AwaitMatchStatusChangeChecker.
+class BookmarksTitleChecker : public SingleClientStatusChangeChecker {
+ 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_
« no previous file with comments | « chrome/browser/sync/test/integration/autofill_helper.cc ('k') | chrome/browser/sync/test/integration/bookmarks_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698