Search in sources :

Example 31 with IWapPushManager

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

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)

Example 32 with IWapPushManager

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

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

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

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)

Example 34 with IWapPushManager

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

the class WapPushTest method utUpdatePackage.

protected void utUpdatePackage(boolean need_sig, boolean more_proc) {
    IWapPushManager iwapman = getInterface();
    // insert new data
    try {
        assertTrue(iwapman.updatePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, WapPushManagerParams.APP_TYPE_SERVICE, need_sig, more_proc));
    } catch (RemoteException e) {
        assertTrue(false);
    }
    // verify the data
    WapPushManager wpman = getService();
    assertTrue(wpman.verifyData(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, WapPushManagerParams.APP_TYPE_SERVICE, need_sig, more_proc));
}
Also used : WapPushManager(com.android.smspush.WapPushManager) IWapPushManager(com.android.internal.telephony.IWapPushManager) IWapPushManager(com.android.internal.telephony.IWapPushManager) RemoteException(android.os.RemoteException)

Example 35 with IWapPushManager

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

the class WapPushTest method utDeletePackage.

protected void utDeletePackage() {
    IWapPushManager iwapman = getInterface();
    try {
        assertTrue(iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName));
    } catch (RemoteException e) {
        assertTrue(false);
    }
    // verify the data
    WapPushManager wpman = getService();
    assertTrue(!wpman.isDataExist(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName));
}
Also used : WapPushManager(com.android.smspush.WapPushManager) IWapPushManager(com.android.internal.telephony.IWapPushManager) 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