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 85650cb5387dcbf774f1f030338b62c0bb84445e..309ee253476c1939ca449f171519e4e6b77e7721 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 |
@@ -20,6 +20,8 @@ import org.chromium.base.test.util.Feature; |
import org.chromium.base.test.util.RetryOnFailure; |
import org.chromium.components.offline_items_collection.ContentId; |
import org.chromium.components.offline_items_collection.LegacyHelpers; |
+import org.chromium.components.offline_items_collection.OfflineItem.Progress; |
+import org.chromium.components.offline_items_collection.OfflineItemProgressUnit; |
import java.util.ArrayList; |
import java.util.HashSet; |
@@ -32,7 +34,6 @@ import java.util.UUID; |
*/ |
public class DownloadNotificationServiceTest extends |
ServiceTestCase<MockDownloadNotificationService> { |
- private static final int MILLIS_PER_SECOND = 1000; |
private static class MockDownloadManagerService extends DownloadManagerService { |
final List<DownloadItem> mDownloads = new ArrayList<DownloadItem>(); |
@@ -296,7 +297,9 @@ public class DownloadNotificationServiceTest extends |
DownloadNotificationService service = bindNotificationService(); |
ContentId id3 = LegacyHelpers.buildLegacyContentId(false, UUID.randomUUID().toString()); |
- service.notifyDownloadProgress(id3, "test", 1, 100L, 1L, 1L, true, true, false, null); |
+ service.notifyDownloadProgress(id3, "test", |
+ new Progress(1, 100L, OfflineItemProgressUnit.PERCENTAGE), 100L, 1L, 1L, true, true, |
+ false, null); |
assertEquals(3, getService().getNotificationIds().size()); |
int lastNotificationId = getService().getLastAddedNotificationId(); |
Set<String> entries = DownloadManagerService.getStoredDownloadInfo( |
@@ -425,48 +428,4 @@ public class DownloadNotificationServiceTest extends |
assertFalse(sharedPrefs.contains( |
DownloadSharedPreferenceHelper.KEY_PENDING_DOWNLOAD_NOTIFICATIONS)); |
} |
- |
- @SmallTest |
- @Feature({"Download"}) |
- public void testFormatRemainingTime() { |
- Context context = getSystemContext().getApplicationContext(); |
- assertEquals("0 secs left", DownloadNotificationService.formatRemainingTime(context, 0)); |
- assertEquals("1 sec left", DownloadNotificationService.formatRemainingTime( |
- context, MILLIS_PER_SECOND)); |
- assertEquals("1 min left", DownloadNotificationService.formatRemainingTime(context, |
- DownloadNotificationService.SECONDS_PER_MINUTE * MILLIS_PER_SECOND)); |
- assertEquals("2 mins left", DownloadNotificationService.formatRemainingTime(context, |
- 149 * MILLIS_PER_SECOND)); |
- assertEquals("3 mins left", DownloadNotificationService.formatRemainingTime(context, |
- 150 * MILLIS_PER_SECOND)); |
- assertEquals("1 hour left", DownloadNotificationService.formatRemainingTime(context, |
- DownloadNotificationService.SECONDS_PER_HOUR * MILLIS_PER_SECOND)); |
- assertEquals("2 hours left", DownloadNotificationService.formatRemainingTime(context, |
- 149 * DownloadNotificationService.SECONDS_PER_MINUTE * MILLIS_PER_SECOND)); |
- assertEquals("3 hours left", DownloadNotificationService.formatRemainingTime(context, |
- 150 * DownloadNotificationService.SECONDS_PER_MINUTE * MILLIS_PER_SECOND)); |
- assertEquals("1 day left", DownloadNotificationService.formatRemainingTime(context, |
- DownloadNotificationService.SECONDS_PER_DAY * MILLIS_PER_SECOND)); |
- assertEquals("2 days left", DownloadNotificationService.formatRemainingTime(context, |
- 59 * DownloadNotificationService.SECONDS_PER_HOUR * MILLIS_PER_SECOND)); |
- assertEquals("3 days left", DownloadNotificationService.formatRemainingTime(context, |
- 60 * DownloadNotificationService.SECONDS_PER_HOUR * MILLIS_PER_SECOND)); |
- } |
- |
- // Tests that the downloaded bytes on the notification is correct. |
- @SmallTest |
- @Feature({"Download"}) |
- public void testFormatBytesReceived() { |
- Context context = getSystemContext().getApplicationContext(); |
- assertEquals("Downloaded 0.0 KB", DownloadUtils.getStringForBytes( |
- context, DownloadUtils.BYTES_DOWNLOADED_STRINGS, 0)); |
- assertEquals("Downloaded 0.5 KB", DownloadUtils.getStringForBytes( |
- context, DownloadUtils.BYTES_DOWNLOADED_STRINGS, 512)); |
- assertEquals("Downloaded 1.0 KB", DownloadUtils.getStringForBytes( |
- context, DownloadUtils.BYTES_DOWNLOADED_STRINGS, 1024)); |
- assertEquals("Downloaded 1.0 MB", DownloadUtils.getStringForBytes( |
- context, DownloadUtils.BYTES_DOWNLOADED_STRINGS, 1024 * 1024)); |
- assertEquals("Downloaded 1.0 GB", DownloadUtils.getStringForBytes( |
- context, DownloadUtils.BYTES_DOWNLOADED_STRINGS, 1024 * 1024 * 1024)); |
- } |
} |