mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1072367 - Part 1: Broadcast 'cdma-info-rec-received' system message per record. r=echen
This commit is contained in:
parent
952fe26e7a
commit
5387d2fe84
@ -2092,7 +2092,9 @@ RadioInterface.prototype = {
|
||||
break;
|
||||
case "cdma-info-rec-received":
|
||||
if (DEBUG) this.debug("cdma-info-rec-received: " + JSON.stringify(message));
|
||||
gSystemMessenger.broadcastMessage("cdma-info-rec-received", message);
|
||||
message.records.forEach(function(aRecord) {
|
||||
gSystemMessenger.broadcastMessage("cdma-info-rec-received", aRecord);
|
||||
});
|
||||
break;
|
||||
default:
|
||||
throw new Error("Don't know about this message type: " +
|
||||
|
@ -6920,9 +6920,10 @@ RilObject.prototype[UNSOLICITED_CDMA_OTA_PROVISION_STATUS] = function UNSOLICITE
|
||||
status: status});
|
||||
};
|
||||
RilObject.prototype[UNSOLICITED_CDMA_INFO_REC] = function UNSOLICITED_CDMA_INFO_REC(length) {
|
||||
let record = this.context.CdmaPDUHelper.decodeInformationRecord();
|
||||
record.rilMessageType = "cdma-info-rec-received";
|
||||
this.sendChromeMessage(record);
|
||||
this.sendChromeMessage({
|
||||
rilMessageType: "cdma-info-rec-received",
|
||||
records: this.context.CdmaPDUHelper.decodeInformationRecord()
|
||||
});
|
||||
};
|
||||
RilObject.prototype[UNSOLICITED_OEM_HOOK_RAW] = null;
|
||||
RilObject.prototype[UNSOLICITED_RINGBACK_TONE] = null;
|
||||
@ -9987,11 +9988,13 @@ CdmaPDUHelperObject.prototype = {
|
||||
*/
|
||||
decodeInformationRecord: function() {
|
||||
let Buf = this.context.Buf;
|
||||
let record = {};
|
||||
let records = [];
|
||||
let numOfRecords = Buf.readInt32();
|
||||
|
||||
let type;
|
||||
let record;
|
||||
for (let i = 0; i < numOfRecords; i++) {
|
||||
record = {};
|
||||
type = Buf.readInt32();
|
||||
|
||||
switch (type) {
|
||||
@ -10088,11 +10091,13 @@ CdmaPDUHelperObject.prototype = {
|
||||
case PDU_CDMA_INFO_REC_TYPE_T53_RELEASE:
|
||||
// Fall through
|
||||
default:
|
||||
throw new Error("UNSOLICITED_CDMA_INFO_REC(), Unsupported information record type " + record.type + "\n");
|
||||
throw new Error("UNSOLICITED_CDMA_INFO_REC(), Unsupported information record type " + type + "\n");
|
||||
}
|
||||
|
||||
records.push(record);
|
||||
}
|
||||
|
||||
return record;
|
||||
return records;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -53,9 +53,9 @@ add_test(function test_display() {
|
||||
0x6F, 0x00]);
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.CdmaPDUHelper;
|
||||
let record = helper.decodeInformationRecord();
|
||||
let records = helper.decodeInformationRecord();
|
||||
|
||||
do_check_eq(record.display, "Test Info");
|
||||
do_check_eq(records[0].display, "Test Info");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
@ -76,18 +76,19 @@ add_test(function test_extended_display() {
|
||||
0x66, 0x6F, 0x00]);
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.CdmaPDUHelper;
|
||||
let record = helper.decodeInformationRecord();
|
||||
let records = helper.decodeInformationRecord();
|
||||
|
||||
do_check_eq(record.extendedDisplay.indicator, 1);
|
||||
do_check_eq(record.extendedDisplay.type, 0);
|
||||
do_check_eq(record.extendedDisplay.records.length, 3);
|
||||
do_check_eq(record.extendedDisplay.records[0].tag, 0x80);
|
||||
do_check_eq(record.extendedDisplay.records[1].tag, 0x81);
|
||||
do_check_eq(record.extendedDisplay.records[2].tag, 0x9B);
|
||||
do_check_eq(record.extendedDisplay.records[2].content, "Test Info");
|
||||
do_check_eq(records[0].extendedDisplay.indicator, 1);
|
||||
do_check_eq(records[0].extendedDisplay.type, 0);
|
||||
do_check_eq(records[0].extendedDisplay.records.length, 3);
|
||||
do_check_eq(records[0].extendedDisplay.records[0].tag, 0x80);
|
||||
do_check_eq(records[0].extendedDisplay.records[1].tag, 0x81);
|
||||
do_check_eq(records[0].extendedDisplay.records[2].tag, 0x9B);
|
||||
do_check_eq(records[0].extendedDisplay.records[2].content, "Test Info");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
/**
|
||||
* Verify decoder for mixed type
|
||||
*/
|
||||
@ -108,16 +109,40 @@ add_test(function test_mixed() {
|
||||
0x66, 0x6F, 0x00]);
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.CdmaPDUHelper;
|
||||
let record = helper.decodeInformationRecord();
|
||||
let records = helper.decodeInformationRecord();
|
||||
|
||||
do_check_eq(record.display, "Test Info");
|
||||
do_check_eq(record.extendedDisplay.indicator, 1);
|
||||
do_check_eq(record.extendedDisplay.type, 0);
|
||||
do_check_eq(record.extendedDisplay.records.length, 3);
|
||||
do_check_eq(record.extendedDisplay.records[0].tag, 0x80);
|
||||
do_check_eq(record.extendedDisplay.records[1].tag, 0x81);
|
||||
do_check_eq(record.extendedDisplay.records[2].tag, 0x9B);
|
||||
do_check_eq(record.extendedDisplay.records[2].content, "Test Info");
|
||||
do_check_eq(records[0].display, "Test Info");
|
||||
do_check_eq(records[1].extendedDisplay.indicator, 1);
|
||||
do_check_eq(records[1].extendedDisplay.type, 0);
|
||||
do_check_eq(records[1].extendedDisplay.records.length, 3);
|
||||
do_check_eq(records[1].extendedDisplay.records[0].tag, 0x80);
|
||||
do_check_eq(records[1].extendedDisplay.records[1].tag, 0x81);
|
||||
do_check_eq(records[1].extendedDisplay.records[2].tag, 0x9B);
|
||||
do_check_eq(records[1].extendedDisplay.records[2].content, "Test Info");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
/**
|
||||
* Verify decoder for multiple types
|
||||
*/
|
||||
add_test(function test_multiple() {
|
||||
let worker = newWorkerWithParcel([
|
||||
0x02, // two inforemation record
|
||||
0x00, // type: display
|
||||
0x0B, // length: 11
|
||||
0x54, 0x65, 0x73, 0x74, 0x20, 0x49, 0x6E, 0x66,
|
||||
0x6F, 0x20, 0x31, 0x00,
|
||||
0x00, // type: display
|
||||
0x0B, // length: 11
|
||||
0x54, 0x65, 0x73, 0x74, 0x20, 0x49, 0x6E, 0x66,
|
||||
0x6F, 0x20, 0x32, 0x00]);
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.CdmaPDUHelper;
|
||||
let records = helper.decodeInformationRecord();
|
||||
|
||||
do_check_eq(records[0].display, "Test Info 1");
|
||||
do_check_eq(records[1].display, "Test Info 2");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user