Bug 908083 - Part3: browser termination envelop event xpcshell test. r=yoshi

This commit is contained in:
Georgia Wang 2013-09-04 11:34:45 +08:00
parent 7c8b2d085f
commit a2146d6f47

View File

@ -973,3 +973,60 @@ add_test(function test_stk_event_download_idle_screen_available() {
event: event
});
});
/**
* Verify Event Downloaded Command :Browser Termination
*/
add_test(function test_stk_event_download_browser_termination() {
let worker = newUint8SupportOutgoingIndexWorker();
let buf = worker.Buf;
let pduHelper = worker.GsmPDUHelper;
buf.sendParcel = function () {
// Type
do_check_eq(this.readInt32(), REQUEST_STK_SEND_ENVELOPE_COMMAND);
// Token : we don't care
this.readInt32();
// Data Size, 24 = 2 * ( 2+TLV_DEVICE_ID(4)+TLV_EVENT_LIST_SIZE(3)
// +TLV_BROWSER_TERMINATION_CAUSE(3) )
do_check_eq(this.readInt32(), 24);
// BER tag
do_check_eq(pduHelper.readHexOctet(), BER_EVENT_DOWNLOAD_TAG);
// BER length, 10 = TLV_DEVICE_ID(4)+TLV_EVENT_LIST_SIZE(3)
// ++TLV_BROWSER_TERMINATION_CAUSE(3)
do_check_eq(pduHelper.readHexOctet(), 10);
// 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_BROWSER_TERMINATION);
// Browser Termination Case, Type-Length-Value
do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_BROWSER_TERMINATION_CAUSE |
COMPREHENSIONTLV_FLAG_CR);
do_check_eq(pduHelper.readHexOctet(), 1);
do_check_eq(pduHelper.readHexOctet(), STK_BROWSER_TERMINATION_CAUSE_USER);
run_next_test();
};
let event = {
eventType: STK_EVENT_TYPE_BROWSER_TERMINATION,
terminationCause: STK_BROWSER_TERMINATION_CAUSE_USER
};
worker.RIL.sendStkEventDownload({
event: event
});
});