Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a627c067 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Update ImsCallTest to ensure NPE isnt hit after ImsCall#close is...

Merge "Update ImsCallTest to ensure NPE isnt hit after ImsCall#close is called." into tm-dev am: 955d2927

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/18973628



Change-Id: I52dda232d0753f88bdeedabde3ec5b51bfa52378
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents cd315d0c 955d2927
Loading
Loading
Loading
Loading
+34 −0
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.mock;
@@ -144,6 +145,39 @@ public class ImsCallTest extends TelephonyTest {
        assertTrue(imsCall.wasVideoCall());
        assertTrue(imsCall.wasVideoCall());
    }
    }


    @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
    @Test
    @SmallTest
    @SmallTest
    public void testSetWifi() {
    public void testSetWifi() {