docs/doc/reference/com/google/android/exoplayer2/robolectric/TestDownloadManagerListener.html
Package com.google.android.exoplayer2.robolectric
All Implemented Interfaces:DownloadManager.Listener
public final classTestDownloadManagerListenerextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[DownloadManager.Listener](../offline/DownloadManager.Listener.html "interface in com.google.android.exoplayer2.offline")
Allows tests to block for, and assert properties of, calls from a DownloadManager to its DownloadManager.Listener.
Constructors | Constructor | Description |
| --- | --- |
| TestDownloadManagerListener(DownloadManager downloadManager) | |
All Methods Instance Methods Concrete Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| void | assertRemoved(String id) |
Asserts that the specified download is removed.
|
| void | assertState(String id, @com.google.android.exoplayer2.offline.Download.State int state) |
Asserts that the specified download transitions to the specified state.
|
| void | blockUntilIdle() |
Blocks until the manager is idle.
|
| void | blockUntilIdleAndThrowAnyFailure() |
Blocks until the manager is idle and throws if any of the downloads failed.
|
| void | blockUntilInitialized() |
Blocks until the manager is initialized.
|
| void | onDownloadChanged(DownloadManager downloadManager, Download download, Exception finalException) |
Called when the state of a download changes.
|
| void | onDownloadRemoved(DownloadManager downloadManager, Download download) |
Called when a download is removed.
|
| void | onIdle(DownloadManager downloadManager) |
Called when there is no active download left.
|
| void | onInitialized(DownloadManager downloadManager) |
Called when all downloads have been restored.
|
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
onDownloadsPausedChanged, onRequirementsStateChanged, onWaitingForRequirementsChanged
-
public TestDownloadManagerListener([DownloadManager](../offline/DownloadManager.html "class in com.google.android.exoplayer2.offline")downloadManager)
-
public void blockUntilInitialized()
throws[InterruptedException](https://developer.android.com/reference/java/lang/InterruptedException.html "class or interface in java.lang")
Blocks until the manager is initialized.
Throws:InterruptedException
-
public void blockUntilIdle()
throws[InterruptedException](https://developer.android.com/reference/java/lang/InterruptedException.html "class or interface in java.lang")
Blocks until the manager is idle.
Throws:InterruptedException
-
public void blockUntilIdleAndThrowAnyFailure()
throws[Exception](https://developer.android.com/reference/java/lang/Exception.html "class or interface in java.lang")
Blocks until the manager is idle and throws if any of the downloads failed.
Throws:Exception
-
public void assertState([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")id,[@State](../offline/Download.State.html "annotation in com.google.android.exoplayer2.offline")@com.google.android.exoplayer2.offline.Download.State int state)
Asserts that the specified download transitions to the specified state.
-
public void assertRemoved([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")id)
Asserts that the specified download is removed.
-
public void onInitialized([DownloadManager](../offline/DownloadManager.html "class in com.google.android.exoplayer2.offline")downloadManager)
Description copied from interface: DownloadManager.Listener
Called when all downloads have been restored.
Specified by:onInitialized in interface DownloadManager.ListenerParameters:downloadManager - The reporting instance.
-
public void onDownloadChanged([DownloadManager](../offline/DownloadManager.html "class in com.google.android.exoplayer2.offline")downloadManager,[Download](../offline/Download.html "class in com.google.android.exoplayer2.offline")download,
@Nullable[Exception](https://developer.android.com/reference/java/lang/Exception.html "class or interface in java.lang")finalException)
Description copied from interface: DownloadManager.Listener
Called when the state of a download changes.
Specified by:onDownloadChanged in interface DownloadManager.ListenerParameters:downloadManager - The reporting instance.download - The state of the download.finalException - If the download is transitioning to Download.STATE_FAILED, this is the final exception that resulted in the failure.
-
public void onDownloadRemoved([DownloadManager](../offline/DownloadManager.html "class in com.google.android.exoplayer2.offline")downloadManager,[Download](../offline/Download.html "class in com.google.android.exoplayer2.offline")download)
Description copied from interface: DownloadManager.Listener
Called when a download is removed.
Specified by:onDownloadRemoved in interface DownloadManager.ListenerParameters:downloadManager - The reporting instance.download - The last state of the download before it was removed.
-
public void onIdle([DownloadManager](../offline/DownloadManager.html "class in com.google.android.exoplayer2.offline")downloadManager)
Description copied from interface: DownloadManager.Listener
Called when there is no active download left.
Specified by:onIdle in interface DownloadManager.ListenerParameters:downloadManager - The reporting instance.