Search in sources :

Example 41 with IWapPushManager

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

the class WapPushTest method testProcessMsg1.

/**
     * Message processing test, start activity
     */
public void testProcessMsg1() {
    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 {
        mClassName = "com.android.smspush.unitTests.ReceiverActivity";
        // set up data
        IWapPushManager iwapman = getInterface();
        iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, WapPushManagerParams.APP_TYPE_ACTIVITY, false, false);
        assertTrue((iwapman.processMessage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), createIntent(pduType, tranId)) & WapPushManagerParams.MESSAGE_HANDLED) == WapPushManagerParams.MESSAGE_HANDLED);
        // clean up data
        iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName);
    } catch (RemoteException e) {
        assertTrue(false);
    }
    mPackageName = originalPackageName;
    mClassName = originalClassName;
}
Also used : IWapPushManager(com.android.internal.telephony.IWapPushManager) RemoteException(android.os.RemoteException)

Example 42 with IWapPushManager

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

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 43 with IWapPushManager

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

the class WapPushTest method testProcessMsg3.

/**
     * Message processing test, no signature
     */
public void testProcessMsg3() {
    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 {
        mPackageName = "com.android.development";
        mClassName = "com.android.development.Development";
        // set up data
        IWapPushManager iwapman = getInterface();
        iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, WapPushManagerParams.APP_TYPE_SERVICE, true, false);
        assertFalse((iwapman.processMessage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), createIntent(pduType, tranId)) & WapPushManagerParams.MESSAGE_HANDLED) == WapPushManagerParams.MESSAGE_HANDLED);
        // clean up data
        iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName);
    } catch (RemoteException e) {
        assertTrue(false);
    }
    mPackageName = originalPackageName;
    mClassName = originalClassName;
}
Also used : IWapPushManager(com.android.internal.telephony.IWapPushManager) RemoteException(android.os.RemoteException)

Example 44 with IWapPushManager

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

the class WapPushTest method testUpdatePackage1.

/**
     * Updating package test
     */
public void testUpdatePackage1() {
    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;
    utUpdatePackage(false, false);
    mAppIdValue += 10;
    utUpdatePackage(false, true);
    mContentTypeValue += 20;
    utUpdatePackage(true, false);
    mContentTypeValue += 20;
    utUpdatePackage(true, true);
    mAppIdValue = originalAppIdValue;
    mContentTypeValue = originalContentTypeValue;
    // clean up data
    try {
        IWapPushManager iwapman = getInterface();
        iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName);
        mAppIdValue += 10;
        iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName);
        mContentTypeValue += 20;
        iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName);
        mContentTypeValue += 20;
        iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName);
    } catch (RemoteException e) {
        assertTrue(false);
    }
    mAppIdValue = originalAppIdValue;
    mContentTypeValue = originalContentTypeValue;
}
Also used : IWapPushManager(com.android.internal.telephony.IWapPushManager) RemoteException(android.os.RemoteException)

Example 45 with IWapPushManager

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

the class WapPushTest method testProcessMsg2.

/**
     * Message processing test, start service
     */
public void testProcessMsg2() {
    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 {
        mClassName = "com.android.smspush.unitTests.ReceiverService";
        // set up data
        IWapPushManager iwapman = getInterface();
        iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, WapPushManagerParams.APP_TYPE_SERVICE, false, false);
        assertTrue((iwapman.processMessage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), createIntent(pduType, tranId)) & WapPushManagerParams.MESSAGE_HANDLED) == WapPushManagerParams.MESSAGE_HANDLED);
        // clean up data
        iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName);
    } catch (RemoteException e) {
        assertTrue(false);
    }
    mPackageName = originalPackageName;
    mClassName = originalClassName;
}
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