use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by AOSPA.
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 android_frameworks_base by AOSPA.
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 AOSPA.
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 AOSPA.
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 AOSPA.
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