| 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 1dc41650cdf4c6bdc9db1489048ae335068914a1..f52d40af00cb96686d3de00acd062cdfd5589b63 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
|
| @@ -17,7 +17,6 @@ import org.junit.After;
|
| import org.junit.Before;
|
| import org.junit.Test;
|
| import org.junit.runner.RunWith;
|
| -
|
| import org.robolectric.RuntimeEnvironment;
|
| import org.robolectric.annotation.Config;
|
| import org.robolectric.shadows.ShadowLooper;
|
| @@ -127,8 +126,8 @@ public class WebappRegistryTest {
|
| long after = System.currentTimeMillis();
|
| SharedPreferences webAppPrefs = ContextUtils.getApplicationContext().getSharedPreferences(
|
| WebappDataStorage.SHARED_PREFS_FILE_PREFIX + "test", Context.MODE_PRIVATE);
|
| - long actual = webAppPrefs.getLong(WebappDataStorage.KEY_LAST_USED,
|
| - WebappDataStorage.LAST_USED_INVALID);
|
| + long actual = webAppPrefs.getLong(
|
| + WebappDataStorage.KEY_LAST_USED, WebappDataStorage.TIMESTAMP_INVALID);
|
| assertTrue("Timestamp is out of range", actual <= after);
|
| }
|
|
|
| @@ -247,8 +246,8 @@ public class WebappRegistryTest {
|
| Set<String> actual = getRegisteredWebapps();
|
| assertEquals(new HashSet<>(Arrays.asList("oldWebapp")), actual);
|
|
|
| - long actualLastUsed = webAppPrefs.getLong(WebappDataStorage.KEY_LAST_USED,
|
| - WebappDataStorage.LAST_USED_INVALID);
|
| + long actualLastUsed = webAppPrefs.getLong(
|
| + WebappDataStorage.KEY_LAST_USED, WebappDataStorage.TIMESTAMP_INVALID);
|
| assertEquals(Long.MIN_VALUE, actualLastUsed);
|
|
|
| // The last cleanup time was set to 0 in setUp() so check that this hasn't changed.
|
| @@ -280,8 +279,8 @@ public class WebappRegistryTest {
|
| Set<String> actual = getRegisteredWebapps();
|
| assertEquals(new HashSet<>(Arrays.asList("recentWebapp")), actual);
|
|
|
| - long actualLastUsed = webAppPrefs.getLong(WebappDataStorage.KEY_LAST_USED,
|
| - WebappDataStorage.LAST_USED_INVALID);
|
| + long actualLastUsed = webAppPrefs.getLong(
|
| + WebappDataStorage.KEY_LAST_USED, WebappDataStorage.TIMESTAMP_INVALID);
|
| assertEquals(lastUsed, actualLastUsed);
|
|
|
| long lastCleanup = mSharedPreferences.getLong(WebappRegistry.KEY_LAST_CLEANUP, -1);
|
| @@ -311,9 +310,9 @@ public class WebappRegistryTest {
|
| Set<String> actual = getRegisteredWebapps();
|
| assertTrue(actual.isEmpty());
|
|
|
| - long actualLastUsed = webAppPrefs.getLong(WebappDataStorage.KEY_LAST_USED,
|
| - WebappDataStorage.LAST_USED_INVALID);
|
| - assertEquals(WebappDataStorage.LAST_USED_INVALID, actualLastUsed);
|
| + long actualLastUsed = webAppPrefs.getLong(
|
| + WebappDataStorage.KEY_LAST_USED, WebappDataStorage.TIMESTAMP_INVALID);
|
| + assertEquals(WebappDataStorage.TIMESTAMP_INVALID, actualLastUsed);
|
|
|
| long lastCleanup = mSharedPreferences.getLong(WebappRegistry.KEY_LAST_CLEANUP, -1);
|
| assertEquals(currentTime, lastCleanup);
|
| @@ -421,11 +420,11 @@ public class WebappRegistryTest {
|
| WebappDataStorage.SHARED_PREFS_FILE_PREFIX + "webapp2", Context.MODE_PRIVATE);
|
|
|
| long webapp1OriginalLastUsed = webapp2Prefs.getLong(
|
| - WebappDataStorage.KEY_LAST_USED, WebappDataStorage.LAST_USED_UNSET);
|
| + WebappDataStorage.KEY_LAST_USED, WebappDataStorage.TIMESTAMP_INVALID);
|
| long webapp2OriginalLastUsed = webapp2Prefs.getLong(
|
| - WebappDataStorage.KEY_LAST_USED, WebappDataStorage.LAST_USED_UNSET);
|
| - assertTrue(webapp1OriginalLastUsed != WebappDataStorage.LAST_USED_UNSET);
|
| - assertTrue(webapp2OriginalLastUsed != WebappDataStorage.LAST_USED_UNSET);
|
| + WebappDataStorage.KEY_LAST_USED, WebappDataStorage.TIMESTAMP_INVALID);
|
| + assertTrue(webapp1OriginalLastUsed != WebappDataStorage.TIMESTAMP_INVALID);
|
| + assertTrue(webapp2OriginalLastUsed != WebappDataStorage.TIMESTAMP_INVALID);
|
|
|
| // Clear data for |webapp1Url|.
|
| WebappRegistry.getInstance().clearWebappHistoryForUrlsImpl(
|
| @@ -437,12 +436,12 @@ public class WebappRegistryTest {
|
| assertTrue(actual.contains("webapp2"));
|
|
|
| // Verify that the last used time for the first web app is
|
| - // WebappDataStorage.LAST_USED_UNSET, while for the second one it's unchanged.
|
| + // WebappDataStorage.TIMESTAMP_INVALID, while for the second one it's unchanged.
|
| long actualLastUsed = webapp1Prefs.getLong(
|
| - WebappDataStorage.KEY_LAST_USED, WebappDataStorage.LAST_USED_UNSET);
|
| - assertEquals(WebappDataStorage.LAST_USED_UNSET, actualLastUsed);
|
| + WebappDataStorage.KEY_LAST_USED, WebappDataStorage.TIMESTAMP_INVALID);
|
| + assertEquals(WebappDataStorage.TIMESTAMP_INVALID, actualLastUsed);
|
| actualLastUsed = webapp2Prefs.getLong(
|
| - WebappDataStorage.KEY_LAST_USED, WebappDataStorage.LAST_USED_UNSET);
|
| + WebappDataStorage.KEY_LAST_USED, WebappDataStorage.TIMESTAMP_INVALID);
|
| assertEquals(webapp2OriginalLastUsed, actualLastUsed);
|
|
|
| // Verify that the URL and scope for the first web app is WebappDataStorage.URL_INVALID,
|
| @@ -463,13 +462,13 @@ public class WebappRegistryTest {
|
| // Clear data for all urls.
|
| WebappRegistry.getInstance().clearWebappHistoryForUrlsImpl(new UrlFilters.AllUrls());
|
|
|
| - // Verify that the last used time for both web apps is WebappDataStorage.LAST_USED_UNSET.
|
| + // Verify that the last used time for both web apps is WebappDataStorage.TIMESTAMP_INVALID.
|
| actualLastUsed = webapp1Prefs.getLong(
|
| - WebappDataStorage.KEY_LAST_USED, WebappDataStorage.LAST_USED_UNSET);
|
| - assertEquals(WebappDataStorage.LAST_USED_UNSET, actualLastUsed);
|
| + WebappDataStorage.KEY_LAST_USED, WebappDataStorage.TIMESTAMP_INVALID);
|
| + assertEquals(WebappDataStorage.TIMESTAMP_INVALID, actualLastUsed);
|
| actualLastUsed = webapp2Prefs.getLong(
|
| - WebappDataStorage.KEY_LAST_USED, WebappDataStorage.LAST_USED_UNSET);
|
| - assertEquals(WebappDataStorage.LAST_USED_UNSET, actualLastUsed);
|
| + WebappDataStorage.KEY_LAST_USED, WebappDataStorage.TIMESTAMP_INVALID);
|
| + assertEquals(WebappDataStorage.TIMESTAMP_INVALID, actualLastUsed);
|
|
|
| // Verify that the URL and scope for both web apps is WebappDataStorage.URL_INVALID.
|
| actualScope = webapp1Prefs.getString(
|
| @@ -500,9 +499,8 @@ public class WebappRegistryTest {
|
|
|
| // Verify that the last used time is valid.
|
| long actualLastUsed = webappPrefs.getLong(
|
| - WebappDataStorage.KEY_LAST_USED, WebappDataStorage.LAST_USED_INVALID);
|
| - assertTrue(WebappDataStorage.LAST_USED_INVALID != actualLastUsed);
|
| - assertTrue(WebappDataStorage.LAST_USED_UNSET != actualLastUsed);
|
| + WebappDataStorage.KEY_LAST_USED, WebappDataStorage.TIMESTAMP_INVALID);
|
| + assertTrue(WebappDataStorage.TIMESTAMP_INVALID != actualLastUsed);
|
| }
|
|
|
| @Test
|
|
|