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

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

Issue 2641973003: Implement server-suggested update check backoff (Closed)
Patch Set: 2 Created 3 years, 10 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 3148d26f855dfda65c034995f8052e0f5cf2a742..508c0d6e59cc9a2ccb87b916aca46d5273e4c334 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
@@ -410,6 +410,30 @@ public class WebApkUpdateManagerTest {
}
/**
+ * Test that if a WebAPK is expected to check update less frequently, the is-update-needed
pkotwicz 2017/02/14 00:15:13 Nit: "update" -> "updates"
Xi Han 2017/02/14 22:25:46 Done.
+ * 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();
pkotwicz 2017/02/14 00:15:12 Why do you delete the storage?
Xi Han 2017/02/14 22:25:46 Reverted.
+ 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