Bug 831702 - 0007.Test case for STK Terminal Response. r=yoshi

This commit is contained in:
Chuck Lee 2013-01-23 11:42:44 +08:00
parent 413ee6b21f
commit 2f92a16449

View File

@ -1446,3 +1446,70 @@ add_test(function test_stk_event_download_location_status() {
event: event event: event
}); });
}); });
/**
* Verify STK terminal response
*/
add_test(function test_stk_event_download_location_status() {
let worker = newUint8WithOutgoingIndexWorker();
let buf = worker.Buf;
let pduHelper = worker.GsmPDUHelper;
buf.sendParcel = function () {
// Type
do_check_eq(this.readUint32(), REQUEST_STK_SEND_TERMINAL_RESPONSE)
// Token : we don't care
this.readUint32();
// Data Size, 44 = 2 * (TLV_COMMAND_DETAILS_SIZE(5) +
// TLV_DEVICE_ID_SIZE(4) +
// TLV_RESULT_SIZE(3) +
// TEXT LENGTH(10))
do_check_eq(this.readUint32(), 44);
// Command Details, Type-Length-Value
do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_COMMAND_DETAILS |
COMPREHENSIONTLV_FLAG_CR);
do_check_eq(pduHelper.readHexOctet(), 3);
do_check_eq(pduHelper.readHexOctet(), 0x01);
do_check_eq(pduHelper.readHexOctet(), STK_CMD_PROVIDE_LOCAL_INFO);
do_check_eq(pduHelper.readHexOctet(), STK_LOCAL_INFO_NNA);
// Device Identifies, Type-Length-Value(Source ID-Destination ID)
do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID);
do_check_eq(pduHelper.readHexOctet(), 2);
do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_ME);
do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM);
// Result
do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_RESULT |
COMPREHENSIONTLV_FLAG_CR);
do_check_eq(pduHelper.readHexOctet(), 1);
do_check_eq(pduHelper.readHexOctet(), STK_RESULT_OK);
// Text
do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_TEXT_STRING |
COMPREHENSIONTLV_FLAG_CR);
do_check_eq(pduHelper.readHexOctet(), 8);
do_check_eq(pduHelper.readHexOctet(), STK_TEXT_CODING_GSM_7BIT_PACKED);
do_check_eq(pduHelper.readSeptetsToString(7, 0, PDU_NL_IDENTIFIER_DEFAULT,
PDU_NL_IDENTIFIER_DEFAULT), "Mozilla");
run_next_test();
};
let response = {
command: {
commandNumber: 0x01,
typeOfCommand: STK_CMD_PROVIDE_LOCAL_INFO,
commandQualifier: STK_LOCAL_INFO_NNA,
options: {
isPacked: true
}
},
input: "Mozilla",
resultCode: STK_RESULT_OK
};
worker.RIL.sendStkTerminalResponse(response);
});