Search in sources :

Example 16 with IWapPushManager

use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by ResurrectionRemix.

the class WapPushTest method testIntegration4.

/**
     * Integration test 4, iterate OmaApplication ID, Oma content type
     */
public void testIntegration4() {
    boolean res;
    int originalAppIdValue = mAppIdValue;
    int originalContentTypeValue = mContentTypeValue;
    String originalAppIdName = mAppIdName;
    String originalContentTypeName = mContentTypeName;
    String originalClassName = mClassName;
    byte[] originalMessageBody = mMessageBody;
    Random rd = new Random();
    IWapPushManager iwapman = getInterface();
    IDataVerify dataverify = getVerifyInterface();
    mClassName = "com.android.smspush.unitTests.ReceiverService";
    for (int i = 0; i < OMA_APPLICATION_ID_NAMES.length + OMA_CONTENT_TYPE_NAMES.length; i++) {
        mAppIdName = OMA_APPLICATION_ID_NAMES[rd.nextInt(OMA_APPLICATION_ID_NAMES.length)];
        int contIndex = rd.nextInt(OMA_CONTENT_TYPE_NAMES.length);
        mContentTypeName = OMA_CONTENT_TYPE_NAMES[contIndex];
        mMessageBody = new byte[100 + rd.nextInt(100)];
        rd.nextBytes(mMessageBody);
        byte[] pdu = createPDU(8);
        byte[] wappushPdu = retrieveWspBody();
        try {
            dataverify.resetData();
            // set up data
            iwapman.addPackage(mAppIdName, mContentTypeName, mPackageName, mClassName, WapPushManagerParams.APP_TYPE_SERVICE, false, false);
            dispatchWapPdu(wappushPdu, iwapman);
            // clean up data
            iwapman.deletePackage(mAppIdName, mContentTypeName, mPackageName, mClassName);
            if (mContentTypeName.equals(WspTypeDecoder.CONTENT_TYPE_B_PUSH_CO)) {
                assertTrue(dataverify.verifyData(wappushPdu));
            } else {
                assertTrue(dataverify.verifyData(mMessageBody));
            }
        } catch (RemoteException e) {
        }
    }
    mClassName = originalClassName;
    mAppIdName = originalAppIdName;
    mContentTypeName = originalContentTypeName;
    mAppIdValue = originalAppIdValue;
    mContentTypeValue = originalContentTypeValue;
    mMessageBody = originalMessageBody;
}
Also used : Random(java.util.Random) IWapPushManager(com.android.internal.telephony.IWapPushManager) RemoteException(android.os.RemoteException)

Example 17 with IWapPushManager

use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by ResurrectionRemix.

the class WapPushTest method testProcessMsg4.

/**
     * Message processing test, received body data verification test
     */
public void testProcessMsg4() {
    byte[] originalMessageBody = mMessageBody;
    mMessageBody = new byte[] { (byte) 0xee, (byte) 0xff, (byte) 0xee, (byte) 0xff, (byte) 0xee, (byte) 0xff, (byte) 0xee, (byte) 0xff, (byte) 0xee, (byte) 0xff, (byte) 0xee, (byte) 0xff };
    byte[] pdu = createPDU(1);
    int headerLen = pdu.length - (mGsmHeader.length + mUserDataHeader.length + mMessageBody.length);
    int pduType = 6;
    int tranId = 0;
    String originalPackageName = mPackageName;
    String originalClassName = mClassName;
    try {
        IWapPushManager iwapman = getInterface();
        IDataVerify dataverify = getVerifyInterface();
        dataverify.resetData();
        // set up data
        mClassName = "com.android.smspush.unitTests.ReceiverActivity";
        iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, WapPushManagerParams.APP_TYPE_ACTIVITY, false, false);
        iwapman.processMessage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), createIntent(pduType, tranId));
        // clean up data
        iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName);
        assertTrue(dataverify.verifyData(mMessageBody));
        // set up data
        dataverify.resetData();
        mClassName = "com.android.smspush.unitTests.ReceiverService";
        mMessageBody = new byte[] { (byte) 0xaa, (byte) 0xbb, (byte) 0x11, (byte) 0x22, (byte) 0xaa, (byte) 0xbb, (byte) 0x11, (byte) 0x22, (byte) 0xaa, (byte) 0xbb, (byte) 0x11, (byte) 0x22, (byte) 0xaa, (byte) 0xbb, (byte) 0x11, (byte) 0x22, (byte) 0xaa, (byte) 0xbb, (byte) 0x11, (byte) 0x22, (byte) 0xaa, (byte) 0xbb, (byte) 0x11, (byte) 0x22 };
        pdu = createPDU(1);
        iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, WapPushManagerParams.APP_TYPE_SERVICE, false, false);
        iwapman.processMessage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), createIntent(pduType, tranId));
        // clean up data
        iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName);
        // Log.d(LOG_TAG, HexDump.dumpHexString(mMessageBody));
        assertTrue(dataverify.verifyData(mMessageBody));
    } catch (RemoteException e) {
        assertTrue(false);
    }
    mPackageName = originalPackageName;
    mClassName = originalClassName;
    mMessageBody = originalMessageBody;
}
Also used : IWapPushManager(com.android.internal.telephony.IWapPushManager) RemoteException(android.os.RemoteException)

