Search in sources :

Example 11 with MediaSourceTestRunner

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

the class MergingMediaSourceTest method createPeriod_createsChildPeriods.

@Test
public void createPeriod_createsChildPeriods() throws Exception {
    FakeMediaSource[] mediaSources = new FakeMediaSource[2];
    for (int i = 0; i < mediaSources.length; i++) {
        mediaSources[i] = new FakeMediaSource(new FakeTimeline(/* windowCount= */
        2));
    }
    MergingMediaSource mediaSource = new MergingMediaSource(mediaSources);
    MediaSourceTestRunner testRunner = new MediaSourceTestRunner(mediaSource, null);
    try {
        testRunner.prepareSource();
        testRunner.assertPrepareAndReleaseAllPeriods();
        for (FakeMediaSource element : mediaSources) {
            assertThat(element.getCreatedMediaPeriods()).isNotEmpty();
        }
        testRunner.releaseSource();
    } finally {
        testRunner.release();
    }
}
Also used : MediaSourceTestRunner(com.google.android.exoplayer2.testutil.MediaSourceTestRunner) FakeMediaSource(com.google.android.exoplayer2.testutil.FakeMediaSource) FakeTimeline(com.google.android.exoplayer2.testutil.FakeTimeline) Test(org.junit.Test)

Aggregations

MediaSourceTestRunner (com.google.android.exoplayer2.testutil.MediaSourceTestRunner)11 FakeMediaSource (com.google.android.exoplayer2.testutil.FakeMediaSource)8 FakeTimeline (com.google.android.exoplayer2.testutil.FakeTimeline)7 Timeline (com.google.android.exoplayer2.Timeline)6 Test (org.junit.Test)6 DefaultShuffleOrder (com.google.android.exoplayer2.source.ShuffleOrder.DefaultShuffleOrder)4 MediaPeriodId (com.google.android.exoplayer2.source.MediaSource.MediaPeriodId)3 FakeShuffleOrder (com.google.android.exoplayer2.testutil.FakeShuffleOrder)2 PlaceholderTimeline (com.google.android.exoplayer2.source.MaskingMediaSource.PlaceholderTimeline)1 Before (org.junit.Before)1