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

Unified Diff: chrome/browser/sync/test/integration/sync_exponential_backoff_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/sync_exponential_backoff_test.cc
diff --git a/chrome/browser/sync/test/integration/sync_exponential_backoff_test.cc b/chrome/browser/sync/test/integration/sync_exponential_backoff_test.cc
index 962129704be5d638e3a4b96ab4ad44654300b8c4..ffdb82a35208cbf7edf95946316912c9ddfe663b 100644
--- a/chrome/browser/sync/test/integration/sync_exponential_backoff_test.cc
+++ b/chrome/browser/sync/test/integration/sync_exponential_backoff_test.cc
@@ -8,8 +8,8 @@
#include "chrome/browser/sync/test/integration/bookmarks_helper.h"
#include "chrome/browser/sync/test/integration/retry_verifier.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/browser_sync/profile_sync_service.h"
#include "net/base/network_change_notifier.h"
@@ -18,7 +18,6 @@ namespace {
using bookmarks_helper::AddFolder;
using bookmarks_helper::ModelMatchesVerifier;
using syncer::SyncCycleSnapshot;
-using sync_integration_test_util::AwaitCommitActivityCompletion;
class SyncExponentialBackoffTest : public SyncTest {
public:
@@ -39,8 +38,6 @@ class ExponentialBackoffChecker : public SingleClientStatusChangeChecker {
retry_verifier_.Initialize(snap);
}
- ~ExponentialBackoffChecker() override {}
-
// Checks if backoff is complete. Called repeatedly each time PSS notifies
// observers of a state change.
bool IsExitConditionSatisfied() override {
@@ -68,7 +65,7 @@ IN_PROC_BROWSER_TEST_F(SyncExponentialBackoffTest, OfflineToOnline) {
// Add an item and ensure that sync is successful.
ASSERT_TRUE(AddFolder(0, 0, "folder1"));
- ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService(0)));
+ ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait());
GetFakeServer()->DisableNetwork();
@@ -77,9 +74,7 @@ IN_PROC_BROWSER_TEST_F(SyncExponentialBackoffTest, OfflineToOnline) {
// Verify that the client goes into exponential backoff while it is unable to
// reach the sync server.
- ExponentialBackoffChecker exponential_backoff_checker(GetSyncService(0));
- exponential_backoff_checker.Wait();
- ASSERT_FALSE(exponential_backoff_checker.TimedOut());
+ ASSERT_TRUE(ExponentialBackoffChecker(GetSyncService(0)).Wait());
// Trigger network change notification and remember time when it happened.
// Ensure that scheduler runs canary job immediately.
@@ -90,7 +85,7 @@ IN_PROC_BROWSER_TEST_F(SyncExponentialBackoffTest, OfflineToOnline) {
base::Time network_notification_time = base::Time::Now();
// Verify that sync was able to recover.
- ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService(0)));
+ ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait());
ASSERT_TRUE(ModelMatchesVerifier(0));
// Verify that recovery time is short. Without canary job recovery time would
@@ -106,7 +101,7 @@ IN_PROC_BROWSER_TEST_F(SyncExponentialBackoffTest, TransientErrorTest) {
// Add an item and ensure that sync is successful.
ASSERT_TRUE(AddFolder(0, 0, "folder1"));
- ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService(0)));
+ ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait());
GetFakeServer()->TriggerError(sync_pb::SyncEnums::TRANSIENT_ERROR);
@@ -115,9 +110,7 @@ IN_PROC_BROWSER_TEST_F(SyncExponentialBackoffTest, TransientErrorTest) {
// Verify that the client goes into exponential backoff while it is unable to
// reach the sync server.
- ExponentialBackoffChecker exponential_backoff_checker(GetSyncService(0));
- exponential_backoff_checker.Wait();
- ASSERT_FALSE(exponential_backoff_checker.TimedOut());
+ ASSERT_TRUE(ExponentialBackoffChecker(GetSyncService(0)).Wait());
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698