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

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

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/single_client_bookmarks_sync_test.cc
diff --git a/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc b/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc
index 3165e7cc10b1df221c935a688dd6f004c5e30a4d..eae1d73132cb1a12239583a2eba3937287c92e66 100644
--- a/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc
+++ b/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc
@@ -9,8 +9,8 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/test/integration/bookmarks_helper.h"
#include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
-#include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
+#include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/browser_sync/profile_sync_service.h"
#include "components/sync/test/fake_server/bookmark_entity_builder.h"
@@ -23,8 +23,6 @@ using bookmarks::BookmarkModel;
using bookmarks::BookmarkNode;
using bookmarks_helper::AddFolder;
using bookmarks_helper::AddURL;
-using bookmarks_helper::AwaitCountBookmarksWithTitlesMatching;
-using bookmarks_helper::AwaitCountBookmarksWithUrlsMatching;
using bookmarks_helper::CountBookmarksWithTitlesMatching;
using bookmarks_helper::CountBookmarksWithUrlsMatching;
using bookmarks_helper::CountFoldersWithTitlesMatching;
@@ -38,7 +36,6 @@ using bookmarks_helper::Remove;
using bookmarks_helper::RemoveAll;
using bookmarks_helper::SetFavicon;
using bookmarks_helper::SetTitle;
-using sync_integration_test_util::AwaitCommitActivityCompletion;
// All tests in this file utilize a single profile.
// TODO(pvalenzuela): Standardize this pattern by moving this constant to
@@ -110,7 +107,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, Sanity) {
// Setup sync, wait for its completion, and make sure changes were synced.
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(
- AwaitCommitActivityCompletion(GetSyncService(kSingleProfileIndex)));
+ UpdatedProgressMarkerChecker(GetSyncService(kSingleProfileIndex)).Wait());
ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex));
// Ultimately we want to end up with the following model; but this test is
@@ -142,7 +139,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, Sanity) {
// Wait for the bookmark position change to sync.
ASSERT_TRUE(
- AwaitCommitActivityCompletion(GetSyncService(kSingleProfileIndex)));
+ UpdatedProgressMarkerChecker(GetSyncService(kSingleProfileIndex)).Wait());
ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex));
const BookmarkNode* porsche = AddURL(
@@ -155,7 +152,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, Sanity) {
// Wait for the rearranged hierarchy to sync.
ASSERT_TRUE(
- AwaitCommitActivityCompletion(GetSyncService(kSingleProfileIndex)));
+ UpdatedProgressMarkerChecker(GetSyncService(kSingleProfileIndex)).Wait());
ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex));
ASSERT_EQ(1, tier1_a_url0->parent()->GetIndexOf(tier1_a_url0));
@@ -180,7 +177,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, Sanity) {
// Wait for the title change to sync.
ASSERT_TRUE(
- AwaitCommitActivityCompletion(GetSyncService(kSingleProfileIndex)));
+ UpdatedProgressMarkerChecker(GetSyncService(kSingleProfileIndex)).Wait());
ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex));
ASSERT_EQ(tier1_a_url0->id(), top->GetChild(top->child_count() - 1)->id());
@@ -200,7 +197,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, Sanity) {
// Wait for newly added bookmarks to sync.
ASSERT_TRUE(
- AwaitCommitActivityCompletion(GetSyncService(kSingleProfileIndex)));
+ UpdatedProgressMarkerChecker(GetSyncService(kSingleProfileIndex)).Wait());
ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex));
// Only verify FakeServer data if FakeServer is being used.
@@ -256,7 +253,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
bookmarks_helper::FROM_SYNC);
ASSERT_TRUE(
- AwaitCommitActivityCompletion(GetSyncService(kSingleProfileIndex)));
+ UpdatedProgressMarkerChecker(GetSyncService(kSingleProfileIndex)).Wait());
ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex));
scoped_refptr<base::RefCountedMemory> original_favicon_bytes =
@@ -318,13 +315,13 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
// Set up sync, wait for its completion and verify that changes propagated.
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(
- AwaitCommitActivityCompletion(GetSyncService(kSingleProfileIndex)));
+ UpdatedProgressMarkerChecker(GetSyncService(kSingleProfileIndex)).Wait());
ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex));
// Remove all bookmarks and wait for sync completion.
RemoveAll(kSingleProfileIndex);
ASSERT_TRUE(
- AwaitCommitActivityCompletion(GetSyncService(kSingleProfileIndex)));
+ UpdatedProgressMarkerChecker(GetSyncService(kSingleProfileIndex)).Wait());
// Verify other node has no children now.
EXPECT_EQ(0, GetOtherNode(kSingleProfileIndex)->child_count());
EXPECT_EQ(0, GetBookmarkBarNode(kSingleProfileIndex)->child_count());
@@ -358,8 +355,9 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
TriggerSyncForModelTypes(kSingleProfileIndex, kBookmarksType);
const int kExpectedCountAfterDeletion = 0;
- ASSERT_TRUE(AwaitCountBookmarksWithTitlesMatching(
- kSingleProfileIndex, title, kExpectedCountAfterDeletion));
+ ASSERT_TRUE(BookmarksTitleChecker(kSingleProfileIndex, title,
+ kExpectedCountAfterDeletion)
+ .Wait());
}
IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
@@ -395,8 +393,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
const syncer::ModelTypeSet kBookmarksType(syncer::BOOKMARKS);
TriggerSyncForModelTypes(kSingleProfileIndex, kBookmarksType);
- ASSERT_TRUE(AwaitCountBookmarksWithUrlsMatching(
- kSingleProfileIndex, updated_url, 1));
+ ASSERT_TRUE(BookmarksUrlChecker(kSingleProfileIndex, updated_url, 1).Wait());
ASSERT_EQ(0, CountBookmarksWithUrlsMatching(kSingleProfileIndex,
original_url));
ASSERT_EQ(1, CountBookmarksWithTitlesMatching(kSingleProfileIndex, title));

Powered by Google App Engine
This is Rietveld 408576698