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

Commit 70db77ec authored by Amit Mahajan's avatar Amit Mahajan Committed by Android Partner Code Review
Browse files

Merge "Fix for WapPushOverSmsTest" into mm-wireless-dev

parents 3166507c 03986793
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ public class WapPushOverSmsTest extends TelephonyTest {
    @Test @SmallTest
    public void testDispatchWapPdu() {
        doReturn(true).when(mWspTypeDecoder).decodeUintvarInteger(anyInt());
        doReturn(true).when(mWspTypeDecoder).decodeContentType(anyInt());
        doReturn((long)2).when(mWspTypeDecoder).getValue32();
        doReturn(2).when(mWspTypeDecoder).getDecodedDataLength();
        doReturn(WspTypeDecoder.CONTENT_TYPE_B_PUSH_CO).when(mWspTypeDecoder).getValueString();
@@ -68,14 +69,28 @@ public class WapPushOverSmsTest extends TelephonyTest {

        ArgumentCaptor<Intent> intentArgumentCaptor = ArgumentCaptor.forClass(Intent.class);
        verify(mInboundSmsHandler).dispatchIntent(intentArgumentCaptor.capture(),
                eq(android.Manifest.permission.RECEIVE_MMS), eq(AppOpsManager.OP_RECEIVE_MMS),
                any(Bundle.class), isNull(BroadcastReceiver.class), eq(UserHandle.SYSTEM));
                eq(android.Manifest.permission.RECEIVE_WAP_PUSH),
                eq(AppOpsManager.OP_RECEIVE_WAP_PUSH),
                any(Bundle.class),
                isNull(BroadcastReceiver.class),
                eq(UserHandle.SYSTEM));
        Intent intent = intentArgumentCaptor.getValue();
        assertEquals(Telephony.Sms.Intents.WAP_PUSH_DELIVER_ACTION, intent.getAction());
        assertEquals(0xFF, intent.getIntExtra("transactionId", 0));
        assertEquals(0x06, intent.getIntExtra("pduType", 0));
        assertEquals(new byte[]{(byte) 0xFF, (byte) 0xFF}, intent.getByteArrayExtra("header"));
        assertEquals(pdu, intent.getByteArrayExtra("data"));

        byte[] header = intent.getByteArrayExtra("header");
        assertEquals(2, header.length);
        for (int i = 0; i < header.length; i++) {
            assertEquals((byte)0xFF, header[i]);
        }

        byte[] data = intent.getByteArrayExtra("data");
        assertEquals(pdu.length, data.length);
        for (int i = 0; i < pdu.length; i++) {
            assertEquals(pdu[i], data[i]);
        }

        assertEquals(mWspTypeDecoder.getContentParameters(),
                intent.getSerializableExtra("contentTypeParameters"));
    }