Search in sources :

Example 1 with IWapPushManager

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

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

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

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

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

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

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

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)

Example 5 with IWapPushManager

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

the class WapPushTest method testUpdatePackage2.

/**
     * Updating invalid package test
     */
public void testUpdatePackage2() {
    int originalAppIdValue = mAppIdValue;
    int originalContentTypeValue = mContentTypeValue;
    try {
        // set up data
        IWapPushManager iwapman = getInterface();
        iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false);
        assertFalse(iwapman.updatePackage(Integer.toString(mAppIdValue + 10), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false));
        assertFalse(iwapman.updatePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue + 10), mPackageName, mClassName, 0, false, false));
        assertTrue(iwapman.updatePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName + "dummy_data", mClassName, 0, false, false));
        assertTrue(iwapman.updatePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName + "dummy_data", 0, false, false));
        // clean up data
        iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName);
        iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName + "dummy_data");
    } catch (RemoteException e) {
        assertTrue(false);
    }
}
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