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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadNotificationServiceTest.java

Issue 2625493004: Move DownloadSharedPreferenceEntry handling into another class (Closed)
Patch Set: fixing thread check in tests Created 3 years, 11 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/javatests/src/org/chromium/chrome/browser/download/DownloadNotificationServiceTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadNotificationServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadNotificationServiceTest.java
index 6f8fe64371cf8e996d538185a0c70881de8815b1..727868d8823664018bae92d80a3ad2aa110b888f 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadNotificationServiceTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadNotificationServiceTest.java
@@ -80,7 +80,7 @@ public class DownloadNotificationServiceTest extends
super.setupService();
SharedPreferences sharedPrefs = ContextUtils.getAppSharedPreferences();
SharedPreferences.Editor editor = sharedPrefs.edit();
- editor.remove(DownloadNotificationService.KEY_PENDING_DOWNLOAD_NOTIFICATIONS);
+ editor.remove(DownloadSharedPreferenceHelper.KEY_PENDING_DOWNLOAD_NOTIFICATIONS);
editor.apply();
super.tearDown();
}
@@ -148,7 +148,7 @@ public class DownloadNotificationServiceTest extends
SharedPreferences sharedPrefs = ContextUtils.getAppSharedPreferences();
SharedPreferences.Editor editor = sharedPrefs.edit();
editor.putStringSet(
- DownloadNotificationService.KEY_PENDING_DOWNLOAD_NOTIFICATIONS, notifications);
+ DownloadSharedPreferenceHelper.KEY_PENDING_DOWNLOAD_NOTIFICATIONS, notifications);
editor.apply();
startNotificationService();
assertTrue(scheduler.mScheduled);
@@ -195,7 +195,7 @@ public class DownloadNotificationServiceTest extends
SharedPreferences sharedPrefs = ContextUtils.getAppSharedPreferences();
SharedPreferences.Editor editor = sharedPrefs.edit();
editor.putStringSet(
- DownloadNotificationService.KEY_PENDING_DOWNLOAD_NOTIFICATIONS, notifications);
+ DownloadSharedPreferenceHelper.KEY_PENDING_DOWNLOAD_NOTIFICATIONS, notifications);
editor.apply();
startNotificationService();
assertFalse(scheduler.mScheduled);
@@ -223,7 +223,7 @@ public class DownloadNotificationServiceTest extends
ContextUtils.getAppSharedPreferences();
SharedPreferences.Editor editor = sharedPrefs.edit();
editor.putStringSet(
- DownloadNotificationService.KEY_PENDING_DOWNLOAD_NOTIFICATIONS, notifications);
+ DownloadSharedPreferenceHelper.KEY_PENDING_DOWNLOAD_NOTIFICATIONS, notifications);
editor.apply();
startNotificationService();
assertTrue(getService().isPaused());
@@ -231,7 +231,7 @@ public class DownloadNotificationServiceTest extends
assertTrue(getService().getNotificationIds().contains(1));
assertTrue(getService().getNotificationIds().contains(2));
assertTrue(sharedPrefs.contains(
- DownloadNotificationService.KEY_PENDING_DOWNLOAD_NOTIFICATIONS));
+ DownloadSharedPreferenceHelper.KEY_PENDING_DOWNLOAD_NOTIFICATIONS));
}
/**
@@ -255,7 +255,7 @@ public class DownloadNotificationServiceTest extends
SharedPreferences sharedPrefs = ContextUtils.getAppSharedPreferences();
SharedPreferences.Editor editor = sharedPrefs.edit();
editor.putStringSet(
- DownloadNotificationService.KEY_PENDING_DOWNLOAD_NOTIFICATIONS, notifications);
+ DownloadSharedPreferenceHelper.KEY_PENDING_DOWNLOAD_NOTIFICATIONS, notifications);
editor.apply();
startNotificationService();
assertEquals(2, getService().getNotificationIds().size());
@@ -268,17 +268,17 @@ public class DownloadNotificationServiceTest extends
assertEquals(3, getService().getNotificationIds().size());
int lastNotificationId = getService().getLastAddedNotificationId();
Set<String> entries = DownloadManagerService.getStoredDownloadInfo(
- sharedPrefs, DownloadNotificationService.KEY_PENDING_DOWNLOAD_NOTIFICATIONS);
+ sharedPrefs, DownloadSharedPreferenceHelper.KEY_PENDING_DOWNLOAD_NOTIFICATIONS);
assertEquals(3, entries.size());
service.notifyDownloadSuccessful(guid1, "/path/to/success", "success", 100L, false, false);
entries = DownloadManagerService.getStoredDownloadInfo(
- sharedPrefs, DownloadNotificationService.KEY_PENDING_DOWNLOAD_NOTIFICATIONS);
+ sharedPrefs, DownloadSharedPreferenceHelper.KEY_PENDING_DOWNLOAD_NOTIFICATIONS);
assertEquals(2, entries.size());
service.notifyDownloadFailed(guid2, "failed");
entries = DownloadManagerService.getStoredDownloadInfo(
- sharedPrefs, DownloadNotificationService.KEY_PENDING_DOWNLOAD_NOTIFICATIONS);
+ sharedPrefs, DownloadSharedPreferenceHelper.KEY_PENDING_DOWNLOAD_NOTIFICATIONS);
assertEquals(1, entries.size());
service.notifyDownloadCanceled(guid3);
@@ -326,7 +326,7 @@ public class DownloadNotificationServiceTest extends
SharedPreferences sharedPrefs = ContextUtils.getAppSharedPreferences();
SharedPreferences.Editor editor = sharedPrefs.edit();
editor.putStringSet(
- DownloadNotificationService.KEY_PENDING_DOWNLOAD_NOTIFICATIONS, notifications);
+ DownloadSharedPreferenceHelper.KEY_PENDING_DOWNLOAD_NOTIFICATIONS, notifications);
editor.apply();
startNotificationService();
DownloadNotificationService service = bindNotificationService();
@@ -370,12 +370,12 @@ public class DownloadNotificationServiceTest extends
ContextUtils.getAppSharedPreferences();
SharedPreferences.Editor editor = sharedPrefs.edit();
editor.putStringSet(
- DownloadNotificationService.KEY_PENDING_DOWNLOAD_NOTIFICATIONS, notifications);
+ DownloadSharedPreferenceHelper.KEY_PENDING_DOWNLOAD_NOTIFICATIONS, notifications);
editor.apply();
startNotificationService();
assertTrue(getService().isPaused());
assertFalse(sharedPrefs.contains(
- DownloadNotificationService.KEY_PENDING_DOWNLOAD_NOTIFICATIONS));
+ DownloadSharedPreferenceHelper.KEY_PENDING_DOWNLOAD_NOTIFICATIONS));
}
@SmallTest

Powered by Google App Engine
This is Rietveld 408576698