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 6cfc8f4a7e177f798de10627a3ca106856d5d93b..d617ee0cf462a18ce69709c8f071eadef2d68107 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 |
@@ -49,6 +49,7 @@ public class WebappDataStorageTest { |
assertEquals("webapp_", WebappDataStorage.SHARED_PREFS_FILE_PREFIX); |
assertEquals("splash_icon", WebappDataStorage.KEY_SPLASH_ICON); |
assertEquals("last_used", WebappDataStorage.KEY_LAST_USED); |
+ assertEquals("origin_url", WebappDataStorage.KEY_ORIGIN_URL); |
} |
@Test |
@@ -143,4 +144,38 @@ public class WebappDataStorageTest { |
private static Bitmap createBitmap() { |
return Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_4444); |
} |
-} |
+ |
+ @Test |
+ @Feature({"Webapp"}) |
+ public void testOriginUrlRetrieval() throws Exception { |
+ final String origin = "http://drive.google.com"; |
+ mSharedPreferences.edit() |
+ .putString(WebappDataStorage.KEY_ORIGIN_URL, origin) |
+ .commit(); |
+ |
+ WebappDataStorage.getOriginUrl(Robolectric.application, "test", |
gone
2016/03/08 23:03:52
Maybe it'd make sense to create and declare the Fe
dominickn
2016/03/09 08:18:32
Done.
|
+ new WebappDataStorage.FetchCallback<String>() { |
+ @Override |
+ public void onDataRetrieved(String readObject) { |
+ mCallbackCalled = true; |
+ assertEquals(origin, readObject); |
+ } |
+ }); |
+ BackgroundShadowAsyncTask.runBackgroundTasks(); |
+ Robolectric.runUiThreadTasks(); |
+ |
+ assertTrue(mCallbackCalled); |
+ } |
+ |
+ @Test |
+ @Feature({"Webapp"}) |
+ public void testOriginUrlUpdate() throws Exception { |
+ final String origin = "http://maps.google.com"; |
+ |
+ WebappDataStorage.updateOriginUrl(Robolectric.application, "test", origin); |
+ BackgroundShadowAsyncTask.runBackgroundTasks(); |
+ Robolectric.runUiThreadTasks(); |
+ |
+ assertEquals(origin, mSharedPreferences.getString(WebappDataStorage.KEY_ORIGIN_URL, null)); |
+ } |
+} |