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..93bd523cf076fac533ac9e5c92ce37f2d96837f9 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,45 @@ bool AwaitAllModelsMatch() { |
return !checker.TimedOut(); |
} |
+namespace { |
+ |
+class CountBookmarksWithTitlesMatchingChecker |
+ : public SingleClientStatusChangeChecker { |
+ public: |
+ CountBookmarksWithTitlesMatchingChecker(ProfileSyncService* service, |
+ const std::string& title, |
+ int expected_count) |
+ : SingleClientStatusChangeChecker(service), |
+ title_(title), |
+ expected_count_(expected_count) {} |
maniscalco
2015/05/08 20:13:18
nit: DCHECK expected_count >= 0 ? Either here or
pval...(no longer on Chromium)
2015/05/08 22:34:18
Done.
|
+ |
+ bool IsExitConditionSatisfied() override { |
+ int actual_count = CountBookmarksWithTitlesMatching(0, title_); |
maniscalco
2015/05/08 20:13:18
I see we're passing profile 0 here. Instead, shou
pval...(no longer on Chromium)
2015/05/08 22:34:18
yeah. this was a mistake. thanks for catching this
|
+ return expected_count_ == actual_count; |
+ } |
+ |
+ std::string GetDebugMessage() const override { |
+ return "Waiting for bookmark count to match"; |
+ } |
+ |
+ private: |
+ std::string title_; |
maniscalco
2015/05/08 20:13:18
nit: These data members can be made const.
pval...(no longer on Chromium)
2015/05/08 22:34:18
Done.
|
+ 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, |
+ title, |
+ expected_count); |
+ checker.Wait(); |
+ return !checker.TimedOut(); |
+} |
bool ContainsDuplicateBookmarks(int profile) { |
ui::TreeNodeIterator<const BookmarkNode> iterator( |