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

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

Issue 2790213004: Don't try to update incessently when Shell APK version is out of date. (Closed)
Patch Set: Move the shell apk version check back to WebApkUpdateManager. Created 3 years, 8 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 | « chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cb7d13cae483bef749b66140f1b7b9cb98dea500..551991aaf17d376f979db71b0c9efa8bc4e3ee95 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
@@ -721,4 +721,39 @@ public class WebApkUpdateManagerTest {
assertTrue(updateManager.updateRequested());
assertEquals(0, storage.getUpdateRequests());
}
+
+ /**
+ * Tests that a WebAPK update is requested immediately if:
+ * the Shell APK is out of date,
+ * AND
+ * there wasn't a previous request for this ShellAPK version.
+ */
+ @Test
+ public void testShellApkOutOfDate() {
+ registerWebApk(defaultManifestData(), WebApkVersion.CURRENT_SHELL_APK_VERSION - 1);
+ TestWebApkUpdateManager updateManager = new TestWebApkUpdateManager(getStorage());
+
+ // There have not been any update requests for the current ShellAPK version. A WebAPK update
+ // should be requested immediately.
+ updateIfNeeded(updateManager);
+ assertTrue(updateManager.updateCheckStarted());
+ onGotManifestData(updateManager, defaultManifestData());
+ assertTrue(updateManager.updateRequested());
+
+ WebappDataStorage storage = getStorage();
+ storage.updateTimeOfLastWebApkUpdateRequestCompletion();
+ storage.updateLastRequestedShellApkVersion(WebApkVersion.CURRENT_SHELL_APK_VERSION);
+
+ mClock.advance(1);
+ updateIfNeeded(updateManager);
+ assertFalse(updateManager.updateCheckStarted());
+
+ // A previous update request was made for the current ShellAPK version. A WebAPK update
+ // should be requested after the regular delay.
+ mClock.advance(WebappDataStorage.UPDATE_INTERVAL - 1);
+ updateIfNeeded(updateManager);
+ assertTrue(updateManager.updateCheckStarted());
+ onGotManifestData(updateManager, defaultManifestData());
+ assertTrue(updateManager.updateRequested());
+ }
}
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698