Chromium Code Reviews| 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 a903f58a38c2e9711b946acb5515f98888d52061..3576dcc6bc6a191e8cdfd3a4a78412e8d664095e 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 |
| @@ -21,6 +21,7 @@ import org.robolectric.annotation.Config; |
| import java.util.Collections; |
| import java.util.HashSet; |
| +import java.util.Map; |
| import java.util.Set; |
| /** |
| @@ -149,4 +150,41 @@ public class WebappRegistryTest { |
| assertTrue(mCallbackCalled); |
| } |
| + |
| + @Test |
| + @Feature({"Webapp"}) |
| + public void testUnregisterClearsRegistry() throws Exception { |
| + WebappRegistry.registerWebapp(Robolectric.application, "test"); |
| + BackgroundShadowAsyncTask.runBackgroundTasks(); |
| + |
|
gone
2015/09/08 20:38:13
check if you actually succeeded in registering her
Lalit Maganti
2015/09/09 15:27:46
Changed test to explictly add to registry in test
|
| + WebappRegistry.unregisterAllWebapps(Robolectric.application); |
| + BackgroundShadowAsyncTask.runBackgroundTasks(); |
| + |
| + WebappRegistry.getRegisteredWebappIds(Robolectric.application, |
| + new WebappRegistry.FetchCallback() { |
| + @Override |
| + public void onWebappIdsRetrieved(Set<String> actual) { |
| + mCallbackCalled = true; |
| + assertTrue(actual.isEmpty()); |
| + } |
| + }); |
| + BackgroundShadowAsyncTask.runBackgroundTasks(); |
| + Robolectric.runUiThreadTasks(); |
| + assertTrue(mCallbackCalled); |
| + } |
| + |
| + @Test |
| + @Feature({"Webapp"}) |
| + public void testUnregisterClearsWebappDataStorage() throws Exception { |
| + WebappRegistry.registerWebapp(Robolectric.application, "test"); |
| + BackgroundShadowAsyncTask.runBackgroundTasks(); |
| + |
|
gone
2015/09/08 20:38:13
same as above.
Lalit Maganti
2015/09/09 15:27:46
Ditto.
|
| + WebappRegistry.unregisterAllWebapps(Robolectric.application); |
| + BackgroundShadowAsyncTask.runBackgroundTasks(); |
| + |
| + SharedPreferences webAppPrefs = Robolectric.application.getSharedPreferences( |
| + WebappDataStorage.SHARED_PREFS_FILE_PREFIX + "test", Context.MODE_PRIVATE); |
| + Map<String, ?> actual = webAppPrefs.getAll(); |
| + assertTrue(actual.isEmpty()); |
| + } |
| } |