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

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

Issue 2071213005: Use metadata when launching WebAPKs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add WebAPK's metadata in WebappDataStorage. Created 4 years, 6 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/WebappRegistryTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappRegistryTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappRegistryTest.java
index 66f47e34cc3d94f3072e321ba40e986cb35eb3e3..671dc1758b752f55fe940a5e6e87396b7288b230 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappRegistryTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappRegistryTest.java
@@ -351,6 +351,28 @@ public class WebappRegistryTest {
}
@Test
+ @Feature({"WebApk"})
+ public void testCleanupRemovesUninstalledWebApks() throws Exception {
+ // Put the current time such that the task runs.
+ long currentTime = INITIAL_TIME + WebappRegistry.FULL_CLEANUP_DURATION;
+
+ String webappId = "webapk:uninstalledWebApk";
+ addWebappsToRegistry(webappId);
+
+ // Because the time is just inside the window, there should be a cleanup of uninstalled
+ // WebAPKs and the last cleaned up time should be set to the current time.
+ WebappRegistry.unregisterOldWebapps(Robolectric.application, currentTime);
+ BackgroundShadowAsyncTask.runBackgroundTasks();
+
+ Set<String> actual = mSharedPreferences.getStringSet(
+ WebappRegistry.KEY_WEBAPP_SET, Collections.<String>emptySet());
+ assertTrue(actual.isEmpty());
+
+ long lastCleanup = mSharedPreferences.getLong(WebappRegistry.KEY_LAST_CLEANUP, -1);
+ assertEquals(currentTime, lastCleanup);
+ }
+
+ @Test
@Feature({"Webapp"})
public void testClearWebappHistoryRunsCallback() throws Exception {
CallbackRunner callback = new CallbackRunner();

Powered by Google App Engine
This is Rietveld 408576698