FileDocCategorySizeDatePackage
UsimDataDownloadTest.javaAPI DocAndroid 5.1 API5499Thu Mar 12 22:22:54 GMT 2015com.android.internal.telephony.gsm

UsimDataDownloadTest

public class UsimDataDownloadTest extends android.test.AndroidTestCase
Test SMS-PP data download to UICC. Uses test messages from 3GPP TS 31.124 section 27.22.5.

Fields Summary
private static final String
TAG
private UsimDataDownloadCommands
mCi
private TestHandlerThread
mHandlerThread
UsimDataDownloadHandler
mHandler
private static final byte[]
SMS_PP_MESSAGE_3_1_1
private static final String
SMS_PP_ENVELOPE_3_1_1
private static final byte[]
SMS_PP_MESSAGE_3_1_5
private static final String
SMS_PP_ENVELOPE_3_1_5
Constructors Summary
Methods Summary
protected voidsetUp()

        super.setUp();
        mCi = new UsimDataDownloadCommands(mContext);
        mHandlerThread = new TestHandlerThread();
        mHandlerThread.start();
        mHandler = mHandlerThread.getHandler();
        Rlog.d(TAG, "mHandler is constructed");
    
protected voidtearDown()

        mHandlerThread.quit();
        super.tearDown();
    
public voidtestDataDownloadMessage1()


       
        SmsMessage message = SmsMessage.createFromPdu(SMS_PP_MESSAGE_3_1_1);
        assertTrue("message is SMS-PP data download", message.isUsimDataDownload());

        mCi.expectSendEnvelope(SMS_PP_ENVELOPE_3_1_1, 0x90, 0x00, "");
        mCi.expectAcknowledgeGsmSms(true, 0);
        mHandler.startDataDownload(message);
        mCi.assertExpectedMethodsCalled();

        mCi.expectSendEnvelope(SMS_PP_ENVELOPE_3_1_1, 0x90, 0x00, "0123456789");
        mCi.expectAcknowledgeGsmSmsWithPdu(true, "00077f16050123456789");
        mHandler.startDataDownload(message);
        mCi.assertExpectedMethodsCalled();

        mCi.expectSendEnvelope(SMS_PP_ENVELOPE_3_1_1, 0x62, 0xff, "0123456789abcdef");
        mCi.expectAcknowledgeGsmSmsWithPdu(false, "00d5077f16080123456789abcdef");
        mHandler.startDataDownload(message);
        mCi.assertExpectedMethodsCalled();
    
public voidtestDataDownloadMessage5()

        SmsMessage message = SmsMessage.createFromPdu(SMS_PP_MESSAGE_3_1_5);
        assertTrue("message is SMS-PP data download", message.isUsimDataDownload());

        mCi.expectSendEnvelope(SMS_PP_ENVELOPE_3_1_5, 0x90, 0x00, "9876543210");
        mCi.expectAcknowledgeGsmSmsWithPdu(true, "00077ff6059876543210");
        mHandler.startDataDownload(message);
        mCi.assertExpectedMethodsCalled();

        mCi.expectSendEnvelope(SMS_PP_ENVELOPE_3_1_5, 0x93, 0x00, "");
        mCi.expectAcknowledgeGsmSms(false, 0xd4);   // SIM toolkit busy
        mHandler.startDataDownload(message);
        mCi.assertExpectedMethodsCalled();