Remove ExoPlayerTest.PlayerStateGrabber
It's no longer needed PiperOrigin-RevId: 454161070
This commit is contained in:
parent
b5f53e7710
commit
8c63ba6fdb
@ -3900,13 +3900,19 @@ public final class ExoPlayerTest {
|
|||||||
ShadowAudioManager shadowAudioManager = shadowOf(context.getSystemService(AudioManager.class));
|
ShadowAudioManager shadowAudioManager = shadowOf(context.getSystemService(AudioManager.class));
|
||||||
shadowAudioManager.setNextFocusRequestResponse(AudioManager.AUDIOFOCUS_REQUEST_FAILED);
|
shadowAudioManager.setNextFocusRequestResponse(AudioManager.AUDIOFOCUS_REQUEST_FAILED);
|
||||||
|
|
||||||
PlayerStateGrabber playerStateGrabber = new PlayerStateGrabber();
|
AtomicBoolean playWhenReady = new AtomicBoolean();
|
||||||
ActionSchedule actionSchedule =
|
ActionSchedule actionSchedule =
|
||||||
new ActionSchedule.Builder(TAG)
|
new ActionSchedule.Builder(TAG)
|
||||||
.setAudioAttributes(AudioAttributes.DEFAULT, /* handleAudioFocus= */ true)
|
.setAudioAttributes(AudioAttributes.DEFAULT, /* handleAudioFocus= */ true)
|
||||||
.play()
|
.play()
|
||||||
.waitForPlaybackState(Player.STATE_READY)
|
.waitForPlaybackState(Player.STATE_READY)
|
||||||
.executeRunnable(playerStateGrabber)
|
.executeRunnable(
|
||||||
|
new PlayerRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run(ExoPlayer player) {
|
||||||
|
playWhenReady.set(player.getPlayWhenReady());
|
||||||
|
}
|
||||||
|
})
|
||||||
.build();
|
.build();
|
||||||
AtomicBoolean seenPlaybackSuppression = new AtomicBoolean();
|
AtomicBoolean seenPlaybackSuppression = new AtomicBoolean();
|
||||||
Player.Listener listener =
|
Player.Listener listener =
|
||||||
@ -3924,7 +3930,7 @@ public final class ExoPlayerTest {
|
|||||||
.start()
|
.start()
|
||||||
.blockUntilActionScheduleFinished(TIMEOUT_MS);
|
.blockUntilActionScheduleFinished(TIMEOUT_MS);
|
||||||
|
|
||||||
assertThat(playerStateGrabber.playWhenReady).isFalse();
|
assertThat(playWhenReady.get()).isFalse();
|
||||||
assertThat(seenPlaybackSuppression.get()).isFalse();
|
assertThat(seenPlaybackSuppression.get()).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12224,19 +12230,6 @@ public final class ExoPlayerTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class PlayerStateGrabber extends PlayerRunnable {
|
|
||||||
|
|
||||||
public boolean playWhenReady;
|
|
||||||
public @Player.State int playbackState;
|
|
||||||
@Nullable public Timeline timeline;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run(ExoPlayer player) {
|
|
||||||
playWhenReady = player.getPlayWhenReady();
|
|
||||||
playbackState = player.getPlaybackState();
|
|
||||||
timeline = player.getCurrentTimeline();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Provides a wrapper for a {@link Runnable} which does collect playback states and window counts.
|
* Provides a wrapper for a {@link Runnable} which does collect playback states and window counts.
|
||||||
* Can be used with {@link ActionSchedule.Builder#executeRunnable(Runnable)} to verify that a
|
* Can be used with {@link ActionSchedule.Builder#executeRunnable(Runnable)} to verify that a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user