use of com.android.internal.telephony.IWapPushManager in project platform_frameworks_base by android.
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 testDeletePackage1.
/**
* Deleting package test
*/
public void testDeletePackage1() {
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;
utDeletePackage();
mAppIdValue += 10;
utDeletePackage();
mContentTypeValue += 20;
utDeletePackage();
mContentTypeValue += 20;
utDeletePackage();
mAppIdValue = originalAppIdValue;
mContentTypeValue = originalContentTypeValue;
}
use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by ParanoidAndroid.
the class WapPushTest method testUpdatePackage2.
/**
* Updating invalid package test
*/
public void testUpdatePackage2() {
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.updatePackage(Integer.toString(mAppIdValue + 10), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false));
assertFalse(iwapman.updatePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue + 10), mPackageName, mClassName, 0, false, false));
assertTrue(iwapman.updatePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName + "dummy_data", mClassName, 0, false, false));
assertTrue(iwapman.updatePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName + "dummy_data", 0, false, false));
// clean up data
iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName);
iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName + "dummy_data");
} catch (RemoteException e) {
assertTrue(false);
}
}
use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by ParanoidAndroid.
the class WapPushTest method testProcessMsg4.
/**
* Message processing test, received body data verification test
*/
public void testProcessMsg4() {
byte[] originalMessageBody = mMessageBody;
mMessageBody = new byte[] { (byte) 0xee, (byte) 0xff, (byte) 0xee, (byte) 0xff, (byte) 0xee, (byte) 0xff, (byte) 0xee, (byte) 0xff, (byte) 0xee, (byte) 0xff, (byte) 0xee, (byte) 0xff };
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 {
IWapPushManager iwapman = getInterface();
IDataVerify dataverify = getVerifyInterface();
dataverify.resetData();
// set up data
mClassName = "com.android.smspush.unitTests.ReceiverActivity";
iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, WapPushManagerParams.APP_TYPE_ACTIVITY, false, false);
iwapman.processMessage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), createIntent(pduType, tranId));
// clean up data
iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName);
assertTrue(dataverify.verifyData(mMessageBody));
// set up data
dataverify.resetData();
mClassName = "com.android.smspush.unitTests.ReceiverService";
mMessageBody = new byte[] { (byte) 0xaa, (byte) 0xbb, (byte) 0x11, (byte) 0x22, (byte) 0xaa, (byte) 0xbb, (byte) 0x11, (byte) 0x22, (byte) 0xaa, (byte) 0xbb, (byte) 0x11, (byte) 0x22, (byte) 0xaa, (byte) 0xbb, (byte) 0x11, (byte) 0x22, (byte) 0xaa, (byte) 0xbb, (byte) 0x11, (byte) 0x22, (byte) 0xaa, (byte) 0xbb, (byte) 0x11, (byte) 0x22 };
pdu = createPDU(1);
iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, WapPushManagerParams.APP_TYPE_SERVICE, false, false);
iwapman.processMessage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), createIntent(pduType, tranId));
// clean up data
iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName);
// Log.d(LOG_TAG, HexDump.dumpHexString(mMessageBody));
assertTrue(dataverify.verifyData(mMessageBody));
} catch (RemoteException e) {
assertTrue(false);
}
mPackageName = originalPackageName;
mClassName = originalClassName;
mMessageBody = originalMessageBody;
}
use of com.android.internal.telephony.IWapPushManager in project android_frameworks_base by ParanoidAndroid.
the class WapPushTest method testProcessMsg1.
/**
* Message processing test, start activity
*/
public void testProcessMsg1() {
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.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