Commit 51914f8f by olly Committed by Oliver Woodman

Rename DownloadThread to Task

This resolves some naming confusion that previously existed
as a result of DownloadThread also being used for removals.
Some related variables (e.g. activeDownloadCount) would refer
to both download and removal tasks, whilst others
(e.g. maxParallelDownloads) would refer only to downloads.
This change renames those that refer to both to use "task"
terminology.

This change also includes minor test edits.

PiperOrigin-RevId: 245913671
parent 44ad4774
......@@ -40,7 +40,7 @@ import java.util.List;
@Nullable private String cacheKey;
private byte[] customMetadata;
private int state;
@Download.State private int state;
private long startTimeMs;
private long updateTimeMs;
private long contentLength;
......@@ -111,7 +111,7 @@ import java.util.List;
return this;
}
public DownloadBuilder setState(int state) {
public DownloadBuilder setState(@Download.State int state) {
this.state = state;
return this;
}
......
......@@ -359,7 +359,7 @@ public class DownloadManagerTest {
}
@Test
public void stopAndResume() throws Throwable {
public void pauseAndResume() throws Throwable {
DownloadRunner runner1 = new DownloadRunner(uri1);
DownloadRunner runner2 = new DownloadRunner(uri2);
DownloadRunner runner3 = new DownloadRunner(uri3);
......@@ -370,10 +370,12 @@ public class DownloadManagerTest {
runOnMainThread(() -> downloadManager.pauseDownloads());
// TODO: This should be assertQueued. Fix implementation and update test.
runner1.getTask().assertStopped();
// remove requests aren't stopped.
runner2.getDownloader(1).unblock().assertReleased();
// TODO: This should be assertQueued. Fix implementation and update test.
runner2.getTask().assertStopped();
// Although remove2 is finished, download2 doesn't start.
runner2.getDownloader(2).assertDoesNotStart();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment