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

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

Issue 2790213004: Don't try to update incessently when Shell APK version is out of date. (Closed)
Patch Set: 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
Index: chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDataStorageTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDataStorageTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDataStorageTest.java
index c0b6fbca4602c40e1e8d57a661554b3da6ff2316..3afa8a6bf4cb0894823256d8e10bb9618dd924a3 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDataStorageTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDataStorageTest.java
@@ -396,6 +396,24 @@ public class WebappDataStorageTest {
assertTrue(storage.shouldCheckForUpdate());
}
+ /**
+ * Tests that if there was no WebAPK update attempt that the should-request-shell-apk-update
+ * returns true; and it returns true again after the retry interval.
+ */
+ @Test
+ public void testShouldRequestShellApkUpdate() {
+ final TestClock clock = new TestClock(System.currentTimeMillis());
+ WebappDataStorage storage = getStorage(clock);
+ assertTrue(storage.shouldRequestShellApkUpdate());
+
+ storage.updateTimeOfLastWebApkUpdateRequestCompletion();
+ clock.advance(1);
+ assertFalse(storage.shouldRequestShellApkUpdate());
+
+ clock.advance(WebappDataStorage.RETRY_SHELL_APK_UPDATE_DURATION - 1);
+ assertTrue(storage.shouldRequestShellApkUpdate());
+ }
+
private WebappDataStorage getStorage(TestClock clock) {
WebappDataStorage.setClockForTests(clock);
WebappDataStorage storage = WebappDataStorage.open("test");

Powered by Google App Engine
This is Rietveld 408576698