Search in sources :

Example 86 with IWapPushManager

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

the class WapPushTest method testIntegration2.

/**
     * Integration test 2, random mAppIdValue(int), all OMA content type
     */
public void testIntegration2() {
    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.ReceiverActivity";
    for (int i = 0; i < OMA_CONTENT_TYPE_NAMES.length; i++) {
        mContentTypeName = OMA_CONTENT_TYPE_NAMES[i];
        mAppIdValue = rd.nextInt(0x0FFFFFFF);
        mMessageBody = new byte[100 + rd.nextInt(100)];
        rd.nextBytes(mMessageBody);
        byte[] pdu = createPDU(7);
        byte[] wappushPdu = retrieveWspBody();
        try {
            dataverify.resetData();
            // set up data
            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);
            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 87 with IWapPushManager

use of com.android.internal.telephony.IWapPushManager in project platform_frameworks_base by android.

the class WapPushTest method testIntegration5.

/**
     * Integration test 5, iterate binary OmaApplication ID, Oma binary content type
     */
public void testIntegration5() {
    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_VALUES.length + OMA_CONTENT_TYPE_VALUES.length; i++) {
        mAppIdValue = OMA_APPLICATION_ID_VALUES[rd.nextInt(OMA_APPLICATION_ID_VALUES.length)];
        mContentTypeValue = OMA_CONTENT_TYPE_VALUES[rd.nextInt(OMA_CONTENT_TYPE_VALUES.length)];
        mMessageBody = new byte[100 + rd.nextInt(100)];
        rd.nextBytes(mMessageBody);
        byte[] pdu = createPDU(3);
        byte[] wappushPdu = retrieveWspBody();
        try {
            dataverify.resetData();
            // set up data
            if (isContentTypeMapped(mContentTypeValue)) {
                // content type is mapped to integer value
                mContentTypeName = getContentTypeName(mContentTypeValue);
                Log.d(LOG_TAG, "mContentTypeValue mapping " + mContentTypeValue + ":" + mContentTypeName);
            } else {
                mContentTypeName = Integer.toString(mContentTypeValue);
            }
            iwapman.addPackage(Integer.toString(mAppIdValue), mContentTypeName, mPackageName, mClassName, WapPushManagerParams.APP_TYPE_SERVICE, false, false);
            dispatchWapPdu(wappushPdu, iwapman);
            // clean up data
            iwapman.deletePackage(Integer.toString(mAppIdValue), 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 88 with IWapPushManager

use of com.android.internal.telephony.IWapPushManager in project platform_frameworks_base by android.

the class WapPushTest method testIntegration2.

/**
     * Integration test 2, random mAppIdValue(int), all OMA content type
     */
public void testIntegration2() {
    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.ReceiverActivity";
    for (int i = 0; i < OMA_CONTENT_TYPE_NAMES.length; i++) {
        mContentTypeName = OMA_CONTENT_TYPE_NAMES[i];
        mAppIdValue = rd.nextInt(0x0FFFFFFF);
        mMessageBody = new byte[100 + rd.nextInt(100)];
        rd.nextBytes(mMessageBody);
        byte[] pdu = createPDU(7);
        byte[] wappushPdu = retrieveWspBody();
        try {
            dataverify.resetData();
            // set up data
            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);
            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 89 with IWapPushManager

use of com.android.internal.telephony.IWapPushManager in project platform_frameworks_base by android.

the class WapPushTest method testAddPackage0.

/**
     * Add sqlite injection test
     */
public void testAddPackage0() {
    String inject = "' union select 0,'com.android.settings','com.android.settings.Settings',0,0,0--";
    // insert new data
    IWapPushManager iwapman = getInterface();
    try {
        assertFalse(iwapman.addPackage(inject, Integer.toString(mContentTypeValue), mPackageName, mClassName, WapPushManagerParams.APP_TYPE_SERVICE, true, true));
    } catch (RemoteException e) {
        assertTrue(false);
    }
}
Also used : IWapPushManager(com.android.internal.telephony.IWapPushManager) RemoteException(android.os.RemoteException)

Example 90 with IWapPushManager

use of com.android.internal.telephony.IWapPushManager in project platform_frameworks_base by android.

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)

Aggregations

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