Search in sources :

Example 1 with InvalidationListener

use of com.google.android.exoplayer2.trackselection.TrackSelector.InvalidationListener in project ExoPlayer by google.

the class DefaultTrackSelectorTest method setParameterWithSameParametersDoesNotNotifyInvalidationListenerAgain.

/**
 * Tests that track selector will not call {@link
 * InvalidationListener#onTrackSelectionsInvalidated()} again when it's set with the same values
 * of {@link Parameters}.
 */
@Test
public void setParameterWithSameParametersDoesNotNotifyInvalidationListenerAgain() {
    ParametersBuilder builder = defaultParameters.buildUpon().setPreferredAudioLanguage("eng");
    trackSelector.setParameters(builder);
    trackSelector.setParameters(builder);
    verify(invalidationListener, times(1)).onTrackSelectionsInvalidated();
}
Also used : ParametersBuilder(com.google.android.exoplayer2.trackselection.DefaultTrackSelector.ParametersBuilder) Test(org.junit.Test)

Example 2 with InvalidationListener

use of com.google.android.exoplayer2.trackselection.TrackSelector.InvalidationListener in project ExoPlayer by google.

the class DefaultTrackSelectorTest method setParameterWithNonDefaultParameterNotifyInvalidationListener.

/**
 * Tests that track selector will call {@link InvalidationListener#onTrackSelectionsInvalidated()}
 * when it's set with non-default values of {@link Parameters}.
 */
@Test
public void setParameterWithNonDefaultParameterNotifyInvalidationListener() {
    ParametersBuilder builder = defaultParameters.buildUpon().setPreferredAudioLanguage("eng");
    trackSelector.setParameters(builder);
    verify(invalidationListener).onTrackSelectionsInvalidated();
}
Also used : ParametersBuilder(com.google.android.exoplayer2.trackselection.DefaultTrackSelector.ParametersBuilder) Test(org.junit.Test)

Example 3 with InvalidationListener

use of com.google.android.exoplayer2.trackselection.TrackSelector.InvalidationListener in project ExoPlayer by google.

the class TrackSelectorTest method getBandwidthMeter_afterInitialization_returnsProvidedBandwidthMeter.

@Test
public void getBandwidthMeter_afterInitialization_returnsProvidedBandwidthMeter() {
    InvalidationListener invalidationListener = Mockito.mock(InvalidationListener.class);
    BandwidthMeter bandwidthMeter = Mockito.mock(BandwidthMeter.class);
    trackSelector.init(invalidationListener, bandwidthMeter);
    assertThat(trackSelector.getBandwidthMeter()).isEqualTo(bandwidthMeter);
}
Also used : BandwidthMeter(com.google.android.exoplayer2.upstream.BandwidthMeter) InvalidationListener(com.google.android.exoplayer2.trackselection.TrackSelector.InvalidationListener) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 ParametersBuilder (com.google.android.exoplayer2.trackselection.DefaultTrackSelector.ParametersBuilder)2 InvalidationListener (com.google.android.exoplayer2.trackselection.TrackSelector.InvalidationListener)1 BandwidthMeter (com.google.android.exoplayer2.upstream.BandwidthMeter)1