mirror of
https://github.com/androidx/media.git
synced 2025-05-05 14:40:50 +08:00
Remove ExoPlayerTest.PlayerStateGrabber
It's no longer needed PiperOrigin-RevId: 454161070 (cherry picked from commit 86a2f297a5f8eb94fc04820ea943512c078205c4)
This commit is contained in:
parent
ddd8f4174f
commit
beb0422e22
@ -3890,13 +3890,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 =
|
||||||
@ -3914,7 +3920,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12230,19 +12236,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