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

Unified Diff: chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java

Issue 2641973003: Implement server-suggested update check backoff (Closed)
Patch Set: Created 3 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
Index: chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java
index 38d8dd5ccddfa731e8529665e4fdb0d94e05fa25..b5ea98924d0d727f77afbb9ccfef87db513a760e 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java
@@ -387,6 +387,30 @@ public class WebApkUpdateManagerTest {
}
/**
+ * Test that if a WebAPK is expected to check update less frequently, the is-update-needed
+ * check is done after an extended time interval (as opposed to the usual delay).
+ */
+ @Test
+ public void testInfrequentUpdateIntervalIfNoPriorWebApkUpdate() {
+ assertTrue(WebApkUpdateManager.INFREQUENT_UPDATE_INTERVAL
+ > WebApkUpdateManager.FULL_CHECK_UPDATE_INTERVAL);
+
+ getStorage().delete();
+ WebappDataStorage storage = getStorage();
+
+ // Done when WebAPK is registered in {@link WebApkActivity}.
+ storage.updateTimeOfLastCheckForUpdatedWebManifest();
+ storage.updateInfrequentUpdates(true);
+
+ assertFalse(updateIfNeededChecksForUpdatedWebManifest());
+ mClock.advance(WebApkUpdateManager.FULL_CHECK_UPDATE_INTERVAL);
+ assertFalse(updateIfNeededChecksForUpdatedWebManifest());
+ mClock.advance(WebApkUpdateManager.INFREQUENT_UPDATE_INTERVAL
+ - WebApkUpdateManager.FULL_CHECK_UPDATE_INTERVAL);
+ assertTrue(updateIfNeededChecksForUpdatedWebManifest());
+ }
+
+ /**
* Test that the is-update-needed check is tried the next time that the WebAPK is launched if
* Chrome is killed prior to the initial URL finishing loading.
*/

Powered by Google App Engine
This is Rietveld 408576698