use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by ParanoidAndroid.
the class WapPushTest method testProcessMsg5.
/**
* Message processing test, send invalid sms data
*/
public void testProcessMsg5() {
byte[] pdu = createPDU(2);
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;
}
use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by ParanoidAndroid.
the class WapPushTest method testProcessMsg6.
/**
* Message processing test, no receiver application
*/
public void testProcessMsg6() {
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.NoReceiver";
// set up data
IWapPushManager iwapman = getInterface();
iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, WapPushManagerParams.APP_TYPE_ACTIVITY, false, 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);
// set up data
iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, WapPushManagerParams.APP_TYPE_SERVICE, false, 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;
}
use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by ParanoidAndroid.
the class WapPushTest method testDeletePackage2.
/**
* Deleting invalid package test
*/
public void testDeletePackage2() {
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.deletePackage(Integer.toString(mAppIdValue + 10), Integer.toString(mContentTypeValue), mPackageName, mClassName));
assertFalse(iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue + 20), mPackageName, mClassName));
assertFalse(iwapman.deletePackage(Integer.toString(mAppIdValue + 10), Integer.toString(mContentTypeValue + 20), mPackageName, mClassName));
iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName);
} catch (RemoteException e) {
assertTrue(false);
}
}
use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by ParanoidAndroid.
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;
}
use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by ResurrectionRemix.
the class WapPushTest method testIntegration3.
/**
* Integration test 3, iterate OmaApplication ID, random binary content type
*/
public void testIntegration3() {
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; i++) {
mAppIdName = OMA_APPLICATION_ID_NAMES[i];
mContentTypeValue = rd.nextInt(0x0FFF);
mMessageBody = new byte[100 + rd.nextInt(100)];
rd.nextBytes(mMessageBody);
byte[] pdu = createPDU(6);
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(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;
}
Aggregations