use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by ParanoidAndroid.
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 ParanoidAndroid.
the class WapPushTest method testIntegration4.
/**
* Integration test 4, iterate OmaApplication ID, Oma content type
*/
public void testIntegration4() {
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 + OMA_CONTENT_TYPE_NAMES.length; i++) {
mAppIdName = OMA_APPLICATION_ID_NAMES[rd.nextInt(OMA_APPLICATION_ID_NAMES.length)];
int contIndex = rd.nextInt(OMA_CONTENT_TYPE_NAMES.length);
mContentTypeName = OMA_CONTENT_TYPE_NAMES[contIndex];
mMessageBody = new byte[100 + rd.nextInt(100)];
rd.nextBytes(mMessageBody);
byte[] pdu = createPDU(8);
byte[] wappushPdu = retrieveWspBody();
try {
dataverify.resetData();
// set up data
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 ParanoidAndroid.
the class WapPushTest method testIntegration5.
/**
* Integration test 5, iterate binary OmaApplication ID, Oma binary content type
*/
public void testIntegration5() {
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_VALUES.length + OMA_CONTENT_TYPE_VALUES.length; i++) {
mAppIdValue = OMA_APPLICATION_ID_VALUES[rd.nextInt(OMA_APPLICATION_ID_VALUES.length)];
mContentTypeValue = OMA_CONTENT_TYPE_VALUES[rd.nextInt(OMA_CONTENT_TYPE_VALUES.length)];
mMessageBody = new byte[100 + rd.nextInt(100)];
rd.nextBytes(mMessageBody);
byte[] pdu = createPDU(3);
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(Integer.toString(mAppIdValue), mContentTypeName, mPackageName, mClassName, WapPushManagerParams.APP_TYPE_SERVICE, 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;
}
use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by ParanoidAndroid.
the class WapPushTest method testUpdatePackage1.
/**
* Updating package test
*/
public void testUpdatePackage1() {
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;
utUpdatePackage(false, false);
mAppIdValue += 10;
utUpdatePackage(false, true);
mContentTypeValue += 20;
utUpdatePackage(true, false);
mContentTypeValue += 20;
utUpdatePackage(true, true);
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 ParanoidAndroid.
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;
}
Aggregations