aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2022-06-17 22:01:19 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-06-17 22:01:19 +0000
commit0b06ba7015ad0194ab7c874048f2c80b31a8d927 (patch)
treece3ea533f44cb4b5503c4552d6ff2f5ff6e4f4b3
parentf7ce5a2b56419f3af666ed182df58ffcfd10a1d3 (diff)
parent955d292704586f3f988066546f3ad6f2ce897d62 (diff)
downloadtelephony-0b06ba7015ad0194ab7c874048f2c80b31a8d927.tar.gz
Merge "Update ImsCallTest to ensure NPE isnt hit after ImsCall#close is called." into tm-dev am: 955d292704
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/18973628 Change-Id: I5e165d095f787e1a896513f905110b55400ce9b1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsCallTest.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsCallTest.java b/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsCallTest.java
index d6652646f7..aa071255d4 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsCallTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsCallTest.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
@@ -146,6 +147,39 @@ public class ImsCallTest extends TelephonyTest {
@Test
@SmallTest
+ public void testCloseImsCallRtt() throws Exception {
+ ImsCallSession mockSession = mock(ImsCallSession.class);
+ ImsStreamMediaProfile streamProfile = new ImsStreamMediaProfile(
+ ImsStreamMediaProfile.AUDIO_QUALITY_AMR_WB,
+ ImsStreamMediaProfile.DIRECTION_SEND_RECEIVE,
+ ImsStreamMediaProfile.VIDEO_QUALITY_NONE,
+ ImsStreamMediaProfile.DIRECTION_INACTIVE,
+ // Full RTT mode
+ ImsStreamMediaProfile.RTT_MODE_FULL);
+ ImsCallProfile profile = new ImsCallProfile(ImsCallProfile.SERVICE_TYPE_NORMAL,
+ ImsCallProfile.CALL_TYPE_VOICE, null /*extras*/, streamProfile);
+ profile.mCallType = ImsCallProfile.CALL_TYPE_VOICE;
+ ImsCall imsCall = new ImsCall(mContext, profile);
+ imsCall.attachSession(mockSession);
+
+ imsCall.sendRttMessage("test");
+ verify(mockSession).sendRttMessage("test");
+
+ //called by ImsPhoneCallTracker when the call is terminated
+ imsCall.close();
+
+ try {
+ // Ensure RTT cases are handled gracefully.
+ imsCall.sendRttMessage("test");
+ imsCall.sendRttModifyRequest(true);
+ imsCall.sendRttModifyResponse(true);
+ } catch (Exception e) {
+ fail("Unexpected exception: " + e);
+ }
+ }
+
+ @Test
+ @SmallTest
public void testSetWifi() {
ImsCall mTestImsCall = new ImsCall(mContext, mTestCallProfile);
assertFalse(mTestImsCall.isWifiCall());