Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3c010775
authored
Dec 21, 2018
by
eguven
Committed by
Oliver Woodman
Jan 08, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add STOPPED state to DownloadManager
PiperOrigin-RevId: 226460891
parent
173f3689
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadManager.java
library/core/src/test/java/com/google/android/exoplayer2/offline/DownloadManagerTest.java
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadManager.java
View file @
3c010775
This diff is collapsed.
Click to expand it.
library/core/src/test/java/com/google/android/exoplayer2/offline/DownloadManagerTest.java
View file @
3c010775
...
...
@@ -41,6 +41,7 @@ import org.mockito.MockitoAnnotations;
import
org.robolectric.RobolectricTestRunner
;
import
org.robolectric.RuntimeEnvironment
;
import
org.robolectric.annotation.Config
;
import
org.robolectric.shadows.ShadowLog
;
/** Tests {@link DownloadManager}. */
@RunWith
(
RobolectricTestRunner
.
class
)
...
...
@@ -69,6 +70,7 @@ public class DownloadManagerTest {
@Before
public
void
setUp
()
throws
Exception
{
ShadowLog
.
stream
=
System
.
out
;
MockitoAnnotations
.
initMocks
(
this
);
uri1
=
Uri
.
parse
(
"http://abc.com/media1"
);
uri2
=
Uri
.
parse
(
"http://abc.com/media2"
);
...
...
@@ -314,6 +316,7 @@ public class DownloadManagerTest {
downloader1
.
assertStarted
();
downloader2
.
assertDoesNotStart
();
runner2
.
getTask
().
assertQueued
();
downloader1
.
unblock
();
downloader2
.
assertStarted
();
downloader2
.
unblock
();
...
...
@@ -390,11 +393,11 @@ public class DownloadManagerTest {
runOnMainThread
(()
->
downloadManager
.
stopDownloads
());
runner1
.
getTask
().
assert
Queu
ed
();
runner1
.
getTask
().
assert
Stopp
ed
();
// remove actions aren't stopped.
runner2
.
getDownloader
(
0
).
unblock
().
assertReleased
();
runner2
.
getTask
().
assert
Queu
ed
();
runner2
.
getTask
().
assert
Stopp
ed
();
// Although remove2 is finished, download2 doesn't start.
runner2
.
getDownloader
(
1
).
assertDoesNotStart
();
...
...
@@ -534,6 +537,10 @@ public class DownloadManagerTest {
return
assertState
(
DownloadState
.
STATE_QUEUED
);
}
private
TaskWrapper
assertStopped
()
{
return
assertState
(
DownloadState
.
STATE_STOPPED
);
}
private
TaskWrapper
assertState
(
@State
int
expectedState
)
{
while
(
true
)
{
Integer
state
=
null
;
...
...
@@ -542,6 +549,7 @@ public class DownloadManagerTest {
}
catch
(
InterruptedException
e
)
{
fail
(
e
.
getMessage
());
}
assertThat
(
state
).
isNotNull
();
if
(
expectedState
==
state
)
{
return
this
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment