summaryrefslogtreecommitdiff
path: root/tests/src/com/android/server/telecom/tests/CallAudioManagerTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/com/android/server/telecom/tests/CallAudioManagerTest.java')
-rw-r--r--tests/src/com/android/server/telecom/tests/CallAudioManagerTest.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/src/com/android/server/telecom/tests/CallAudioManagerTest.java b/tests/src/com/android/server/telecom/tests/CallAudioManagerTest.java
index 4adafc80a..3d06ad090 100644
--- a/tests/src/com/android/server/telecom/tests/CallAudioManagerTest.java
+++ b/tests/src/com/android/server/telecom/tests/CallAudioManagerTest.java
@@ -51,6 +51,7 @@ import java.util.List;
import java.util.stream.Collectors;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.nullable;
@@ -677,6 +678,30 @@ public class CallAudioManagerTest extends TelecomTestCase {
assertTrue(mCallAudioManager.isCallVoip(child));
}
+ @SmallTest
+ @Test
+ public void testOnCallStreamingStateChanged() {
+ Call call = mock(Call.class);
+ ArgumentCaptor<CallAudioModeStateMachine.MessageArgs> captor = makeNewCaptor();
+
+ // non-streaming call
+ mCallAudioManager.onCallStreamingStateChanged(call, false /* isStreamingCall */);
+ verify(mCallAudioModeStateMachine, never()).sendMessageWithArgs(anyInt(),
+ any(MessageArgs.class));
+
+ // start streaming
+ mCallAudioManager.onCallStreamingStateChanged(call, true /* isStreamingCall */);
+ verify(mCallAudioModeStateMachine).sendMessageWithArgs(
+ eq(CallAudioModeStateMachine.START_CALL_STREAMING), captor.capture());
+ assertTrue(captor.getValue().isStreaming);
+
+ // stop streaming
+ mCallAudioManager.onCallStreamingStateChanged(call, false /* isStreamingCall */);
+ verify(mCallAudioModeStateMachine).sendMessageWithArgs(
+ eq(CallAudioModeStateMachine.STOP_CALL_STREAMING), captor.capture());
+ assertFalse(captor.getValue().isStreaming);
+ }
+
private Call createSimulatedRingingCall() {
Call call = mock(Call.class);
when(call.getState()).thenReturn(CallState.SIMULATED_RINGING);