Search in sources :

Example 1 with RequestSet

use of com.google.android.exoplayer2.testutil.CacheAsserts.RequestSet in project ExoPlayer by google.

the class DashDownloaderTest method downloadRepresentationFailure.

@Test
public void downloadRepresentationFailure() throws Exception {
    FakeDataSet fakeDataSet = new FakeDataSet().setData(TEST_MPD_URI, TEST_MPD).setRandomData("audio_init_data", 10).setRandomData("audio_segment_1", 4).newData("audio_segment_2").appendReadData(TestUtil.buildTestData(2)).appendReadError(new IOException()).appendReadData(TestUtil.buildTestData(3)).endData().setRandomData("audio_segment_3", 6);
    DashDownloader dashDownloader = getDashDownloader(fakeDataSet, new StreamKey(0, 0, 0));
    try {
        dashDownloader.download(progressListener);
        fail();
    } catch (IOException e) {
    // Expected.
    }
    dashDownloader.download(progressListener);
    assertCachedData(cache, new RequestSet(fakeDataSet).useBoundedDataSpecFor("audio_init_data"));
}
Also used : RequestSet(com.google.android.exoplayer2.testutil.CacheAsserts.RequestSet) FakeDataSet(com.google.android.exoplayer2.testutil.FakeDataSet) IOException(java.io.IOException) StreamKey(com.google.android.exoplayer2.offline.StreamKey) Test(org.junit.Test)

Example 2 with RequestSet

use of com.google.android.exoplayer2.testutil.CacheAsserts.RequestSet in project ExoPlayer by google.

the class DashDownloaderTest method downloadRepresentation.

@Test
public void downloadRepresentation() throws Exception {
    FakeDataSet fakeDataSet = new FakeDataSet().setData(TEST_MPD_URI, TEST_MPD).setRandomData("audio_init_data", 10).setRandomData("audio_segment_1", 4).setRandomData("audio_segment_2", 5).setRandomData("audio_segment_3", 6);
    DashDownloader dashDownloader = getDashDownloader(fakeDataSet, new StreamKey(0, 0, 0));
    dashDownloader.download(progressListener);
    assertCachedData(cache, new RequestSet(fakeDataSet).useBoundedDataSpecFor("audio_init_data"));
}
Also used : RequestSet(com.google.android.exoplayer2.testutil.CacheAsserts.RequestSet) FakeDataSet(com.google.android.exoplayer2.testutil.FakeDataSet) StreamKey(com.google.android.exoplayer2.offline.StreamKey) Test(org.junit.Test)

Example 3 with RequestSet

use of com.google.android.exoplayer2.testutil.CacheAsserts.RequestSet in project ExoPlayer by google.

the class DashDownloaderTest method downloadRepresentationInSmallParts.

@Test
public void downloadRepresentationInSmallParts() throws Exception {
    FakeDataSet fakeDataSet = new FakeDataSet().setData(TEST_MPD_URI, TEST_MPD).setRandomData("audio_init_data", 10).newData("audio_segment_1").appendReadData(TestUtil.buildTestData(10)).appendReadData(TestUtil.buildTestData(10)).appendReadData(TestUtil.buildTestData(10)).endData().setRandomData("audio_segment_2", 5).setRandomData("audio_segment_3", 6);
    DashDownloader dashDownloader = getDashDownloader(fakeDataSet, new StreamKey(0, 0, 0));
    dashDownloader.download(progressListener);
    assertCachedData(cache, new RequestSet(fakeDataSet).useBoundedDataSpecFor("audio_init_data"));
}
Also used : RequestSet(com.google.android.exoplayer2.testutil.CacheAsserts.RequestSet) FakeDataSet(com.google.android.exoplayer2.testutil.FakeDataSet) StreamKey(com.google.android.exoplayer2.offline.StreamKey) Test(org.junit.Test)

Example 4 with RequestSet

use of com.google.android.exoplayer2.testutil.CacheAsserts.RequestSet in project ExoPlayer by google.

the class DashDownloaderTest method downloadAllRepresentations.

@Test
public void downloadAllRepresentations() throws Exception {
    FakeDataSet fakeDataSet = new FakeDataSet().setData(TEST_MPD_URI, TEST_MPD).setRandomData("audio_init_data", 10).setRandomData("audio_segment_1", 4).setRandomData("audio_segment_2", 5).setRandomData("audio_segment_3", 6).setRandomData("text_segment_1", 1).setRandomData("text_segment_2", 2).setRandomData("text_segment_3", 3).setRandomData("period_2_segment_1", 1).setRandomData("period_2_segment_2", 2).setRandomData("period_2_segment_3", 3);
    DashDownloader dashDownloader = getDashDownloader(fakeDataSet);
    dashDownloader.download(progressListener);
    assertCachedData(cache, new RequestSet(fakeDataSet).useBoundedDataSpecFor("audio_init_data"));
}
Also used : RequestSet(com.google.android.exoplayer2.testutil.CacheAsserts.RequestSet) FakeDataSet(com.google.android.exoplayer2.testutil.FakeDataSet) Test(org.junit.Test)

Example 5 with RequestSet

use of com.google.android.exoplayer2.testutil.CacheAsserts.RequestSet in project ExoPlayer by google.

the class DashDownloaderTest method downloadRepresentations.

@Test
public void downloadRepresentations() throws Exception {
    FakeDataSet fakeDataSet = new FakeDataSet().setData(TEST_MPD_URI, TEST_MPD).setRandomData("audio_init_data", 10).setRandomData("audio_segment_1", 4).setRandomData("audio_segment_2", 5).setRandomData("audio_segment_3", 6).setRandomData("text_segment_1", 1).setRandomData("text_segment_2", 2).setRandomData("text_segment_3", 3);
    DashDownloader dashDownloader = getDashDownloader(fakeDataSet, new StreamKey(0, 0, 0), new StreamKey(0, 1, 0));
    dashDownloader.download(progressListener);
    assertCachedData(cache, new RequestSet(fakeDataSet).useBoundedDataSpecFor("audio_init_data"));
}
Also used : RequestSet(com.google.android.exoplayer2.testutil.CacheAsserts.RequestSet) FakeDataSet(com.google.android.exoplayer2.testutil.FakeDataSet) StreamKey(com.google.android.exoplayer2.offline.StreamKey) Test(org.junit.Test)

Aggregations

RequestSet (com.google.android.exoplayer2.testutil.CacheAsserts.RequestSet)5 FakeDataSet (com.google.android.exoplayer2.testutil.FakeDataSet)5 Test (org.junit.Test)5 StreamKey (com.google.android.exoplayer2.offline.StreamKey)4 IOException (java.io.IOException)1