Index: chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadManagerServiceTest.java |
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadManagerServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadManagerServiceTest.java |
index f03d4b61c2c7075c0e9861eaf6f91e5c36190bf3..3d4fe904887f2b9626a7bf8ee45a3d4b04385362 100644 |
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadManagerServiceTest.java |
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadManagerServiceTest.java |
@@ -331,7 +331,7 @@ public class DownloadManagerServiceTest extends InstrumentationTestCase { |
@MediumTest |
@Feature({"Download"}) |
- public void testDownloadProgressIsCalled() throws InterruptedException { |
+ public void testAllDownloadProgressIsCalledForSlowUpdates() throws InterruptedException { |
MockDownloadNotifier notifier = new MockDownloadNotifier(getTestContext()); |
DownloadManagerServiceForTest dService = new DownloadManagerServiceForTest( |
getTestContext(), notifier, UPDATE_DELAY_FOR_TEST); |
@@ -362,7 +362,7 @@ public class DownloadManagerServiceTest extends InstrumentationTestCase { |
@MediumTest |
@Feature({"Download"}) |
- public void testOnlyOneProgressForFastUpdates() throws InterruptedException { |
+ public void testOnlyTwoProgressForFastUpdates() throws InterruptedException { |
MockDownloadNotifier notifier = new MockDownloadNotifier(getTestContext()); |
DownloadManagerServiceForTest dService = new DownloadManagerServiceForTest( |
getTestContext(), notifier, LONG_UPDATE_DELAY_FOR_TEST); |
@@ -370,12 +370,14 @@ public class DownloadManagerServiceTest extends InstrumentationTestCase { |
DownloadInfo update1 = Builder.fromDownloadInfo(downloadInfo) |
.setPercentCompleted(10).build(); |
DownloadInfo update2 = Builder.fromDownloadInfo(downloadInfo) |
- .setPercentCompleted(30).build(); |
+ .setPercentCompleted(20).build(); |
DownloadInfo update3 = Builder.fromDownloadInfo(downloadInfo) |
.setPercentCompleted(30).build(); |
- // Should only get one update call, the last update. |
- notifier.expect(MethodID.DOWNLOAD_PROGRESS, update3); |
+ // Should get 2 update calls, the first and the last. The 2nd update will be merged into |
+ // the last one. |
+ notifier.expect(MethodID.DOWNLOAD_PROGRESS, update1) |
+ .andThen(MethodID.DOWNLOAD_PROGRESS, update3); |
dService.onDownloadUpdated(update1); |
Thread.sleep(DELAY_BETWEEN_CALLS); |
dService.onDownloadUpdated(update2); |