mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 920391 - B2G RIL: Buf.read/writeUint32 should be of signed int32 operation. r=vicamo
This commit is contained in:
parent
022cbf538c
commit
907ea46df1
File diff suppressed because it is too large
Load Diff
@ -109,7 +109,7 @@ function newIncomingParcel(fakeParcelSize, response, request, data) {
|
||||
++writeIndex;
|
||||
}
|
||||
|
||||
function writeUint32(value) {
|
||||
function writeInt32(value) {
|
||||
writeUint8(value & 0xff);
|
||||
writeUint8((value >> 8) & 0xff);
|
||||
writeUint8((value >> 16) & 0xff);
|
||||
@ -128,8 +128,8 @@ function newIncomingParcel(fakeParcelSize, response, request, data) {
|
||||
}
|
||||
writeParcelSize(fakeParcelSize);
|
||||
|
||||
writeUint32(response);
|
||||
writeUint32(request);
|
||||
writeInt32(response);
|
||||
writeInt32(request);
|
||||
|
||||
// write parcel data
|
||||
for (let ii = 0; ii < data.length; ++ii) {
|
||||
|
@ -42,10 +42,10 @@ add_test(function test_change_call_barring_password() {
|
||||
function do_test(facility, pin, newPin) {
|
||||
buf.sendParcel = function fakeSendParcel () {
|
||||
// Request Type.
|
||||
do_check_eq(this.readUint32(), REQUEST_CHANGE_BARRING_PASSWORD);
|
||||
do_check_eq(this.readInt32(), REQUEST_CHANGE_BARRING_PASSWORD);
|
||||
|
||||
// Token : we don't care.
|
||||
this.readUint32();
|
||||
this.readInt32();
|
||||
|
||||
let parcel = this.readStringList();
|
||||
do_check_eq(parcel.length, 3);
|
||||
|
@ -51,7 +51,7 @@ add_test_incoming_parcel(null,
|
||||
function test_normal_parcel_handling(worker) {
|
||||
do_check_throws(function normal_handler() {
|
||||
// reads exactly the same size, should not throw anything.
|
||||
worker.Buf.readUint32();
|
||||
worker.Buf.readInt32();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -31,7 +31,7 @@ function newWorkerWithParcel(parcelBuf) {
|
||||
return buf[index++];
|
||||
};
|
||||
|
||||
worker.Buf.readUint32 = function () {
|
||||
worker.Buf.readInt32 = function () {
|
||||
return buf[index++];
|
||||
};
|
||||
|
||||
|
@ -106,7 +106,7 @@ add_test(function test_queryCallForwardStatus_unconditional() {
|
||||
});
|
||||
};
|
||||
|
||||
worker.Buf.readUint32 = function fakeReadUint32() {
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
|
@ -30,7 +30,7 @@ add_test(function test_queryCLIP_provisioned() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
|
||||
worker.Buf.readUint32 = function fakeReadUint32() {
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
@ -58,7 +58,7 @@ add_test(function test_getCLIP_error_generic_failure_invalid_length() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
|
||||
worker.Buf.readUint32 = function fakeReadUint32() {
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
|
@ -85,7 +85,7 @@ add_test(function test_getCLIR_n0_m1() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
|
||||
worker.Buf.readUint32 = function fakeReadUint32() {
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
@ -117,7 +117,7 @@ add_test(function test_getCLIR_error_generic_failure_invalid_length() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
|
||||
worker.Buf.readUint32 = function fakeReadUint32() {
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
|
@ -74,7 +74,7 @@ add_test(function test_queryCallWaiting_success_enabled_true() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
|
||||
worker.Buf.readUint32 = function fakeReadUint32() {
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
@ -104,7 +104,7 @@ add_test(function test_queryCallWaiting_success_enabled_false() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
|
||||
worker.Buf.readUint32 = function fakeReadUint32() {
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
|
@ -492,13 +492,13 @@ add_test(function test_icc_get_card_lock_state_fdn() {
|
||||
|
||||
buf.sendParcel = function () {
|
||||
// Request Type.
|
||||
do_check_eq(this.readUint32(), REQUEST_QUERY_FACILITY_LOCK)
|
||||
do_check_eq(this.readInt32(), REQUEST_QUERY_FACILITY_LOCK)
|
||||
|
||||
// Token : we don't care.
|
||||
this.readUint32();
|
||||
this.readInt32();
|
||||
|
||||
// String Array Length.
|
||||
do_check_eq(this.readUint32(), worker.RILQUIRKS_V5_LEGACY ? 3 : 4);
|
||||
do_check_eq(this.readInt32(), worker.RILQUIRKS_V5_LEGACY ? 3 : 4);
|
||||
|
||||
// Facility.
|
||||
do_check_eq(this.readString(), ICC_CB_FACILITY_FDN);
|
||||
@ -513,7 +513,7 @@ add_test(function test_icc_get_card_lock_state_fdn() {
|
||||
|
||||
if (!worker.RILQUIRKS_V5_LEGACY) {
|
||||
// AID. Ignore because it's from modem.
|
||||
this.readUint32();
|
||||
this.readInt32();
|
||||
}
|
||||
|
||||
run_next_test();
|
||||
@ -759,7 +759,7 @@ add_test(function test_read_pbr() {
|
||||
];
|
||||
|
||||
// Write data size
|
||||
buf.writeUint32(pbr_1.length * 2);
|
||||
buf.writeInt32(pbr_1.length * 2);
|
||||
|
||||
// Write pbr
|
||||
for (let i = 0; i < pbr_1.length; i++) {
|
||||
@ -820,7 +820,7 @@ add_test(function test_read_email() {
|
||||
0x6F, 0x6D, 0x02, 0x23];
|
||||
|
||||
// Write data size
|
||||
buf.writeUint32(email_1.length * 2);
|
||||
buf.writeInt32(email_1.length * 2);
|
||||
|
||||
// Write email
|
||||
for (let i = 0; i < email_1.length; i++) {
|
||||
@ -888,32 +888,32 @@ add_test(function test_update_email() {
|
||||
count++;
|
||||
|
||||
// Request Type.
|
||||
do_check_eq(this.readUint32(), REQUEST_SIM_IO);
|
||||
do_check_eq(this.readInt32(), REQUEST_SIM_IO);
|
||||
|
||||
// Token : we don't care
|
||||
this.readUint32();
|
||||
this.readInt32();
|
||||
|
||||
// command.
|
||||
do_check_eq(this.readUint32(), ICC_COMMAND_UPDATE_RECORD);
|
||||
do_check_eq(this.readInt32(), ICC_COMMAND_UPDATE_RECORD);
|
||||
|
||||
// fileId.
|
||||
do_check_eq(this.readUint32(), fileId);
|
||||
do_check_eq(this.readInt32(), fileId);
|
||||
|
||||
// pathId.
|
||||
do_check_eq(this.readString(),
|
||||
EF_PATH_MF_SIM + EF_PATH_DF_TELECOM + EF_PATH_DF_PHONEBOOK);
|
||||
|
||||
// p1.
|
||||
do_check_eq(this.readUint32(), recordNumber);
|
||||
do_check_eq(this.readInt32(), recordNumber);
|
||||
|
||||
// p2.
|
||||
do_check_eq(this.readUint32(), READ_RECORD_ABSOLUTE_MODE);
|
||||
do_check_eq(this.readInt32(), READ_RECORD_ABSOLUTE_MODE);
|
||||
|
||||
// p3.
|
||||
do_check_eq(this.readUint32(), recordSize);
|
||||
do_check_eq(this.readInt32(), recordSize);
|
||||
|
||||
// data.
|
||||
let strLen = this.readUint32();
|
||||
let strLen = this.readInt32();
|
||||
let email;
|
||||
if (pbr.email.fileType === ICC_USIM_TYPE1_TAG) {
|
||||
email = pduHelper.read8BitUnpackedToString(recordSize);
|
||||
@ -930,7 +930,7 @@ add_test(function test_update_email() {
|
||||
|
||||
if (!worker.RILQUIRKS_V5_LEGACY) {
|
||||
// AID. Ignore because it's from modem.
|
||||
this.readUint32();
|
||||
this.readInt32();
|
||||
}
|
||||
|
||||
if (count == NUM_TESTS) {
|
||||
@ -962,7 +962,7 @@ add_test(function test_read_anr() {
|
||||
0x54, 0xF6, 0xFF, 0xFF];
|
||||
|
||||
// Write data size
|
||||
buf.writeUint32(anr_1.length * 2);
|
||||
buf.writeInt32(anr_1.length * 2);
|
||||
|
||||
// Write anr
|
||||
for (let i = 0; i < anr_1.length; i++) {
|
||||
@ -1029,32 +1029,32 @@ add_test(function test_update_anr() {
|
||||
count++;
|
||||
|
||||
// Request Type.
|
||||
do_check_eq(this.readUint32(), REQUEST_SIM_IO);
|
||||
do_check_eq(this.readInt32(), REQUEST_SIM_IO);
|
||||
|
||||
// Token : we don't care
|
||||
this.readUint32();
|
||||
this.readInt32();
|
||||
|
||||
// command.
|
||||
do_check_eq(this.readUint32(), ICC_COMMAND_UPDATE_RECORD);
|
||||
do_check_eq(this.readInt32(), ICC_COMMAND_UPDATE_RECORD);
|
||||
|
||||
// fileId.
|
||||
do_check_eq(this.readUint32(), fileId);
|
||||
do_check_eq(this.readInt32(), fileId);
|
||||
|
||||
// pathId.
|
||||
do_check_eq(this.readString(),
|
||||
EF_PATH_MF_SIM + EF_PATH_DF_TELECOM + EF_PATH_DF_PHONEBOOK);
|
||||
|
||||
// p1.
|
||||
do_check_eq(this.readUint32(), recordNumber);
|
||||
do_check_eq(this.readInt32(), recordNumber);
|
||||
|
||||
// p2.
|
||||
do_check_eq(this.readUint32(), READ_RECORD_ABSOLUTE_MODE);
|
||||
do_check_eq(this.readInt32(), READ_RECORD_ABSOLUTE_MODE);
|
||||
|
||||
// p3.
|
||||
do_check_eq(this.readUint32(), recordSize);
|
||||
do_check_eq(this.readInt32(), recordSize);
|
||||
|
||||
// data.
|
||||
let strLen = this.readUint32();
|
||||
let strLen = this.readInt32();
|
||||
// EF_AAS, ignore.
|
||||
pduHelper.readHexOctet();
|
||||
do_check_eq(pduHelper.readNumberWithLength(), expectedANR);
|
||||
@ -1073,7 +1073,7 @@ add_test(function test_update_anr() {
|
||||
|
||||
if (!worker.RILQUIRKS_V5_LEGACY) {
|
||||
// AID. Ignore because it's from modem.
|
||||
this.readUint32();
|
||||
this.readInt32();
|
||||
}
|
||||
|
||||
if (count == NUM_TESTS) {
|
||||
@ -1103,7 +1103,7 @@ add_test(function test_read_iap() {
|
||||
let iap_1 = [0x01, 0x02];
|
||||
|
||||
// Write data size/
|
||||
buf.writeUint32(iap_1.length * 2);
|
||||
buf.writeInt32(iap_1.length * 2);
|
||||
|
||||
// Write iap.
|
||||
for (let i = 0; i < iap_1.length; i++) {
|
||||
@ -1172,32 +1172,32 @@ add_test(function test_update_iap() {
|
||||
function do_test(expectedIAP) {
|
||||
buf.sendParcel = function () {
|
||||
// Request Type.
|
||||
do_check_eq(this.readUint32(), REQUEST_SIM_IO);
|
||||
do_check_eq(this.readInt32(), REQUEST_SIM_IO);
|
||||
|
||||
// Token : we don't care
|
||||
this.readUint32();
|
||||
this.readInt32();
|
||||
|
||||
// command.
|
||||
do_check_eq(this.readUint32(), ICC_COMMAND_UPDATE_RECORD);
|
||||
do_check_eq(this.readInt32(), ICC_COMMAND_UPDATE_RECORD);
|
||||
|
||||
// fileId.
|
||||
do_check_eq(this.readUint32(), fileId);
|
||||
do_check_eq(this.readInt32(), fileId);
|
||||
|
||||
// pathId.
|
||||
do_check_eq(this.readString(),
|
||||
EF_PATH_MF_SIM + EF_PATH_DF_TELECOM + EF_PATH_DF_PHONEBOOK);
|
||||
|
||||
// p1.
|
||||
do_check_eq(this.readUint32(), recordNumber);
|
||||
do_check_eq(this.readInt32(), recordNumber);
|
||||
|
||||
// p2.
|
||||
do_check_eq(this.readUint32(), READ_RECORD_ABSOLUTE_MODE);
|
||||
do_check_eq(this.readInt32(), READ_RECORD_ABSOLUTE_MODE);
|
||||
|
||||
// p3.
|
||||
do_check_eq(this.readUint32(), recordSize);
|
||||
do_check_eq(this.readInt32(), recordSize);
|
||||
|
||||
// data.
|
||||
let strLen = this.readUint32();
|
||||
let strLen = this.readInt32();
|
||||
for (let i = 0; i < recordSize; i++) {
|
||||
do_check_eq(expectedIAP[i], pduHelper.readHexOctet());
|
||||
}
|
||||
@ -1208,7 +1208,7 @@ add_test(function test_update_iap() {
|
||||
|
||||
if (!worker.RILQUIRKS_V5_LEGACY) {
|
||||
// AID. Ignore because it's from modem.
|
||||
this.readUint32();
|
||||
this.readInt32();
|
||||
}
|
||||
|
||||
run_next_test();
|
||||
@ -1246,28 +1246,28 @@ add_test(function test_update_adn_like() {
|
||||
|
||||
buf.sendParcel = function () {
|
||||
// Request Type.
|
||||
do_check_eq(this.readUint32(), REQUEST_SIM_IO);
|
||||
do_check_eq(this.readInt32(), REQUEST_SIM_IO);
|
||||
|
||||
// Token : we don't care
|
||||
this.readUint32();
|
||||
this.readInt32();
|
||||
|
||||
// command.
|
||||
do_check_eq(this.readUint32(), ICC_COMMAND_UPDATE_RECORD);
|
||||
do_check_eq(this.readInt32(), ICC_COMMAND_UPDATE_RECORD);
|
||||
|
||||
// fileId.
|
||||
do_check_eq(this.readUint32(), fileId);
|
||||
do_check_eq(this.readInt32(), fileId);
|
||||
|
||||
// pathId.
|
||||
do_check_eq(this.readString(), EF_PATH_MF_SIM + EF_PATH_DF_TELECOM);
|
||||
|
||||
// p1.
|
||||
do_check_eq(this.readUint32(), 1);
|
||||
do_check_eq(this.readInt32(), 1);
|
||||
|
||||
// p2.
|
||||
do_check_eq(this.readUint32(), READ_RECORD_ABSOLUTE_MODE);
|
||||
do_check_eq(this.readInt32(), READ_RECORD_ABSOLUTE_MODE);
|
||||
|
||||
// p3.
|
||||
do_check_eq(this.readUint32(), 0x20);
|
||||
do_check_eq(this.readInt32(), 0x20);
|
||||
|
||||
// data.
|
||||
let contact = pdu.readAlphaIdDiallingNumber(0x20);
|
||||
@ -1283,7 +1283,7 @@ add_test(function test_update_adn_like() {
|
||||
|
||||
if (!worker.RILQUIRKS_V5_LEGACY) {
|
||||
// AID. Ignore because it's from modem.
|
||||
this.readUint32();
|
||||
this.readInt32();
|
||||
}
|
||||
|
||||
if (fileId == ICC_EF_FDN) {
|
||||
@ -1313,7 +1313,7 @@ add_test(function test_find_free_record_id() {
|
||||
|
||||
function writeRecord (record) {
|
||||
// Write data size
|
||||
buf.writeUint32(record.length * 2);
|
||||
buf.writeInt32(record.length * 2);
|
||||
|
||||
for (let i = 0; i < record.length; i++) {
|
||||
pduHelper.writeHexOctet(record[i]);
|
||||
@ -1733,10 +1733,10 @@ add_test(function test_set_icc_card_lock_facility_lock() {
|
||||
function do_test(aLock, aPassword, aEnabled) {
|
||||
buf.sendParcel = function fakeSendParcel () {
|
||||
// Request Type.
|
||||
do_check_eq(this.readUint32(), REQUEST_SET_FACILITY_LOCK);
|
||||
do_check_eq(this.readInt32(), REQUEST_SET_FACILITY_LOCK);
|
||||
|
||||
// Token : we don't care
|
||||
this.readUint32();
|
||||
this.readInt32();
|
||||
|
||||
let parcel = this.readStringList();
|
||||
do_check_eq(parcel.length, 5);
|
||||
@ -1783,14 +1783,14 @@ add_test(function test_unlock_card_lock_corporateLocked() {
|
||||
function do_test(aLock, aPassword) {
|
||||
buf.sendParcel = function fakeSendParcel () {
|
||||
// Request Type.
|
||||
do_check_eq(this.readUint32(), REQUEST_ENTER_NETWORK_DEPERSONALIZATION_CODE);
|
||||
do_check_eq(this.readInt32(), REQUEST_ENTER_NETWORK_DEPERSONALIZATION_CODE);
|
||||
|
||||
// Token : we don't care
|
||||
this.readUint32();
|
||||
this.readInt32();
|
||||
|
||||
let lockType = GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[aLock];
|
||||
// Lock Type
|
||||
do_check_eq(this.readUint32(), lockType);
|
||||
do_check_eq(this.readInt32(), lockType);
|
||||
|
||||
// Pin/Puk.
|
||||
do_check_eq(this.readString(), aPassword);
|
||||
@ -1867,7 +1867,7 @@ add_test(function test_reading_ad_and_parsing_mcc_mnc() {
|
||||
}
|
||||
|
||||
// Write data size
|
||||
buf.writeUint32(ad.length * 2);
|
||||
buf.writeInt32(ad.length * 2);
|
||||
|
||||
// Write data
|
||||
for (let i = 0; i < ad.length; i++) {
|
||||
|
@ -435,7 +435,7 @@ add_test(function test_sendMMI_call_forwarding_interrogation() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
|
||||
worker.Buf.readUint32 = function fakeReadUint32() {
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
@ -477,7 +477,7 @@ add_test(function test_sendMMI_call_forwarding_interrogation_no_rules() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
|
||||
worker.Buf.readUint32 = function fakeReadUint32() {
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return 0;
|
||||
};
|
||||
|
||||
@ -771,7 +771,7 @@ add_test(function test_sendMMI_call_barring_BAIC_interrogation_voice() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
|
||||
worker.Buf.readUint32List = function fakeReadUint32List() {
|
||||
worker.Buf.readInt32List = function fakeReadUint32List() {
|
||||
return [1];
|
||||
};
|
||||
|
||||
@ -954,7 +954,7 @@ add_test(function test_sendMMI_call_waiting_interrogation() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
|
||||
worker.Buf.readUint32 = function fakeReadUint32() {
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
|
@ -82,7 +82,7 @@ add_test(function test_read_cdmahome() {
|
||||
let cdmaHome = [0xc1, 0x34, 0xff, 0xff, 0x00];
|
||||
|
||||
// Write data size
|
||||
buf.writeUint32(cdmaHome.length * 2);
|
||||
buf.writeInt32(cdmaHome.length * 2);
|
||||
|
||||
// Write cdma home file.
|
||||
for (let i = 0; i < cdmaHome.length; i++) {
|
||||
@ -128,7 +128,7 @@ add_test(function test_read_cdmaspn() {
|
||||
function testReadSpn(file, expectedSpn, expectedDisplayCondition) {
|
||||
io.loadTransparentEF = function fakeLoadTransparentEF(options) {
|
||||
// Write data size
|
||||
buf.writeUint32(file.length * 2);
|
||||
buf.writeInt32(file.length * 2);
|
||||
|
||||
// Write file.
|
||||
for (let i = 0; i < file.length; i++) {
|
||||
|
@ -92,16 +92,16 @@ add_test(function test_stk_terminal_response() {
|
||||
|
||||
buf.sendParcel = function () {
|
||||
// Type
|
||||
do_check_eq(this.readUint32(), REQUEST_STK_SEND_TERMINAL_RESPONSE);
|
||||
do_check_eq(this.readInt32(), REQUEST_STK_SEND_TERMINAL_RESPONSE);
|
||||
|
||||
// Token : we don't care
|
||||
this.readUint32();
|
||||
this.readInt32();
|
||||
|
||||
// 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);
|
||||
do_check_eq(this.readInt32(), 44);
|
||||
|
||||
// Command Details, Type-Length-Value
|
||||
do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_COMMAND_DETAILS |
|
||||
@ -748,16 +748,16 @@ add_test(function test_stk_event_download_location_status() {
|
||||
|
||||
buf.sendParcel = function () {
|
||||
// Type
|
||||
do_check_eq(this.readUint32(), REQUEST_STK_SEND_ENVELOPE_COMMAND);
|
||||
do_check_eq(this.readInt32(), REQUEST_STK_SEND_ENVELOPE_COMMAND);
|
||||
|
||||
// Token : we don't care
|
||||
this.readUint32();
|
||||
this.readInt32();
|
||||
|
||||
// Data Size, 42 = 2 * (2 + TLV_DEVICE_ID_SIZE(4) +
|
||||
// TLV_EVENT_LIST_SIZE(3) +
|
||||
// TLV_LOCATION_STATUS_SIZE(3) +
|
||||
// TLV_LOCATION_INFO_GSM_SIZE(9))
|
||||
do_check_eq(this.readUint32(), 42);
|
||||
do_check_eq(this.readInt32(), 42);
|
||||
|
||||
// BER tag
|
||||
do_check_eq(pduHelper.readHexOctet(), BER_EVENT_DOWNLOAD_TAG);
|
||||
@ -830,15 +830,15 @@ add_test(function test_stk_event_download_language_selection() {
|
||||
|
||||
buf.sendParcel = function () {
|
||||
// Type
|
||||
do_check_eq(this.readUint32(), REQUEST_STK_SEND_ENVELOPE_COMMAND);
|
||||
do_check_eq(this.readInt32(), REQUEST_STK_SEND_ENVELOPE_COMMAND);
|
||||
|
||||
// Token : we don't care
|
||||
this.readUint32();
|
||||
this.readInt32();
|
||||
|
||||
// Data Size, 26 = 2 * (2 + TLV_DEVICE_ID_SIZE(4) +
|
||||
// TLV_EVENT_LIST_SIZE(3) +
|
||||
// TLV_LANGUAGE(4))
|
||||
do_check_eq(this.readUint32(), 26);
|
||||
do_check_eq(this.readInt32(), 26);
|
||||
|
||||
// BER tag
|
||||
do_check_eq(pduHelper.readHexOctet(), BER_EVENT_DOWNLOAD_TAG);
|
||||
@ -888,13 +888,13 @@ add_test(function test_stk_event_download_user_activity() {
|
||||
|
||||
buf.sendParcel = function () {
|
||||
// Type
|
||||
do_check_eq(this.readUint32(), REQUEST_STK_SEND_ENVELOPE_COMMAND);
|
||||
do_check_eq(this.readInt32(), REQUEST_STK_SEND_ENVELOPE_COMMAND);
|
||||
|
||||
// Token : we don't care
|
||||
this.readUint32();
|
||||
this.readInt32();
|
||||
|
||||
// Data Size, 18 = 2 * (2 + TLV_DEVICE_ID_SIZE(4) + TLV_EVENT_LIST_SIZE(3))
|
||||
do_check_eq(this.readUint32(), 18);
|
||||
do_check_eq(this.readInt32(), 18);
|
||||
|
||||
// BER tag
|
||||
do_check_eq(pduHelper.readHexOctet(), BER_EVENT_DOWNLOAD_TAG);
|
||||
@ -936,13 +936,13 @@ add_test(function test_stk_event_download_idle_screen_available() {
|
||||
|
||||
buf.sendParcel = function () {
|
||||
// Type
|
||||
do_check_eq(this.readUint32(), REQUEST_STK_SEND_ENVELOPE_COMMAND);
|
||||
do_check_eq(this.readInt32(), REQUEST_STK_SEND_ENVELOPE_COMMAND);
|
||||
|
||||
// Token : we don't care
|
||||
this.readUint32();
|
||||
this.readInt32();
|
||||
|
||||
// Data Size, 18 = 2 * (2 + TLV_DEVICE_ID_SIZE(4) + TLV_EVENT_LIST_SIZE(3))
|
||||
do_check_eq(this.readUint32(), 18);
|
||||
do_check_eq(this.readInt32(), 18);
|
||||
|
||||
// BER tag
|
||||
do_check_eq(pduHelper.readHexOctet(), BER_EVENT_DOWNLOAD_TAG);
|
||||
|
@ -72,7 +72,7 @@ add_test(function test_queryVoicePrivacyMode_success_enabled_true() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
|
||||
worker.Buf.readUint32List = function fakeReadUint32List() {
|
||||
worker.Buf.readInt32List = function fakeReadUint32List() {
|
||||
return [1];
|
||||
};
|
||||
|
||||
@ -95,7 +95,7 @@ add_test(function test_queryVoicePrivacyMode_success_enabled_false() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
|
||||
worker.Buf.readUint32List = function fakeReadUint32List() {
|
||||
worker.Buf.readInt32List = function fakeReadUint32List() {
|
||||
return [0];
|
||||
};
|
||||
|
||||
|
@ -262,22 +262,22 @@ let Buf = {
|
||||
return this.readUint8() | this.readUint8() << 8;
|
||||
},
|
||||
|
||||
readUint32: function readUint32() {
|
||||
readInt32: function readInt32() {
|
||||
return this.readUint8() | this.readUint8() << 8 |
|
||||
this.readUint8() << 16 | this.readUint8() << 24;
|
||||
},
|
||||
|
||||
readUint32List: function readUint32List() {
|
||||
let length = this.readUint32();
|
||||
readInt32List: function readInt32List() {
|
||||
let length = this.readInt32();
|
||||
let ints = [];
|
||||
for (let i = 0; i < length; i++) {
|
||||
ints.push(this.readUint32());
|
||||
ints.push(this.readInt32());
|
||||
}
|
||||
return ints;
|
||||
},
|
||||
|
||||
readString: function readString() {
|
||||
let string_len = this.readUint32();
|
||||
let string_len = this.readInt32();
|
||||
if (string_len < 0 || string_len >= this.INT32_MAX) {
|
||||
return null;
|
||||
}
|
||||
@ -293,7 +293,7 @@ let Buf = {
|
||||
},
|
||||
|
||||
readStringList: function readStringList() {
|
||||
let num_strings = this.readUint32();
|
||||
let num_strings = this.readInt32();
|
||||
let strings = [];
|
||||
for (let i = 0; i < num_strings; i++) {
|
||||
strings.push(this.readString());
|
||||
@ -349,7 +349,7 @@ let Buf = {
|
||||
this.writeUint8((value >> 8) & 0xff);
|
||||
},
|
||||
|
||||
writeUint32: function writeUint32(value) {
|
||||
writeInt32: function writeInt32(value) {
|
||||
this.writeUint8(value & 0xff);
|
||||
this.writeUint8((value >> 8) & 0xff);
|
||||
this.writeUint8((value >> 16) & 0xff);
|
||||
@ -358,10 +358,10 @@ let Buf = {
|
||||
|
||||
writeString: function writeString(value) {
|
||||
if (value == null) {
|
||||
this.writeUint32(-1);
|
||||
this.writeInt32(-1);
|
||||
return;
|
||||
}
|
||||
this.writeUint32(value.length);
|
||||
this.writeInt32(value.length);
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
this.writeUint16(value.charCodeAt(i));
|
||||
}
|
||||
@ -372,7 +372,7 @@ let Buf = {
|
||||
},
|
||||
|
||||
writeStringList: function writeStringList(strings) {
|
||||
this.writeUint32(strings.length);
|
||||
this.writeInt32(strings.length);
|
||||
for (let i = 0; i < strings.length; i++) {
|
||||
this.writeString(strings[i]);
|
||||
}
|
||||
@ -587,7 +587,7 @@ let Buf = {
|
||||
* may call multiple read functions to extract data from the incoming buffer.
|
||||
*/
|
||||
//processParcel: function processParcel() {
|
||||
// let something = this.readUint32();
|
||||
// let something = this.readInt32();
|
||||
// ...
|
||||
//},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user