use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by crdroidandroid.
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;
}
use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by crdroidandroid.
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 android_frameworks_base by crdroidandroid.
the class WapPushTest method testAddPackage1.
/**
* Add package test
*/
public void testAddPackage1() {
int originalAppIdValue = mAppIdValue;
int originalContentTypeValue = mContentTypeValue;
utAddPackage(true, true);
mAppIdValue += 10;
utAddPackage(true, false);
mContentTypeValue += 20;
utAddPackage(false, true);
mContentTypeValue += 20;
utAddPackage(false, false);
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;
}
use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by crdroidandroid.
the class WapPushTest method testAddPackage0.
/**
* Add sqlite injection test
*/
public void testAddPackage0() {
String inject = "' union select 0,'com.android.settings','com.android.settings.Settings',0,0,0--";
// insert new data
IWapPushManager iwapman = getInterface();
try {
assertFalse(iwapman.addPackage(inject, Integer.toString(mContentTypeValue), mPackageName, mClassName, WapPushManagerParams.APP_TYPE_SERVICE, true, true));
} catch (RemoteException e) {
assertTrue(false);
}
}
use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by crdroidandroid.
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);
}
}
Aggregations