use of androidx.media3.test.utils.DownloadBuilder in project media by androidx.
the class DefaultDownloadIndexTest method putDownload_setsVersion.
@Test
public void putDownload_setsVersion() throws DatabaseIOException {
SQLiteDatabase readableDatabase = databaseProvider.getReadableDatabase();
assertThat(VersionTable.getVersion(readableDatabase, VersionTable.FEATURE_OFFLINE, EMPTY_NAME)).isEqualTo(VersionTable.VERSION_UNSET);
downloadIndex.putDownload(new DownloadBuilder("id1").build());
assertThat(VersionTable.getVersion(readableDatabase, VersionTable.FEATURE_OFFLINE, EMPTY_NAME)).isEqualTo(DefaultDownloadIndex.TABLE_VERSION);
}
use of androidx.media3.test.utils.DownloadBuilder in project media by androidx.
the class DefaultDownloadIndexTest method setStopReason_setReasonToNone.
@Test
public void setStopReason_setReasonToNone() throws Exception {
String id = "id";
DownloadBuilder downloadBuilder = new DownloadBuilder(id).setState(Download.STATE_COMPLETED).setStopReason(0x12345678);
Download download = downloadBuilder.build();
downloadIndex.putDownload(download);
downloadIndex.setStopReason(STOP_REASON_NONE);
Download readDownload = downloadIndex.getDownload(id);
Download expectedDownload = downloadBuilder.setStopReason(STOP_REASON_NONE).build();
assertEqual(readDownload, expectedDownload);
}
use of androidx.media3.test.utils.DownloadBuilder in project media by androidx.
the class DefaultDownloadIndexTest method setSingleDownloadStopReason_setReason.
@Test
public void setSingleDownloadStopReason_setReason() throws Exception {
String id = "id";
DownloadBuilder downloadBuilder = new DownloadBuilder(id).setState(Download.STATE_FAILED).setFailureReason(FAILURE_REASON_UNKNOWN);
Download download = downloadBuilder.build();
downloadIndex.putDownload(download);
int stopReason = 0x12345678;
downloadIndex.setStopReason(id, stopReason);
Download readDownload = downloadIndex.getDownload(id);
Download expectedDownload = downloadBuilder.setStopReason(stopReason).build();
assertEqual(readDownload, expectedDownload);
}
Aggregations