Loading android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java +19 −2 Original line number Diff line number Diff line Loading @@ -1426,12 +1426,13 @@ public class AvrcpControllerStateMachineTest { } /** * Test receiving an audio focus loss event. A pause should be sent * Test receiving an audio focus loss event. A pause should be sent if we were playing */ @Test public void testOnAudioFocusLoss_pauseSent() { public void testOnAudioFocusLossWhilePlaying_pauseSent() { setUpConnectedState(true, true); sendAudioFocusUpdate(AudioManager.AUDIOFOCUS_GAIN); setPlaybackState(PlaybackStateCompat.STATE_PLAYING); sendAudioFocusUpdate(AudioManager.AUDIOFOCUS_LOSS); TestUtils.waitForLooperToBeIdle(mAvrcpStateMachine.getHandler().getLooper()); Loading @@ -1439,7 +1440,23 @@ public class AvrcpControllerStateMachineTest { eq(AvrcpControllerService.PASS_THRU_CMD_ID_PAUSE), eq(KEY_DOWN)); verify(mAvrcpControllerService, times(1)).sendPassThroughCommandNative(eq(mTestAddress), eq(AvrcpControllerService.PASS_THRU_CMD_ID_PAUSE), eq(KEY_UP)); } /** * Test receiving an audio focus loss event. A pause should not be sent if we were paused */ @Test public void testOnAudioFocusLossWhilePause_pauseNotSent() { setUpConnectedState(true, true); sendAudioFocusUpdate(AudioManager.AUDIOFOCUS_GAIN); setPlaybackState(PlaybackStateCompat.STATE_PAUSED); sendAudioFocusUpdate(AudioManager.AUDIOFOCUS_LOSS); TestUtils.waitForLooperToBeIdle(mAvrcpStateMachine.getHandler().getLooper()); verify(mAvrcpControllerService, times(0)).sendPassThroughCommandNative(eq(mTestAddress), eq(AvrcpControllerService.PASS_THRU_CMD_ID_PAUSE), eq(KEY_DOWN)); verify(mAvrcpControllerService, times(0)).sendPassThroughCommandNative(eq(mTestAddress), eq(AvrcpControllerService.PASS_THRU_CMD_ID_PAUSE), eq(KEY_UP)); } /** Loading Loading
android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java +19 −2 Original line number Diff line number Diff line Loading @@ -1426,12 +1426,13 @@ public class AvrcpControllerStateMachineTest { } /** * Test receiving an audio focus loss event. A pause should be sent * Test receiving an audio focus loss event. A pause should be sent if we were playing */ @Test public void testOnAudioFocusLoss_pauseSent() { public void testOnAudioFocusLossWhilePlaying_pauseSent() { setUpConnectedState(true, true); sendAudioFocusUpdate(AudioManager.AUDIOFOCUS_GAIN); setPlaybackState(PlaybackStateCompat.STATE_PLAYING); sendAudioFocusUpdate(AudioManager.AUDIOFOCUS_LOSS); TestUtils.waitForLooperToBeIdle(mAvrcpStateMachine.getHandler().getLooper()); Loading @@ -1439,7 +1440,23 @@ public class AvrcpControllerStateMachineTest { eq(AvrcpControllerService.PASS_THRU_CMD_ID_PAUSE), eq(KEY_DOWN)); verify(mAvrcpControllerService, times(1)).sendPassThroughCommandNative(eq(mTestAddress), eq(AvrcpControllerService.PASS_THRU_CMD_ID_PAUSE), eq(KEY_UP)); } /** * Test receiving an audio focus loss event. A pause should not be sent if we were paused */ @Test public void testOnAudioFocusLossWhilePause_pauseNotSent() { setUpConnectedState(true, true); sendAudioFocusUpdate(AudioManager.AUDIOFOCUS_GAIN); setPlaybackState(PlaybackStateCompat.STATE_PAUSED); sendAudioFocusUpdate(AudioManager.AUDIOFOCUS_LOSS); TestUtils.waitForLooperToBeIdle(mAvrcpStateMachine.getHandler().getLooper()); verify(mAvrcpControllerService, times(0)).sendPassThroughCommandNative(eq(mTestAddress), eq(AvrcpControllerService.PASS_THRU_CMD_ID_PAUSE), eq(KEY_DOWN)); verify(mAvrcpControllerService, times(0)).sendPassThroughCommandNative(eq(mTestAddress), eq(AvrcpControllerService.PASS_THRU_CMD_ID_PAUSE), eq(KEY_UP)); } /** Loading