зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1062720 - Response 0x01 or 0x00 for the "Yes"/"No" request of GET_INKEY. r=hsinyi
This commit is contained in:
Родитель
83acd430ad
Коммит
5b3af25ab6
|
@ -3091,7 +3091,8 @@ RilObject.prototype = {
|
|||
// ("Yes/No") command with command qualifier set to "Yes/No", it shall
|
||||
// supply the value '01' when the answer is "positive" and the value
|
||||
// '00' when the answer is "negative" in the Text string data object.
|
||||
text = response.isYesNo ? 0x01 : 0x00;
|
||||
text = response.isYesNo ? String.fromCharCode(0x01)
|
||||
: String.fromCharCode(0x00);
|
||||
} else {
|
||||
text = response.input;
|
||||
}
|
||||
|
|
|
@ -156,6 +156,81 @@ add_test(function test_stk_terminal_response() {
|
|||
context.RIL.sendStkTerminalResponse(response);
|
||||
});
|
||||
|
||||
/**
|
||||
* Verify STK terminal response : GET_INKEY - YES/NO request
|
||||
*/
|
||||
add_test(function test_stk_terminal_response_get_inkey() {
|
||||
function do_test(isYesNo) {
|
||||
let worker = newUint8SupportOutgoingIndexWorker();
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let buf = context.Buf;
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
|
||||
buf.sendParcel = function() {
|
||||
// Type
|
||||
do_check_eq(this.readInt32(), REQUEST_STK_SEND_TERMINAL_RESPONSE);
|
||||
|
||||
// Token : we don't care
|
||||
this.readInt32();
|
||||
|
||||
// Data Size, 32 = 2 * (TLV_COMMAND_DETAILS_SIZE(5) +
|
||||
// TLV_DEVICE_ID_SIZE(4) +
|
||||
// TLV_RESULT_SIZE(3) +
|
||||
// TEXT LENGTH(4))
|
||||
do_check_eq(this.readInt32(), 32);
|
||||
|
||||
// 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_GET_INKEY);
|
||||
do_check_eq(pduHelper.readHexOctet(), 0x04);
|
||||
|
||||
// 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);
|
||||
|
||||
// Yes/No response
|
||||
do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_TEXT_STRING |
|
||||
COMPREHENSIONTLV_FLAG_CR);
|
||||
do_check_eq(pduHelper.readHexOctet(), 2);
|
||||
do_check_eq(pduHelper.readHexOctet(), STK_TEXT_CODING_GSM_8BIT);
|
||||
do_check_eq(pduHelper.readHexOctet(), isYesNo ? 0x01 : 0x00);
|
||||
|
||||
run_next_test();
|
||||
};
|
||||
|
||||
let response = {
|
||||
command: {
|
||||
commandNumber: 0x01,
|
||||
typeOfCommand: STK_CMD_GET_INKEY,
|
||||
commandQualifier: 0x04,
|
||||
options: {
|
||||
isYesNoRequested: true
|
||||
}
|
||||
},
|
||||
isYesNo: isYesNo,
|
||||
resultCode: STK_RESULT_OK
|
||||
};
|
||||
|
||||
context.RIL.sendStkTerminalResponse(response);
|
||||
};
|
||||
|
||||
// Test "Yes" response
|
||||
do_test(true);
|
||||
// Test "No" response
|
||||
do_test(false);
|
||||
});
|
||||
|
||||
// Test ComprehensionTlvHelper
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче