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
01b9ae63
authored
Jan 11, 2021
by
olly
Committed by
Ian Baker
Jan 11, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
DownloadManagerTest: Address remaining flakiness
#minor-release PiperOrigin-RevId: 351158541
parent
09c49f3c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
14 deletions
library/core/src/test/java/com/google/android/exoplayer2/offline/DownloadManagerTest.java
library/core/src/test/java/com/google/android/exoplayer2/offline/DownloadManagerTest.java
View file @
01b9ae63
...
@@ -25,7 +25,6 @@ import androidx.annotation.Nullable;
...
@@ -25,7 +25,6 @@ import androidx.annotation.Nullable;
import
androidx.test.core.app.ApplicationProvider
;
import
androidx.test.core.app.ApplicationProvider
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.offline.DownloadManager.Listener
;
import
com.google.android.exoplayer2.robolectric.TestDownloadManagerListener
;
import
com.google.android.exoplayer2.robolectric.TestDownloadManagerListener
;
import
com.google.android.exoplayer2.scheduler.Requirements
;
import
com.google.android.exoplayer2.scheduler.Requirements
;
import
com.google.android.exoplayer2.testutil.DownloadBuilder
;
import
com.google.android.exoplayer2.testutil.DownloadBuilder
;
...
@@ -600,6 +599,7 @@ public class DownloadManagerTest {
...
@@ -600,6 +599,7 @@ public class DownloadManagerTest {
FakeDownloader
downloader
=
getDownloaderAt
(
1
);
FakeDownloader
downloader
=
getDownloaderAt
(
1
);
downloader
.
finish
();
downloader
.
finish
();
assertCompleted
(
ID1
);
assertDownloadIndexSize
(
1
);
assertDownloadIndexSize
(
1
);
// We expect one downloader for the removal, and one for when the download was re-added.
// We expect one downloader for the removal, and one for when the download was re-added.
...
@@ -617,28 +617,18 @@ public class DownloadManagerTest {
...
@@ -617,28 +617,18 @@ public class DownloadManagerTest {
public
void
addDownloadWithStopReason_whilstRemoving_addsStoppedDownload
()
throws
Throwable
{
public
void
addDownloadWithStopReason_whilstRemoving_addsStoppedDownload
()
throws
Throwable
{
postDownloadRequest
(
ID1
);
postDownloadRequest
(
ID1
);
getDownloaderAt
(
0
).
finish
();
getDownloaderAt
(
0
).
finish
();
assertCompleted
(
ID1
);
postRemoveRequest
(
ID1
);
postRemoveRequest
(
ID1
);
FakeDownloader
downloadRemover
=
getDownloaderAt
(
1
);
FakeDownloader
downloadRemover
=
getDownloaderAt
(
1
);
downloadRemover
.
assertRemoveStarted
();
downloadRemover
.
assertRemoveStarted
();
// Re-add the download with a stop reason.
// Re-add the download with a stop reason.
ConditionVariable
downloadManagerIdleCondition
=
new
ConditionVariable
();
runOnMainThread
(
runOnMainThread
(
()
->
{
()
->
downloadManager
.
addDownload
(
createDownloadRequest
(
ID1
),
/* stopReason= */
1234
));
downloadManager
.
addListener
(
new
Listener
()
{
@Override
public
void
onIdle
(
DownloadManager
downloadManager
)
{
downloadManagerIdleCondition
.
open
();
}
});
downloadManager
.
addDownload
(
createDownloadRequest
(
ID1
),
/* stopReason= */
1234
);
});
downloadRemover
.
finish
();
downloadRemover
.
finish
();
downloadManagerListener
.
blockUntilIdle
();
assertThat
(
downloadManagerIdleCondition
.
block
(
TIMEOUT_MS
)).
isTrue
();
assertDownloadIndexSize
(
1
);
assertDownloadIndexSize
(
1
);
// We expect one downloader for the initial download, and one for the removal. A downloader
// We expect one downloader for the initial download, and one for the removal. A downloader
...
...
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