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

Unified Diff: chrome/browser/sync/test/integration/two_client_typed_urls_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/two_client_typed_urls_sync_test.cc
diff --git a/chrome/browser/sync/test/integration/two_client_typed_urls_sync_test.cc b/chrome/browser/sync/test/integration/two_client_typed_urls_sync_test.cc
index 181f0a31e56fe58415d22338817ff1fbcb5f91a1..85ce078ac7025e323cb0de4c6cb514b154eb5de0 100644
--- a/chrome/browser/sync/test/integration/two_client_typed_urls_sync_test.cc
+++ b/chrome/browser/sync/test/integration/two_client_typed_urls_sync_test.cc
@@ -13,20 +13,18 @@
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sync/test/integration/bookmarks_helper.h"
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.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/typed_urls_helper.h"
+#include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h"
#include "components/history/core/browser/history_types.h"
using base::ASCIIToUTF16;
using bookmarks::BookmarkNode;
-using sync_integration_test_util::AwaitCommitActivityCompletion;
using typed_urls_helper::AddUrlToHistory;
using typed_urls_helper::AddUrlToHistoryWithTimestamp;
using typed_urls_helper::AddUrlToHistoryWithTransition;
using typed_urls_helper::AreVisitsEqual;
using typed_urls_helper::AreVisitsUnique;
-using typed_urls_helper::AwaitCheckAllProfilesHaveSameURLs;
using typed_urls_helper::CheckURLRowVectorsAreEqual;
using typed_urls_helper::DeleteUrlFromHistory;
using typed_urls_helper::GetTypedUrlsFromClient;
@@ -90,7 +88,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, E2E_ENABLED(Add)) {
// Populate one client with a URL, wait for it to sync to the other.
GURL new_url(kHistoryUrl);
AddUrlToHistory(0, new_url);
- ASSERT_TRUE(AwaitCheckAllProfilesHaveSameURLs());
+ ASSERT_TRUE(ProfilesHaveSameURLsChecker().Wait());
// Assert that the second client has the correct new URL.
history::URLRows urls = GetTypedUrlsFromClient(1);
@@ -178,7 +176,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, E2E_ENABLED(AddThenDelete)) {
// Populate one client with a URL, wait for it to sync to the other.
GURL new_url(kHistoryUrl);
AddUrlToHistory(0, new_url);
- ASSERT_TRUE(AwaitCheckAllProfilesHaveSameURLs());
+ ASSERT_TRUE(ProfilesHaveSameURLsChecker().Wait());
// Assert that the second client has the correct new URL.
history::URLRows urls = GetTypedUrlsFromClient(1);
@@ -187,7 +185,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, E2E_ENABLED(AddThenDelete)) {
// Delete from first client, and wait for them to sync.
DeleteUrlFromHistory(0, new_url);
- ASSERT_TRUE(AwaitCheckAllProfilesHaveSameURLs());
+ ASSERT_TRUE(ProfilesHaveSameURLsChecker().Wait());
// Assert that it's deleted from the second client.
ASSERT_EQ(initial_count, GetTypedUrlsFromClient(1).size());
@@ -209,7 +207,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest,
GURL url2(kUrl2);
AddUrlToHistory(0, url1);
AddUrlToHistory(1, url2);
- ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService(1)));
+ ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(1)).Wait());
// Make sure that no data was exchanged.
history::URLRows post_sync_urls = GetTypedUrlsFromClient(0);
@@ -222,7 +220,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest,
// Enable typed url sync, make both URLs are synced to each client.
GetClient(0)->EnableSyncForDatatype(syncer::TYPED_URLS);
- ASSERT_TRUE(AwaitCheckAllProfilesHaveSameURLs());
+ ASSERT_TRUE(ProfilesHaveSameURLsChecker().Wait());
}
// flaky, see crbug.com/108511
@@ -239,7 +237,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, DISABLED_AddOneDeleteOther) {
ASSERT_EQ(new_url, urls[0].url());
// Both clients should have this URL.
- ASSERT_TRUE(AwaitCheckAllProfilesHaveSameURLs());
+ ASSERT_TRUE(ProfilesHaveSameURLsChecker().Wait());
// Now, delete the URL from the second client.
DeleteUrlFromHistory(1, new_url);
@@ -247,7 +245,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, DISABLED_AddOneDeleteOther) {
ASSERT_EQ(1U, urls.size());
// Both clients should have this URL removed.
- ASSERT_TRUE(AwaitCheckAllProfilesHaveSameURLs());
+ ASSERT_TRUE(ProfilesHaveSameURLsChecker().Wait());
}
// flaky, see crbug.com/108511
@@ -265,7 +263,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest,
ASSERT_EQ(new_url, urls[0].url());
// Both clients should have this URL.
- ASSERT_TRUE(AwaitCheckAllProfilesHaveSameURLs());
+ ASSERT_TRUE(ProfilesHaveSameURLsChecker().Wait());
// Now, delete the URL from the second client.
DeleteUrlFromHistory(1, new_url);
@@ -273,14 +271,14 @@ IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest,
ASSERT_EQ(1U, urls.size());
// Both clients should have this URL removed.
- ASSERT_TRUE(AwaitCheckAllProfilesHaveSameURLs());
+ ASSERT_TRUE(ProfilesHaveSameURLsChecker().Wait());
// Add it to the first client again, should succeed (tests that the deletion
// properly disassociates that URL).
AddUrlToHistory(0, new_url);
// Both clients should have this URL added again.
- ASSERT_TRUE(AwaitCheckAllProfilesHaveSameURLs());
+ ASSERT_TRUE(ProfilesHaveSameURLsChecker().Wait());
}
IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest,
@@ -304,7 +302,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest,
// before syncing client 0, so we have both of client 1's URLs in the sync DB
// at the time that client 0 does model association.
ASSERT_TRUE(GetClient(1)->SetupSync()) << "SetupSync() failed";
- AwaitCommitActivityCompletion(GetSyncService(1));
+ ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(1)).Wait());
ASSERT_TRUE(GetClient(0)->SetupSync()) << "SetupSync() failed";
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
@@ -371,7 +369,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, UpdateToNonTypedURL) {
ASSERT_EQ(0U, urls.size());
// Both clients should have 0 typed URLs.
- ASSERT_TRUE(AwaitCheckAllProfilesHaveSameURLs());
+ ASSERT_TRUE(ProfilesHaveSameURLsChecker().Wait());
urls = GetTypedUrlsFromClient(0);
ASSERT_EQ(0U, urls.size());
@@ -406,7 +404,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest,
// Modify the non-typed URL. It should not get synced.
typed_urls_helper::SetPageTitle(0, kNonTypedURL, "Welcome to Non-Typed URL");
- ASSERT_TRUE(AwaitCheckAllProfilesHaveSameURLs());
+ ASSERT_TRUE(ProfilesHaveSameURLsChecker().Wait());
history::VisitVector visits;
// First client has both visits.
@@ -452,7 +450,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest,
history::SOURCE_BROWSED);
// Both clients should have both URLs.
- ASSERT_TRUE(AwaitCheckAllProfilesHaveSameURLs());
+ ASSERT_TRUE(ProfilesHaveSameURLsChecker().Wait());
history::VisitVector visits =
typed_urls_helper::GetVisitsForURLFromClient(0, initial_url);
@@ -537,7 +535,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, BookmarksWithTypedVisit) {
AddUrlToHistory(0, bookmark_url);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
- ASSERT_TRUE(AwaitCheckAllProfilesHaveSameURLs());
+ ASSERT_TRUE(ProfilesHaveSameURLsChecker().Wait());
history::URLRows urls = GetTypedUrlsFromClient(0);
ASSERT_EQ(1U, urls.size());
ASSERT_EQ(bookmark_url, urls[0].url());

Powered by Google App Engine
This is Rietveld 408576698