Bug 908075 - Part2: USER_ACTIVITY stk event xpcshell test. r=yoshi

This commit is contained in:
Georgia Wang 2013-09-04 18:52:28 +08:00
parent e5b75a3888
commit fdd5639b07

View File

@ -878,6 +878,54 @@ add_test(function test_stk_event_download_language_selection() {
});
});
/**
* Verify Event Download Command : User Activity
*/
add_test(function test_stk_event_download_user_activity() {
let worker = newUint8SupportOutgoingIndexWorker();
let buf = worker.Buf;
let pduHelper = worker.GsmPDUHelper;
buf.sendParcel = function () {
// Type
do_check_eq(this.readUint32(), REQUEST_STK_SEND_ENVELOPE_COMMAND);
// Token : we don't care
this.readUint32();
// Data Size, 18 = 2 * (2 + TLV_DEVICE_ID_SIZE(4) + TLV_EVENT_LIST_SIZE(3))
do_check_eq(this.readUint32(), 18);
// BER tag
do_check_eq(pduHelper.readHexOctet(), BER_EVENT_DOWNLOAD_TAG);
// BER length, 7 = TLV_DEVICE_ID_SIZE(4) + TLV_EVENT_LIST_SIZE(3)
do_check_eq(pduHelper.readHexOctet(), 7);
// Device Identities, Type-Length-Value(Source ID-Destination ID)
do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID |
COMPREHENSIONTLV_FLAG_CR);
do_check_eq(pduHelper.readHexOctet(), 2);
do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_ME);
do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM);
// Event List, Type-Length-Value
do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_EVENT_LIST |
COMPREHENSIONTLV_FLAG_CR);
do_check_eq(pduHelper.readHexOctet(), 1);
do_check_eq(pduHelper.readHexOctet(), STK_EVENT_TYPE_USER_ACTIVITY);
run_next_test();
};
let event = {
eventType: STK_EVENT_TYPE_USER_ACTIVITY
};
worker.RIL.sendStkEventDownload({
event: event
});
});
/**
* Verify Event Download Command : Idle Screen Available
*/