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

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

Issue 1872983002: Remove the first launch from home screen requirement for notification deep linking. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@deep-link-actual
Patch Set: Created 4 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 a1baa2b4e239755c1a85c78277611fedd2fe4cda..92e6bf64422c4dd5d4f5eae29f6360bf84cea420 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
@@ -188,24 +188,24 @@ public class WebappDataStorageTest {
final TestClock clock = new TestClock(System.currentTimeMillis());
WebappDataStorage.setClockForTests(clock);
+ // Opening a data storage doesn't count as a launch.
WebappDataStorage storage = WebappDataStorage.open(Robolectric.application, "test");
- storage.updateLastUsedTime();
BackgroundShadowAsyncTask.runBackgroundTasks();
Robolectric.runUiThreadTasks();
assertTrue(!storage.wasLaunchedRecently());
+ // When the last used time is updated, then it is a launch.
+ storage.updateLastUsedTime();
+ BackgroundShadowAsyncTask.runBackgroundTasks();
+ Robolectric.runUiThreadTasks();
+ assertTrue(storage.wasLaunchedRecently());
+
long lastUsedTime = mSharedPreferences.getLong(WebappDataStorage.KEY_LAST_USED,
WebappDataStorage.LAST_USED_INVALID);
assertTrue(lastUsedTime != WebappDataStorage.LAST_USED_UNSET);
assertTrue(lastUsedTime != WebappDataStorage.LAST_USED_INVALID);
- // Mark as launched, check launched recently.
- mSharedPreferences.edit()
- .putBoolean(WebappDataStorage.KEY_LAUNCHED, true)
- .commit();
- assertTrue(storage.wasLaunchedRecently());
-
// Move the last used time one day in the past.
mSharedPreferences.edit()
.putLong(WebappDataStorage.KEY_LAST_USED, lastUsedTime - TimeUnit.DAYS.toMillis(1L))
@@ -229,18 +229,6 @@ public class WebappDataStorageTest {
lastUsedTime - TimeUnit.DAYS.toMillis(10L) + 1).commit();
assertTrue(storage.wasLaunchedRecently());
- // Mark as not launched.
- mSharedPreferences.edit()
- .putBoolean(WebappDataStorage.KEY_LAUNCHED, false)
- .commit();
- assertTrue(!storage.wasLaunchedRecently());
-
- // Mark as launched.
- mSharedPreferences.edit()
- .putBoolean(WebappDataStorage.KEY_LAUNCHED, true)
- .commit();
- assertTrue(storage.wasLaunchedRecently());
-
// Move the last used time to exactly ten days in the past.
mSharedPreferences.edit().putLong(WebappDataStorage.KEY_LAST_USED,
lastUsedTime - TimeUnit.DAYS.toMillis(10L)).commit();

Powered by Google App Engine
This is Rietveld 408576698