Merge "Fix output switcher will show 2 media sessions in some use cases" into rvc-qpr-dev am: 9ccf19cb9f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/13109545 Change-Id: I5f2c4d8549c28d1c91d81b7808183b0c97700dda
This commit is contained in:
@@ -115,6 +115,33 @@ public class MediaOutputUtilsTest {
|
||||
|
||||
@Test
|
||||
public void getActiveLocalMediaController_bothHaveRemoteMediaAndLocalMedia_returnNull() {
|
||||
mMediaControllers.clear();
|
||||
final MediaController.PlaybackInfo playbackInfo = new MediaController.PlaybackInfo(
|
||||
MediaController.PlaybackInfo.PLAYBACK_TYPE_REMOTE,
|
||||
VolumeProvider.VOLUME_CONTROL_ABSOLUTE,
|
||||
100,
|
||||
10,
|
||||
new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_MEDIA).build(),
|
||||
null);
|
||||
final PlaybackState playbackState = new PlaybackState.Builder()
|
||||
.setState(PlaybackState.STATE_PLAYING, 0, 1)
|
||||
.build();
|
||||
final MediaController remoteMediaController = mock(MediaController.class);
|
||||
|
||||
mMediaControllers.add(remoteMediaController);
|
||||
mMediaControllers.add(mMediaController);
|
||||
initPlayback();
|
||||
|
||||
when(mMediaController.getPlaybackInfo()).thenReturn(mPlaybackInfo);
|
||||
when(mMediaController.getPlaybackState()).thenReturn(mPlaybackState);
|
||||
when(remoteMediaController.getPlaybackInfo()).thenReturn(playbackInfo);
|
||||
when(remoteMediaController.getPlaybackState()).thenReturn(playbackState);
|
||||
|
||||
assertThat(MediaOutputUtils.getActiveLocalMediaController(mMediaSessionManager)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getActiveLocalMediaController_bothHaveLocalMediaAndRemoteMedia_returnNull() {
|
||||
final MediaController.PlaybackInfo playbackInfo = new MediaController.PlaybackInfo(
|
||||
MediaController.PlaybackInfo.PLAYBACK_TYPE_REMOTE,
|
||||
VolumeProvider.VOLUME_CONTROL_ABSOLUTE,
|
||||
|
Reference in New Issue
Block a user