Example 18 with IWapPushManager

use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by ResurrectionRemix.

the class WapPushTest method testAddPackage2.

/**
     * Add duprecated package test.
     */
public void testAddPackage2() {
    try {
        IWapPushManager iwapman = getInterface();
        // set up data
        iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false);
        iwapman.addPackage(Integer.toString(mAppIdValue + 10), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false);
        iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue + 10), mPackageName, mClassName, 0, false, false);
        assertFalse(iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false));
        assertFalse(iwapman.addPackage(Integer.toString(mAppIdValue + 10), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false));
        assertFalse(iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue + 10), mPackageName, mClassName, 0, false, false));
        // clean up data
        iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName);
        iwapman.deletePackage(Integer.toString(mAppIdValue + 10), Integer.toString(mContentTypeValue), mPackageName, mClassName);
        iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue + 10), mPackageName, mClassName);
    } catch (RemoteException e) {
        assertTrue(false);
    }
}
Also used : IWapPushManager(com.android.internal.telephony.IWapPushManager) RemoteException(android.os.RemoteException)

Example 19 with IWapPushManager

use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by ResurrectionRemix.

the class WapPushTest method testIntegration1.

/**
     * Integration test 1, simple case
     */
public void testIntegration1() {
    boolean res;
    int originalAppIdValue = mAppIdValue;
    int originalContentTypeValue = mContentTypeValue;
    String originalAppIdName = mAppIdName;
    String originalContentTypeName = mContentTypeName;
    String originalClassName = mClassName;
    byte[] originalMessageBody = mMessageBody;
    Random rd = new Random();
    mMessageBody = new byte[100 + rd.nextInt(100)];
    rd.nextBytes(mMessageBody);
    byte[] pdu = createPDU(1);
    byte[] wappushPdu = retrieveWspBody();
    mClassName = "com.android.smspush.unitTests.ReceiverActivity";
    try {
        // set up data
        IWapPushManager iwapman = getInterface();
        IDataVerify dataverify = getVerifyInterface();
        dataverify.resetData();
        if (isContentTypeMapped(mContentTypeValue)) {
            // content type is mapped
            mContentTypeName = getContentTypeName(mContentTypeValue);
            Log.d(LOG_TAG, "mContentTypeValue mapping " + mContentTypeName + ":" + mContentTypeValue);
        } else {
            mContentTypeName = Integer.toString(mContentTypeValue);
        }
        iwapman.addPackage(Integer.toString(mAppIdValue), mContentTypeName, mPackageName, mClassName, WapPushManagerParams.APP_TYPE_ACTIVITY, false, false);
        dispatchWapPdu(wappushPdu, iwapman);
        // clean up data
        iwapman.deletePackage(Integer.toString(mAppIdValue), mContentTypeName, mPackageName, mClassName);
        assertTrue(dataverify.verifyData(mMessageBody));
    } catch (RemoteException e) {
    }
    mClassName = originalClassName;
    mAppIdName = originalAppIdName;
    mContentTypeName = originalContentTypeName;
    mAppIdValue = originalAppIdValue;
    mContentTypeValue = originalContentTypeValue;
    mMessageBody = originalMessageBody;
}
Also used : Random(java.util.Random) IWapPushManager(com.android.internal.telephony.IWapPushManager) RemoteException(android.os.RemoteException)

Example 20 with IWapPushManager

use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by ResurrectionRemix.

the class WapPushTest method testDeletePackage1.

/**
     * Deleting package test
     */
public void testDeletePackage1() {
    int originalAppIdValue = mAppIdValue;
    int originalContentTypeValue = mContentTypeValue;
    // set up data
    try {
        IWapPushManager iwapman = getInterface();
        iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false);
        mAppIdValue += 10;
        iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false);
        mContentTypeValue += 20;
        iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false);
        mContentTypeValue += 20;
        iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false);
    } catch (RemoteException e) {
        assertTrue(false);
    }
    mAppIdValue = originalAppIdValue;
    mContentTypeValue = originalContentTypeValue;
    utDeletePackage();
    mAppIdValue += 10;
    utDeletePackage();
    mContentTypeValue += 20;
    utDeletePackage();
    mContentTypeValue += 20;
    utDeletePackage();
    mAppIdValue = originalAppIdValue;
    mContentTypeValue = originalContentTypeValue;
}
Also used : IWapPushManager(com.android.internal.telephony.IWapPushManager) RemoteException(android.os.RemoteException)

Aggregations

RemoteException (android.os.RemoteException)125 IWapPushManager (com.android.internal.telephony.IWapPushManager)125 Random (java.util.Random)30 WapPushManager (com.android.smspush.WapPushManager)18