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

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

Issue 1553433002: [Sync] Sync should run canary cycle after any network related error (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android test Created 4 years, 11 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
« no previous file with comments | « no previous file | sync/engine/backoff_delay_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 51a07cc5dd430288c3a31d5fee22a1fa9712d644..19108118b4c294a07c3b2ff0e8acaf662b5e31d6 100644
--- a/chrome/browser/sync/test/integration/sync_exponential_backoff_test.cc
+++ b/chrome/browser/sync/test/integration/sync_exponential_backoff_test.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
#include "components/browser_sync/browser/profile_sync_service.h"
+#include "net/base/network_change_notifier.h"
namespace {
@@ -81,11 +82,24 @@ IN_PROC_BROWSER_TEST_F(SyncExponentialBackoffTest, OfflineToOnline) {
exponential_backoff_checker.Wait();
ASSERT_FALSE(exponential_backoff_checker.TimedOut());
+ // Trigger network change notification and remember time when it happened.
+ // Ensure that scheduler runs canary job immediately.
GetFakeServer()->EnableNetwork();
+ net::NetworkChangeNotifier::NotifyObserversOfConnectionTypeChangeForTests(
+ net::NetworkChangeNotifier::CONNECTION_ETHERNET);
+
+ base::Time network_notification_time = base::Time::Now();
// Verify that sync was able to recover.
ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0))));
ASSERT_TRUE(ModelMatchesVerifier(0));
+
+ // Verify that recovery time is short. Without canary job recovery time would
+ // be more than 5 seconds.
+ base::TimeDelta recovery_time =
+ GetSyncService(0)->GetLastSessionSnapshot().sync_start_time() -
+ network_notification_time;
+ ASSERT_LE(recovery_time, base::TimeDelta::FromSeconds(2));
}
IN_PROC_BROWSER_TEST_F(SyncExponentialBackoffTest, TransientErrorTest) {
« no previous file with comments | « no previous file | sync/engine/backoff_delay_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698