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

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

Issue 1137543002: Sync: add a test for downloading a tombstoned bookmark (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixing 1st round of comments Created 5 years, 7 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.cc
diff --git a/chrome/browser/sync/test/integration/bookmarks_helper.cc b/chrome/browser/sync/test/integration/bookmarks_helper.cc
index 4a5a6c6773f8ed681773f07512b91a4fbc90863c..53767d0df3cb24735c84bfdcf99d728803dbe3d6 100644
--- a/chrome/browser/sync/test/integration/bookmarks_helper.cc
+++ b/chrome/browser/sync/test/integration/bookmarks_helper.cc
@@ -27,6 +27,7 @@
#include "chrome/browser/sync/glue/bookmark_change_processor.h"
#include "chrome/browser/sync/test/integration/multi_client_status_change_checker.h"
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
+#include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
#include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/common/chrome_paths.h"
@@ -755,6 +756,51 @@ bool AwaitAllModelsMatch() {
return !checker.TimedOut();
}
+namespace {
+
+class CountBookmarksWithTitlesMatchingChecker
+ : public SingleClientStatusChangeChecker {
+ public:
+ CountBookmarksWithTitlesMatchingChecker(ProfileSyncService* service,
+ int profile_index,
+ const std::string& title,
+ int expected_count)
+ : SingleClientStatusChangeChecker(service),
+ profile_index_(profile_index),
+ title_(title),
+ expected_count_(expected_count) {
+ DCHECK_GE(0, expected_count) << "expected_count must be non-negative.";
+ }
+
+ bool IsExitConditionSatisfied() override {
+ int actual_count = CountBookmarksWithTitlesMatching(profile_index_, title_);
+ return expected_count_ == actual_count;
+ }
+
+ std::string GetDebugMessage() const override {
+ return "Waiting for bookmark count to match";
+ }
+
+ private:
+ const int profile_index_;
+ const std::string title_;
+ const int expected_count_;
+};
+
+} // namespace
+
+bool AwaitCountBookmarksWithTitlesMatching(int profile,
+ const std::string& title,
+ int expected_count) {
+ ProfileSyncService* service =
+ sync_datatype_helper::test()->GetSyncService(profile);
+ CountBookmarksWithTitlesMatchingChecker checker(service,
+ profile,
+ title,
+ expected_count);
+ checker.Wait();
+ return !checker.TimedOut();
+}
bool ContainsDuplicateBookmarks(int profile) {
ui::TreeNodeIterator<const BookmarkNode> iterator(
« no previous file with comments | « chrome/browser/sync/test/integration/bookmarks_helper.h ('k') | chrome/browser/sync/test/integration/p2p_sync_refresher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698