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

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

Issue 2151063002: refactor DownloadManagerService to eliminate variable access on 2 different threads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename testcases 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/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698