use of com.android.internal.telephony.IWapPushManager in project platform_frameworks_base by android.
the class WapPushTest method testAddPackage2.
/**
* Add duprecated package test.
*/
public void testAddPackage2() {
try {
IWapPushManager iwapman = getInterface();
// set up data
iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false);
iwapman.addPackage(Integer.toString(mAppIdValue + 10), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false);
iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue + 10), mPackageName, mClassName, 0, false, false);
assertFalse(iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false));
assertFalse(iwapman.addPackage(Integer.toString(mAppIdValue + 10), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false));
assertFalse(iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue + 10), mPackageName, mClassName, 0, false, false));
// clean up data
iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName);
iwapman.deletePackage(Integer.toString(mAppIdValue + 10), Integer.toString(mContentTypeValue), mPackageName, mClassName);
iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue + 10), mPackageName, mClassName);
} catch (RemoteException e) {
assertTrue(false);
}
}
use of com.android.internal.telephony.IWapPushManager in project platform_frameworks_base by android.
the class WapPushTest method utAddPackage.
/*
* All methods need to start with 'test'.
* Use various assert methods to pass/fail the test case.
*/
protected void utAddPackage(boolean need_sig, boolean more_proc) {
IWapPushManager iwapman = getInterface();
// insert new data
try {
assertTrue(iwapman.addPackage(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));
}
use of com.android.internal.telephony.IWapPushManager in project platform_frameworks_base by android.
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;
}
use of com.android.internal.telephony.IWapPushManager in project platform_frameworks_base by android.
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;
}
use of com.android.internal.telephony.IWapPushManager in project platform_frameworks_base by android.
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;
}
Aggregations