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. |
*/ |