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

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

Issue 2124583003: Replace Shared Prefs commit with apply. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix merge conflict. Created 4 years, 5 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
« no previous file with comments | « chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDataStorageTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 145742bd49ff8f4ae4f48370bc2323b66cf25f82..c88085195d8a1fd6a650483ed92650b1265f3367 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
@@ -245,9 +245,7 @@ public class WebappRegistryTest {
addWebappsToRegistry("test");
SharedPreferences webAppPrefs = Robolectric.application.getSharedPreferences(
WebappDataStorage.SHARED_PREFS_FILE_PREFIX + "test", Context.MODE_PRIVATE);
- webAppPrefs.edit()
- .putLong(WebappDataStorage.KEY_LAST_USED, 100L)
- .commit();
+ webAppPrefs.edit().putLong(WebappDataStorage.KEY_LAST_USED, 100L).apply();
WebappRegistry.unregisterAllWebapps(Robolectric.application, null);
BackgroundShadowAsyncTask.runBackgroundTasks();
@@ -265,9 +263,7 @@ public class WebappRegistryTest {
addWebappsToRegistry("oldWebapp");
SharedPreferences webAppPrefs = Robolectric.application.getSharedPreferences(
WebappDataStorage.SHARED_PREFS_FILE_PREFIX + "oldWebapp", Context.MODE_PRIVATE);
- webAppPrefs.edit()
- .putLong(WebappDataStorage.KEY_LAST_USED, Long.MIN_VALUE)
- .commit();
+ webAppPrefs.edit().putLong(WebappDataStorage.KEY_LAST_USED, Long.MIN_VALUE).apply();
WebappRegistry.unregisterOldWebapps(Robolectric.application, currentTime);
BackgroundShadowAsyncTask.runBackgroundTasks();
@@ -296,9 +292,7 @@ public class WebappRegistryTest {
SharedPreferences webAppPrefs = Robolectric.application.getSharedPreferences(
WebappDataStorage.SHARED_PREFS_FILE_PREFIX + "recentWebapp", Context.MODE_PRIVATE);
long lastUsed = currentTime - WebappRegistry.WEBAPP_UNOPENED_CLEANUP_DURATION + 1;
- webAppPrefs.edit()
- .putLong(WebappDataStorage.KEY_LAST_USED, lastUsed)
- .commit();
+ webAppPrefs.edit().putLong(WebappDataStorage.KEY_LAST_USED, lastUsed).apply();
// Because the time is just inside the window, there should be a cleanup but the web app
// should not be deleted as it was used recently. The last cleanup time should also be
@@ -329,9 +323,7 @@ public class WebappRegistryTest {
SharedPreferences webAppPrefs = Robolectric.application.getSharedPreferences(
WebappDataStorage.SHARED_PREFS_FILE_PREFIX + "oldWebapp", Context.MODE_PRIVATE);
long lastUsed = currentTime - WebappRegistry.WEBAPP_UNOPENED_CLEANUP_DURATION;
- webAppPrefs.edit()
- .putLong(WebappDataStorage.KEY_LAST_USED, lastUsed)
- .commit();
+ webAppPrefs.edit().putLong(WebappDataStorage.KEY_LAST_USED, lastUsed).apply();
// Because the time is just inside the window, there should be a cleanup of old web apps and
// the last cleaned up time should be set to the current time.
@@ -688,9 +680,7 @@ public class WebappRegistryTest {
private Set<String> addWebappsToRegistry(String... webapps) {
final Set<String> expected = new HashSet<String>(Arrays.asList(webapps));
- mSharedPreferences.edit()
- .putStringSet(WebappRegistry.KEY_WEBAPP_SET, expected)
- .commit();
+ mSharedPreferences.edit().putStringSet(WebappRegistry.KEY_WEBAPP_SET, expected).apply();
return expected;
}
« no previous file with comments | « chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDataStorageTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698