зеркало из https://github.com/mozilla/gecko-dev.git
Bug 960894 - 4/4: fix existing ril_worker test cases. r=hsinyi,yoshi
This commit is contained in:
Родитель
8c028fb056
Коммит
f493b5c7bc
|
@ -43,15 +43,11 @@ function newWorker(custom_ns) {
|
|||
onmessage: undefined,
|
||||
onerror: undefined,
|
||||
|
||||
CLIENT_ID: 0,
|
||||
DEBUG: true
|
||||
};
|
||||
// The 'self' variable in a worker points to the worker's own namespace.
|
||||
worker_ns.self = worker_ns;
|
||||
|
||||
// systemlibs.js utilizes ctypes for loading native libraries.
|
||||
Cu.import("resource://gre/modules/ctypes.jsm", worker_ns);
|
||||
|
||||
// Copy the custom definitions over.
|
||||
for (let key in custom_ns) {
|
||||
worker_ns[key] = custom_ns[key];
|
||||
|
@ -76,6 +72,9 @@ function newWorker(custom_ns) {
|
|||
// Load the RIL worker itself.
|
||||
worker_ns.importScripts("ril_worker.js");
|
||||
|
||||
// Register at least one client.
|
||||
worker_ns.ContextPool.registerClient({ clientId: 0 });
|
||||
|
||||
return worker_ns;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,18 +15,19 @@ const NEW_PIN = "1234";
|
|||
*/
|
||||
function newUint8Worker() {
|
||||
let worker = newWorker();
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let index = 0; // index for read
|
||||
let buf = [];
|
||||
|
||||
worker.Buf.writeUint8 = function(value) {
|
||||
context.Buf.writeUint8 = function(value) {
|
||||
buf.push(value);
|
||||
};
|
||||
|
||||
worker.Buf.readUint8 = function() {
|
||||
context.Buf.readUint8 = function() {
|
||||
return buf[index++];
|
||||
};
|
||||
|
||||
worker.Buf.seekIncoming = function(offset) {
|
||||
context.Buf.seekIncoming = function(offset) {
|
||||
index += offset;
|
||||
};
|
||||
|
||||
|
@ -37,7 +38,8 @@ function newUint8Worker() {
|
|||
|
||||
add_test(function test_change_call_barring_password() {
|
||||
let worker = newUint8Worker();
|
||||
let buf = worker.Buf;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let buf = context.Buf;
|
||||
|
||||
function do_test(facility, pin, newPin) {
|
||||
buf.sendParcel = function fakeSendParcel () {
|
||||
|
@ -55,7 +57,7 @@ add_test(function test_change_call_barring_password() {
|
|||
};
|
||||
|
||||
let options = {facility: facility, pin: pin, newPin: newPin};
|
||||
worker.RIL.changeCallBarringPassword(options);
|
||||
context.RIL.changeCallBarringPassword(options);
|
||||
}
|
||||
|
||||
do_test(ICC_CB_FACILITY_BA_ALL, PIN, NEW_PIN);
|
||||
|
@ -73,15 +75,16 @@ add_test(function test_check_change_call_barring_password_result() {
|
|||
}
|
||||
});
|
||||
|
||||
worker.RIL.changeCallBarringPassword =
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
context.RIL.changeCallBarringPassword =
|
||||
function fakeChangeCallBarringPassword(options) {
|
||||
barringPasswordOptions = options;
|
||||
worker.RIL[REQUEST_CHANGE_BARRING_PASSWORD](0, {
|
||||
context.RIL[REQUEST_CHANGE_BARRING_PASSWORD](0, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
}
|
||||
|
||||
worker.RIL.changeCallBarringPassword({pin: PIN, newPin: NEW_PIN});
|
||||
context.RIL.changeCallBarringPassword({pin: PIN, newPin: NEW_PIN});
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
|
|
@ -31,15 +31,15 @@ function add_test_incoming_parcel(parcel, handler) {
|
|||
[0, 0, 0, 0]);
|
||||
}
|
||||
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
// supports only requests less or equal than UINT8_MAX(255).
|
||||
let buf = worker.Buf;
|
||||
let buf = context.Buf;
|
||||
let request = parcel[buf.PARCEL_SIZE_SIZE + buf.UINT32_SIZE];
|
||||
worker.RIL[request] = function ril_request_handler() {
|
||||
handler(worker);
|
||||
worker.postMessage();
|
||||
context.RIL[request] = function ril_request_handler() {
|
||||
handler.apply(this, arguments);
|
||||
};
|
||||
|
||||
worker.onRILMessage(parcel);
|
||||
worker.onRILMessage(0, parcel);
|
||||
|
||||
// end of incoming parcel's trip, let's do next test.
|
||||
run_next_test();
|
||||
|
@ -48,28 +48,30 @@ function add_test_incoming_parcel(parcel, handler) {
|
|||
|
||||
// Test normal parcel handling.
|
||||
add_test_incoming_parcel(null,
|
||||
function test_normal_parcel_handling(worker) {
|
||||
function test_normal_parcel_handling() {
|
||||
let self = this;
|
||||
do_check_throws(function normal_handler() {
|
||||
// reads exactly the same size, should not throw anything.
|
||||
worker.Buf.readInt32();
|
||||
self.context.Buf.readInt32();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// Test parcel under read.
|
||||
add_test_incoming_parcel(null,
|
||||
function test_parcel_under_read(worker) {
|
||||
function test_parcel_under_read() {
|
||||
let self = this;
|
||||
do_check_throws(function under_read_handler() {
|
||||
// reads less than parcel size, should not throw.
|
||||
worker.Buf.readUint16();
|
||||
self.context.Buf.readUint16();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// Test parcel over read.
|
||||
add_test_incoming_parcel(null,
|
||||
function test_parcel_over_read(worker) {
|
||||
let buf = worker.Buf;
|
||||
function test_parcel_over_read() {
|
||||
let buf = this.context.Buf;
|
||||
|
||||
// read all data available
|
||||
while (buf.readAvailable > 0) {
|
||||
|
@ -94,8 +96,9 @@ add_test(function test_incoming_parcel_buffer_overwritten() {
|
|||
}
|
||||
});
|
||||
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
// A convenient alias.
|
||||
let buf = worker.Buf;
|
||||
let buf = context.Buf;
|
||||
|
||||
// Allocate an array of specified size and set each of its elements to value.
|
||||
function calloc(length, value) {
|
||||
|
@ -108,7 +111,7 @@ add_test(function test_incoming_parcel_buffer_overwritten() {
|
|||
|
||||
// Do nothing in handleParcel().
|
||||
let request = worker.REQUEST_VOICE_REGISTRATION_STATE;
|
||||
worker.RIL[request] = null;
|
||||
context.RIL[request] = null;
|
||||
|
||||
// Prepare two parcels, whose sizes are both smaller than the incoming buffer
|
||||
// size but larger when combined, to trigger the bug.
|
||||
|
@ -128,7 +131,7 @@ add_test(function test_incoming_parcel_buffer_overwritten() {
|
|||
|
||||
// First, send an incomplete pA and verifies related data pointer:
|
||||
let p1 = pA.subarray(0, pA.length - 1);
|
||||
worker.onRILMessage(p1);
|
||||
worker.onRILMessage(0, p1);
|
||||
// The parcel should not have been processed.
|
||||
do_check_eq(buf.readAvailable, 0);
|
||||
// buf.currentParcelSize should have been set because incoming data has more
|
||||
|
@ -144,7 +147,7 @@ add_test(function test_incoming_parcel_buffer_overwritten() {
|
|||
let p2 = new Uint8Array(1 + pB.length);
|
||||
p2.set(pA.subarray(pA.length - 1), 0);
|
||||
p2.set(pB, 1);
|
||||
worker.onRILMessage(p2);
|
||||
worker.onRILMessage(0, p2);
|
||||
// The parcels should have been both consumed.
|
||||
do_check_eq(buf.readAvailable, 0);
|
||||
// No parcel data remains.
|
||||
|
@ -160,8 +163,8 @@ add_test(function test_incoming_parcel_buffer_overwritten() {
|
|||
|
||||
// Test Buf.readUint8Array.
|
||||
add_test_incoming_parcel(null,
|
||||
function test_buf_readUint8Array(worker) {
|
||||
let buf = worker.Buf;
|
||||
function test_buf_readUint8Array() {
|
||||
let buf = this.context.Buf;
|
||||
|
||||
let u8array = buf.readUint8Array(1);
|
||||
do_check_eq(u8array instanceof Uint8Array, true);
|
||||
|
|
|
@ -23,15 +23,16 @@ function newWorkerWithParcel(parcelBuf) {
|
|||
let index = 0; // index for read
|
||||
let buf = parcelBuf;
|
||||
|
||||
worker.Buf.readUint8 = function() {
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
context.Buf.readUint8 = function() {
|
||||
return buf[index++];
|
||||
};
|
||||
|
||||
worker.Buf.readUint16 = function() {
|
||||
context.Buf.readUint16 = function() {
|
||||
return buf[index++];
|
||||
};
|
||||
|
||||
worker.Buf.readInt32 = function() {
|
||||
context.Buf.readInt32 = function() {
|
||||
return buf[index++];
|
||||
};
|
||||
|
||||
|
@ -50,7 +51,8 @@ add_test(function test_display() {
|
|||
0x09, // length: 9
|
||||
0x54, 0x65, 0x73, 0x74, 0x20, 0x49, 0x6E, 0x66,
|
||||
0x6F, 0x00]);
|
||||
let helper = worker.CdmaPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.CdmaPDUHelper;
|
||||
let record = helper.decodeInformationRecord();
|
||||
|
||||
do_check_eq(record.display, "Test Info");
|
||||
|
@ -72,7 +74,8 @@ add_test(function test_extended_display() {
|
|||
0x9B, // Text
|
||||
0x09, 0x54, 0x65, 0x73, 0x74, 0x20, 0x49, 0x6E,
|
||||
0x66, 0x6F, 0x00]);
|
||||
let helper = worker.CdmaPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.CdmaPDUHelper;
|
||||
let record = helper.decodeInformationRecord();
|
||||
|
||||
do_check_eq(record.extendedDisplay.indicator, 1);
|
||||
|
@ -103,7 +106,8 @@ add_test(function test_mixed() {
|
|||
0x9B, // Text
|
||||
0x09, 0x54, 0x65, 0x73, 0x74, 0x20, 0x49, 0x6E,
|
||||
0x66, 0x6F, 0x00]);
|
||||
let helper = worker.CdmaPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.CdmaPDUHelper;
|
||||
let record = helper.decodeInformationRecord();
|
||||
|
||||
do_check_eq(record.display, "Test Info");
|
||||
|
|
|
@ -33,13 +33,14 @@ add_test(function test_ril_worker_GsmPDUHelper_readCbDataCodingScheme() {
|
|||
}
|
||||
});
|
||||
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
function test_dcs(dcs, encoding, language, hasLanguageIndicator, messageClass) {
|
||||
worker.Buf.readUint8 = function() {
|
||||
context.Buf.readUint8 = function() {
|
||||
return dcs;
|
||||
};
|
||||
|
||||
let msg = {};
|
||||
worker.GsmPDUHelper.readCbDataCodingScheme(msg);
|
||||
context.GsmPDUHelper.readCbDataCodingScheme(msg);
|
||||
|
||||
do_check_eq(msg.dcs, dcs);
|
||||
do_check_eq(msg.encoding, encoding);
|
||||
|
@ -49,12 +50,12 @@ add_test(function test_ril_worker_GsmPDUHelper_readCbDataCodingScheme() {
|
|||
}
|
||||
|
||||
function test_dcs_throws(dcs) {
|
||||
worker.Buf.readUint8 = function() {
|
||||
context.Buf.readUint8 = function() {
|
||||
return dcs;
|
||||
};
|
||||
|
||||
do_check_throws(function() {
|
||||
worker.GsmPDUHelper.readCbDataCodingScheme({});
|
||||
context.GsmPDUHelper.readCbDataCodingScheme({});
|
||||
}, "Unsupported CBS data coding scheme: " + dcs);
|
||||
}
|
||||
|
||||
|
@ -142,12 +143,13 @@ add_test(function test_ril_worker_GsmPDUHelper_readGsmCbData() {
|
|||
}
|
||||
});
|
||||
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
function test_data(options, expected) {
|
||||
let readIndex = 0;
|
||||
worker.Buf.readUint8 = function() {
|
||||
context.Buf.readUint8 = function() {
|
||||
return options[3][readIndex++];
|
||||
};
|
||||
worker.Buf.readUint8Array = function(length) {
|
||||
context.Buf.readUint8Array = function(length) {
|
||||
let array = new Uint8Array(length);
|
||||
for (let i = 0; i < length; i++) {
|
||||
array[i] = this.readUint8();
|
||||
|
@ -160,7 +162,7 @@ add_test(function test_ril_worker_GsmPDUHelper_readGsmCbData() {
|
|||
language: options[1],
|
||||
hasLanguageIndicator: options[2]
|
||||
};
|
||||
worker.GsmPDUHelper.readGsmCbData(msg, options[3].length);
|
||||
context.GsmPDUHelper.readGsmCbData(msg, options[3].length);
|
||||
|
||||
do_check_eq(msg.body, expected[0]);
|
||||
do_check_eq(msg.data == null, expected[1] == null);
|
||||
|
@ -218,7 +220,8 @@ add_test(function test_ril_worker__checkCellBroadcastMMISettable() {
|
|||
}
|
||||
});
|
||||
|
||||
let ril = worker.RIL;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let ril = context.RIL;
|
||||
|
||||
function test(from, to, expected) {
|
||||
do_check_eq(expected, ril._checkCellBroadcastMMISettable(from, to));
|
||||
|
@ -268,7 +271,8 @@ add_test(function test_ril_worker__mergeCellBroadcastConfigs() {
|
|||
}
|
||||
});
|
||||
|
||||
let ril = worker.RIL;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let ril = context.RIL;
|
||||
|
||||
function test(olist, from, to, expected) {
|
||||
let result = ril._mergeCellBroadcastConfigs(olist, from, to);
|
||||
|
|
|
@ -16,27 +16,28 @@ add_test(function test_ril_worker_cellbroadcast_activate() {
|
|||
// Do nothing
|
||||
}
|
||||
});
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
let parcelTypes = [];
|
||||
let org_newParcel = worker.Buf.newParcel;
|
||||
worker.Buf.newParcel = function(type, options) {
|
||||
let org_newParcel = context.Buf.newParcel;
|
||||
context.Buf.newParcel = function(type, options) {
|
||||
parcelTypes.push(type);
|
||||
org_newParcel.apply(this, arguments);
|
||||
};
|
||||
|
||||
function setup(isCdma) {
|
||||
worker.RIL._isCdma = isCdma;
|
||||
worker.RIL.cellBroadcastDisabled = false;
|
||||
worker.RIL.mergedCellBroadcastConfig = [1, 2, 4, 7]; // 1, 4-6
|
||||
context.RIL._isCdma = isCdma;
|
||||
context.RIL.cellBroadcastDisabled = false;
|
||||
context.RIL.mergedCellBroadcastConfig = [1, 2, 4, 7]; // 1, 4-6
|
||||
parcelTypes = [];
|
||||
}
|
||||
|
||||
function test(isCdma, expectedRequest) {
|
||||
setup(isCdma);
|
||||
worker.RIL.setCellBroadcastDisabled({disabled: true});
|
||||
context.RIL.setCellBroadcastDisabled({disabled: true});
|
||||
// Makesure that request parcel is sent out.
|
||||
do_check_neq(parcelTypes.indexOf(expectedRequest), -1);
|
||||
do_check_eq(worker.RIL.cellBroadcastDisabled, true);
|
||||
do_check_eq(context.RIL.cellBroadcastDisabled, true);
|
||||
}
|
||||
|
||||
test(false, REQUEST_GSM_SMS_BROADCAST_ACTIVATION);
|
||||
|
@ -55,6 +56,7 @@ add_test(function test_ril_worker_cellbroadcast_config() {
|
|||
// Do nothing
|
||||
}
|
||||
});
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
function U32ArrayFromParcelArray(pa) {
|
||||
do_print(pa);
|
||||
|
@ -82,8 +84,8 @@ add_test(function test_ril_worker_cellbroadcast_config() {
|
|||
do_check_eq(u32Parcel.slice(3).toString(), expected);
|
||||
};
|
||||
|
||||
worker.RIL._isCdma = isCdma;
|
||||
worker.RIL.setSmsBroadcastConfig(configs);
|
||||
context.RIL._isCdma = isCdma;
|
||||
context.RIL.setSmsBroadcastConfig(configs);
|
||||
|
||||
// Makesure that request parcel is sent out.
|
||||
do_check_true(found);
|
||||
|
@ -113,12 +115,13 @@ add_test(function test_ril_worker_cellbroadcast_merge_config() {
|
|||
// Do nothing
|
||||
}
|
||||
});
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
function test(isCdma, configs, expected) {
|
||||
worker.RIL._isCdma = isCdma;
|
||||
worker.RIL.cellBroadcastConfigs = configs;
|
||||
worker.RIL._mergeAllCellBroadcastConfigs();
|
||||
do_check_eq(worker.RIL.mergedCellBroadcastConfig.toString(), expected);
|
||||
context.RIL._isCdma = isCdma;
|
||||
context.RIL.cellBroadcastConfigs = configs;
|
||||
context.RIL._mergeAllCellBroadcastConfigs();
|
||||
do_check_eq(context.RIL.mergedCellBroadcastConfig.toString(), expected);
|
||||
}
|
||||
|
||||
let configs = {
|
||||
|
|
|
@ -16,7 +16,8 @@ function toaFromString(number) {
|
|||
// Do nothing
|
||||
}
|
||||
});
|
||||
return worker.RIL._toaFromString(number);
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
return context.RIL._toaFromString(number);
|
||||
}
|
||||
|
||||
add_test(function test_toaFromString_empty() {
|
||||
|
@ -73,14 +74,15 @@ function _getWorker() {
|
|||
add_test(function test_setCallForward_unconditional() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.RIL.setCallForward = function fakeSetCallForward(options) {
|
||||
worker.RIL[REQUEST_SET_CALL_FORWARD](0, {
|
||||
context.RIL.setCallForward = function fakeSetCallForward(options) {
|
||||
context.RIL[REQUEST_SET_CALL_FORWARD](0, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.setCallForward({
|
||||
context.RIL.setCallForward({
|
||||
action: Ci.nsIDOMMozMobileCFInfo.CALL_FORWARD_ACTION_REGISTRATION,
|
||||
reason: Ci.nsIDOMMozMobileCFInfo.CALL_FORWARD_REASON_UNCONDITIONAL,
|
||||
serviceClass: ICC_SERVICE_CLASS_VOICE,
|
||||
|
@ -99,23 +101,24 @@ add_test(function test_setCallForward_unconditional() {
|
|||
add_test(function test_queryCallForwardStatus_unconditional() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.RIL.setCallForward = function fakeSetCallForward(options) {
|
||||
worker.RIL[REQUEST_SET_CALL_FORWARD](0, {
|
||||
context.RIL.setCallForward = function fakeSetCallForward(options) {
|
||||
context.RIL[REQUEST_SET_CALL_FORWARD](0, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
context.Buf.readInt32 = function fakeReadUint32() {
|
||||
return context.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
worker.Buf.readString = function fakeReadString() {
|
||||
context.Buf.readString = function fakeReadString() {
|
||||
return "+34666222333";
|
||||
};
|
||||
|
||||
worker.RIL.queryCallForwardStatus = function fakeQueryCallForward(options) {
|
||||
worker.Buf.int32Array = [
|
||||
context.RIL.queryCallForwardStatus = function fakeQueryCallForward(options) {
|
||||
context.Buf.int32Array = [
|
||||
0, // rules.timeSeconds
|
||||
145, // rules.toa
|
||||
49, // rules.serviceClass
|
||||
|
@ -123,12 +126,12 @@ add_test(function test_queryCallForwardStatus_unconditional() {
|
|||
1, // rules.active
|
||||
1 // rulesLength
|
||||
];
|
||||
worker.RIL[REQUEST_QUERY_CALL_FORWARD_STATUS](1, {
|
||||
context.RIL[REQUEST_QUERY_CALL_FORWARD_STATUS](1, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.queryCallForwardStatus({
|
||||
context.RIL.queryCallForwardStatus({
|
||||
action: Ci.nsIDOMMozMobileCFInfo.CALL_FORWARD_ACTION_QUERY_STATUS,
|
||||
reason: Ci.nsIDOMMozMobileCFInfo.CALL_FORWARD_REASON_UNCONDITIONAL,
|
||||
serviceClass: ICC_SERVICE_CLASS_VOICE,
|
||||
|
|
|
@ -29,22 +29,23 @@ function _getWorker() {
|
|||
add_test(function test_queryCLIP_provisioned() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
context.Buf.readInt32 = function fakeReadUint32() {
|
||||
return context.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
worker.RIL.queryCLIP = function fakeQueryCLIP(options) {
|
||||
worker.Buf.int32Array = [
|
||||
context.RIL.queryCLIP = function fakeQueryCLIP(options) {
|
||||
context.Buf.int32Array = [
|
||||
1, // CLIP provisioned.
|
||||
1 // Length.
|
||||
];
|
||||
worker.RIL[REQUEST_QUERY_CLIP](1, {
|
||||
context.RIL[REQUEST_QUERY_CLIP](1, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.queryCLIP({});
|
||||
context.RIL.queryCLIP({});
|
||||
|
||||
let postedMessage = workerHelper.postedMessage;
|
||||
|
||||
|
@ -57,22 +58,23 @@ add_test(function test_queryCLIP_provisioned() {
|
|||
add_test(function test_getCLIP_error_generic_failure_invalid_length() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
context.Buf.readInt32 = function fakeReadUint32() {
|
||||
return context.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
worker.RIL.queryCLIP = function fakeQueryCLIP(options) {
|
||||
worker.Buf.int32Array = [
|
||||
context.RIL.queryCLIP = function fakeQueryCLIP(options) {
|
||||
context.Buf.int32Array = [
|
||||
1, // CLIP provisioned.
|
||||
0 // Length.
|
||||
];
|
||||
worker.RIL[REQUEST_QUERY_CLIP](1, {
|
||||
context.RIL[REQUEST_QUERY_CLIP](1, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.queryCLIP({});
|
||||
context.RIL.queryCLIP({});
|
||||
|
||||
let postedMessage = workerHelper.postedMessage;
|
||||
|
||||
|
|
|
@ -38,15 +38,16 @@ function _getWorker() {
|
|||
add_test(function test_setCLIR_success() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.RIL.setCLIR = function fakeSetCLIR(options) {
|
||||
worker.RIL[REQUEST_SET_CLIR](0, {
|
||||
context.RIL.setCLIR = function fakeSetCLIR(options) {
|
||||
context.RIL[REQUEST_SET_CLIR](0, {
|
||||
rilMessageType: "setCLIR",
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.setCLIR({
|
||||
context.RIL.setCLIR({
|
||||
clirMode: CLIR_DEFAULT
|
||||
});
|
||||
|
||||
|
@ -61,15 +62,16 @@ add_test(function test_setCLIR_success() {
|
|||
add_test(function test_setCLIR_generic_failure() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.RIL.setCLIR = function fakeSetCLIR(options) {
|
||||
worker.RIL[REQUEST_SET_CLIR](0, {
|
||||
context.RIL.setCLIR = function fakeSetCLIR(options) {
|
||||
context.RIL[REQUEST_SET_CLIR](0, {
|
||||
rilMessageType: "setCLIR",
|
||||
rilRequestError: ERROR_GENERIC_FAILURE
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.setCLIR({
|
||||
context.RIL.setCLIR({
|
||||
clirMode: CLIR_DEFAULT
|
||||
});
|
||||
|
||||
|
@ -84,25 +86,26 @@ add_test(function test_setCLIR_generic_failure() {
|
|||
add_test(function test_getCLIR_n0_m1() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
context.Buf.readInt32 = function fakeReadUint32() {
|
||||
return context.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
worker.RIL.getCLIR = function fakeGetCLIR(options) {
|
||||
worker.Buf.int32Array = [
|
||||
context.RIL.getCLIR = function fakeGetCLIR(options) {
|
||||
context.Buf.int32Array = [
|
||||
1, // Presentation indicator is used according to the subscription
|
||||
// of the CLIR service.
|
||||
0, // CLIR provisioned in permanent mode.
|
||||
2 // Length.
|
||||
];
|
||||
worker.RIL[REQUEST_GET_CLIR](1, {
|
||||
context.RIL[REQUEST_GET_CLIR](1, {
|
||||
rilMessageType: "setCLIR",
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.getCLIR({});
|
||||
context.RIL.getCLIR({});
|
||||
|
||||
let postedMessage = workerHelper.postedMessage;
|
||||
|
||||
|
@ -116,25 +119,26 @@ add_test(function test_getCLIR_n0_m1() {
|
|||
add_test(function test_getCLIR_error_generic_failure_invalid_length() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
context.Buf.readInt32 = function fakeReadUint32() {
|
||||
return context.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
worker.RIL.getCLIR = function fakeGetCLIR(options) {
|
||||
worker.Buf.int32Array = [
|
||||
context.RIL.getCLIR = function fakeGetCLIR(options) {
|
||||
context.Buf.int32Array = [
|
||||
1, // Presentation indicator is used according to the subscription
|
||||
// of the CLIR service.
|
||||
0, // CLIR provisioned in permanent mode.
|
||||
0 // Length (invalid one).
|
||||
];
|
||||
worker.RIL[REQUEST_GET_CLIR](1, {
|
||||
context.RIL[REQUEST_GET_CLIR](1, {
|
||||
rilMessageType: "setCLIR",
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.getCLIR({});
|
||||
context.RIL.getCLIR({});
|
||||
|
||||
let postedMessage = workerHelper.postedMessage;
|
||||
|
||||
|
|
|
@ -29,14 +29,15 @@ function _getWorker() {
|
|||
add_test(function test_setCallWaiting_success() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.RIL.setCallWaiting = function fakeSetCallWaiting(options) {
|
||||
worker.RIL[REQUEST_SET_CALL_WAITING](0, {
|
||||
context.RIL.setCallWaiting = function fakeSetCallWaiting(options) {
|
||||
context.RIL[REQUEST_SET_CALL_WAITING](0, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.setCallWaiting({
|
||||
context.RIL.setCallWaiting({
|
||||
enabled: true
|
||||
});
|
||||
|
||||
|
@ -51,14 +52,15 @@ add_test(function test_setCallWaiting_success() {
|
|||
add_test(function test_setCallWaiting_generic_failure() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.RIL.setCallWaiting = function fakeSetCallWaiting(options) {
|
||||
worker.RIL[REQUEST_SET_CALL_WAITING](0, {
|
||||
context.RIL.setCallWaiting = function fakeSetCallWaiting(options) {
|
||||
context.RIL[REQUEST_SET_CALL_WAITING](0, {
|
||||
rilRequestError: ERROR_GENERIC_FAILURE
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.setCallWaiting({
|
||||
context.RIL.setCallWaiting({
|
||||
enabled: true
|
||||
});
|
||||
|
||||
|
@ -73,23 +75,24 @@ add_test(function test_setCallWaiting_generic_failure() {
|
|||
add_test(function test_queryCallWaiting_success_enabled_true() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
context.Buf.readInt32 = function fakeReadUint32() {
|
||||
return context.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
worker.RIL.queryCallWaiting = function fakeQueryCallWaiting(options) {
|
||||
worker.Buf.int32Array = [
|
||||
context.RIL.queryCallWaiting = function fakeQueryCallWaiting(options) {
|
||||
context.Buf.int32Array = [
|
||||
1, // serviceClass
|
||||
1, // enabled
|
||||
1 // length
|
||||
];
|
||||
worker.RIL[REQUEST_QUERY_CALL_WAITING](1, {
|
||||
context.RIL[REQUEST_QUERY_CALL_WAITING](1, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.queryCallWaiting({});
|
||||
context.RIL.queryCallWaiting({});
|
||||
|
||||
let postedMessage = workerHelper.postedMessage;
|
||||
|
||||
|
@ -103,23 +106,24 @@ add_test(function test_queryCallWaiting_success_enabled_true() {
|
|||
add_test(function test_queryCallWaiting_success_enabled_false() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
context.Buf.readInt32 = function fakeReadUint32() {
|
||||
return context.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
worker.RIL.queryCallWaiting = function fakeQueryCallWaiting(options) {
|
||||
worker.Buf.int32Array = [
|
||||
context.RIL.queryCallWaiting = function fakeQueryCallWaiting(options) {
|
||||
context.Buf.int32Array = [
|
||||
1, // serviceClass
|
||||
0, // enabled
|
||||
1 // length
|
||||
];
|
||||
worker.RIL[REQUEST_QUERY_CALL_WAITING](1, {
|
||||
context.RIL[REQUEST_QUERY_CALL_WAITING](1, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.queryCallWaiting({});
|
||||
context.RIL.queryCallWaiting({});
|
||||
|
||||
let postedMessage = workerHelper.postedMessage;
|
||||
|
||||
|
|
|
@ -56,14 +56,15 @@ function fireTimeout() {
|
|||
add_test(function test_enter_emergencyCbMode() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
// Do it twice. Should always send the event.
|
||||
for (let i = 0; i < 2; ++i) {
|
||||
worker.RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE]();
|
||||
context.RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE]();
|
||||
let postedMessage = workerHelper.postedMessage;
|
||||
|
||||
// Should store the mode.
|
||||
do_check_eq(worker.RIL._isInEmergencyCbMode, true);
|
||||
do_check_eq(context.RIL._isInEmergencyCbMode, true);
|
||||
|
||||
// Should notify change.
|
||||
do_check_eq(postedMessage.rilMessageType, "emergencyCbModeChange");
|
||||
|
@ -71,7 +72,7 @@ add_test(function test_enter_emergencyCbMode() {
|
|||
do_check_eq(postedMessage.timeoutMs, TIMEOUT_VALUE);
|
||||
|
||||
// Should start timer.
|
||||
do_check_eq(worker.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
|
||||
do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
|
||||
}
|
||||
|
||||
run_next_test();
|
||||
|
@ -80,20 +81,21 @@ add_test(function test_enter_emergencyCbMode() {
|
|||
add_test(function test_exit_emergencyCbMode() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE]();
|
||||
worker.RIL[UNSOLICITED_EXIT_EMERGENCY_CALLBACK_MODE]();
|
||||
context.RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE]();
|
||||
context.RIL[UNSOLICITED_EXIT_EMERGENCY_CALLBACK_MODE]();
|
||||
let postedMessage = workerHelper.postedMessage;
|
||||
|
||||
// Should store the mode.
|
||||
do_check_eq(worker.RIL._isInEmergencyCbMode, false);
|
||||
do_check_eq(context.RIL._isInEmergencyCbMode, false);
|
||||
|
||||
// Should notify change.
|
||||
do_check_eq(postedMessage.rilMessageType, "emergencyCbModeChange");
|
||||
do_check_eq(postedMessage.active, false);
|
||||
|
||||
// Should clear timer.
|
||||
do_check_eq(worker.RIL._exitEmergencyCbModeTimeoutID, null);
|
||||
do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, null);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -101,13 +103,14 @@ add_test(function test_exit_emergencyCbMode() {
|
|||
add_test(function test_request_exit_emergencyCbMode_when_timeout() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE]();
|
||||
do_check_eq(worker.RIL._isInEmergencyCbMode, true);
|
||||
do_check_eq(worker.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
|
||||
context.RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE]();
|
||||
do_check_eq(context.RIL._isInEmergencyCbMode, true);
|
||||
do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
|
||||
|
||||
let parcelTypes = [];
|
||||
worker.Buf.newParcel = function(type, options) {
|
||||
context.Buf.newParcel = function(type, options) {
|
||||
parcelTypes.push(type);
|
||||
};
|
||||
|
||||
|
@ -115,7 +118,7 @@ add_test(function test_request_exit_emergencyCbMode_when_timeout() {
|
|||
fireTimeout();
|
||||
|
||||
// Should clear timeout event.
|
||||
do_check_eq(worker.RIL._exitEmergencyCbModeTimeoutID, null);
|
||||
do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, null);
|
||||
|
||||
// Check indeed sent out REQUEST_EXIT_EMERGENCY_CALLBACK_MODE.
|
||||
do_check_neq(parcelTypes.indexOf(REQUEST_EXIT_EMERGENCY_CALLBACK_MODE), -1);
|
||||
|
@ -126,22 +129,23 @@ add_test(function test_request_exit_emergencyCbMode_when_timeout() {
|
|||
add_test(function test_request_exit_emergencyCbMode_when_dial() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE]();
|
||||
do_check_eq(worker.RIL._isInEmergencyCbMode, true);
|
||||
do_check_eq(worker.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
|
||||
context.RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE]();
|
||||
do_check_eq(context.RIL._isInEmergencyCbMode, true);
|
||||
do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
|
||||
|
||||
let parcelTypes = [];
|
||||
worker.Buf.newParcel = function(type, options) {
|
||||
context.Buf.newParcel = function(type, options) {
|
||||
parcelTypes.push(type);
|
||||
};
|
||||
|
||||
// Dial non-emergency call.
|
||||
worker.RIL.dial({number: "0912345678",
|
||||
context.RIL.dial({number: "0912345678",
|
||||
isDialEmergency: false});
|
||||
|
||||
// Should clear timeout event.
|
||||
do_check_eq(worker.RIL._exitEmergencyCbModeTimeoutID, null);
|
||||
do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, null);
|
||||
|
||||
// Check indeed sent out REQUEST_EXIT_EMERGENCY_CALLBACK_MODE.
|
||||
do_check_neq(parcelTypes.indexOf(REQUEST_EXIT_EMERGENCY_CALLBACK_MODE), -1);
|
||||
|
@ -152,25 +156,26 @@ add_test(function test_request_exit_emergencyCbMode_when_dial() {
|
|||
add_test(function test_request_exit_emergencyCbMode_explicitly() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE]();
|
||||
do_check_eq(worker.RIL._isInEmergencyCbMode, true);
|
||||
do_check_eq(worker.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
|
||||
context.RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE]();
|
||||
do_check_eq(context.RIL._isInEmergencyCbMode, true);
|
||||
do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
|
||||
|
||||
let parcelTypes = [];
|
||||
worker.Buf.newParcel = function(type, options) {
|
||||
context.Buf.newParcel = function(type, options) {
|
||||
parcelTypes.push(type);
|
||||
};
|
||||
|
||||
worker.RIL.handleChromeMessage({rilMessageType: "exitEmergencyCbMode"});
|
||||
worker.RIL[REQUEST_EXIT_EMERGENCY_CALLBACK_MODE](1, {
|
||||
context.RIL.handleChromeMessage({rilMessageType: "exitEmergencyCbMode"});
|
||||
context.RIL[REQUEST_EXIT_EMERGENCY_CALLBACK_MODE](1, {
|
||||
rilMessageType: "exitEmergencyCbMode",
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
let postedMessage = workerHelper.postedMessage;
|
||||
|
||||
// Should clear timeout event.
|
||||
do_check_eq(worker.RIL._exitEmergencyCbModeTimeoutID, null);
|
||||
do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, null);
|
||||
|
||||
// Check indeed sent out REQUEST_EXIT_EMERGENCY_CALLBACK_MODE.
|
||||
do_check_neq(parcelTypes.indexOf(REQUEST_EXIT_EMERGENCY_CALLBACK_MODE), -1);
|
||||
|
|
|
@ -15,15 +15,16 @@ function newUint8Worker() {
|
|||
let index = 0; // index for read
|
||||
let buf = [];
|
||||
|
||||
worker.Buf.writeUint8 = function(value) {
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
context.Buf.writeUint8 = function(value) {
|
||||
buf.push(value);
|
||||
};
|
||||
|
||||
worker.Buf.readUint8 = function() {
|
||||
context.Buf.readUint8 = function() {
|
||||
return buf[index++];
|
||||
};
|
||||
|
||||
worker.Buf.seekIncoming = function(offset) {
|
||||
context.Buf.seekIncoming = function(offset) {
|
||||
index += offset;
|
||||
};
|
||||
|
||||
|
@ -37,8 +38,9 @@ function newUint8Worker() {
|
|||
*/
|
||||
add_test(function test_read_icc_ucs2_string() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let iccHelper = worker.ICCPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let iccHelper = context.ICCPDUHelper;
|
||||
|
||||
// 0x80
|
||||
let text = "TEST";
|
||||
|
@ -76,8 +78,9 @@ add_test(function test_read_icc_ucs2_string() {
|
|||
*/
|
||||
add_test(function test_read_dialling_number() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let iccHelper = worker.ICCPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let iccHelper = context.ICCPDUHelper;
|
||||
let str = "123456789";
|
||||
|
||||
helper.readHexOctet = function() {
|
||||
|
@ -101,8 +104,9 @@ add_test(function test_read_dialling_number() {
|
|||
*/
|
||||
add_test(function test_read_8bit_unpacked_to_string() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let iccHelper = worker.ICCPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let iccHelper = context.ICCPDUHelper;
|
||||
const langTable = PDU_NL_LOCKING_SHIFT_TABLES[PDU_NL_IDENTIFIER_DEFAULT];
|
||||
const langShiftTable = PDU_NL_SINGLE_SHIFT_TABLES[PDU_NL_IDENTIFIER_DEFAULT];
|
||||
|
||||
|
@ -166,8 +170,9 @@ add_test(function test_read_8bit_unpacked_to_string() {
|
|||
*/
|
||||
add_test(function test_write_string_to_8bit_unpacked() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let iccHelper = worker.ICCPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let iccHelper = context.ICCPDUHelper;
|
||||
const langTable = PDU_NL_LOCKING_SHIFT_TABLES[PDU_NL_IDENTIFIER_DEFAULT];
|
||||
const langShiftTable = PDU_NL_SINGLE_SHIFT_TABLES[PDU_NL_IDENTIFIER_DEFAULT];
|
||||
// Length of trailing 0xff.
|
||||
|
@ -212,8 +217,9 @@ add_test(function test_write_string_to_8bit_unpacked() {
|
|||
*/
|
||||
add_test(function test_write_string_to_8bit_unpacked_with_max_octets_written() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let iccHelper = worker.ICCPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let iccHelper = context.ICCPDUHelper;
|
||||
const langTable = PDU_NL_LOCKING_SHIFT_TABLES[PDU_NL_IDENTIFIER_DEFAULT];
|
||||
const langShiftTable = PDU_NL_SINGLE_SHIFT_TABLES[PDU_NL_IDENTIFIER_DEFAULT];
|
||||
|
||||
|
@ -251,8 +257,9 @@ add_test(function test_write_string_to_8bit_unpacked_with_max_octets_written() {
|
|||
*/
|
||||
add_test(function test_read_alpha_identifier() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let iccHelper = worker.ICCPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let iccHelper = context.ICCPDUHelper;
|
||||
|
||||
// UCS2: 0x80
|
||||
let text = "TEST";
|
||||
|
@ -295,8 +302,9 @@ add_test(function test_read_alpha_identifier() {
|
|||
*/
|
||||
add_test(function test_write_alpha_identifier() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let iccHelper = worker.ICCPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let iccHelper = context.ICCPDUHelper;
|
||||
// Length of trailing 0xff.
|
||||
let ffLen = 2;
|
||||
|
||||
|
@ -341,9 +349,10 @@ add_test(function test_write_alpha_identifier() {
|
|||
*/
|
||||
add_test(function test_read_alpha_id_dialling_number() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let iccHelper = worker.ICCPDUHelper;
|
||||
let buf = worker.Buf;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let iccHelper = context.ICCPDUHelper;
|
||||
let buf = context.Buf;
|
||||
const recordSize = 32;
|
||||
|
||||
function testReadAlphaIdDiallingNumber(contact) {
|
||||
|
@ -381,7 +390,8 @@ add_test(function test_read_alpha_id_dialling_number() {
|
|||
*/
|
||||
add_test(function test_write_alpha_id_dialling_number() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.ICCPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.ICCPDUHelper;
|
||||
const recordSize = 32;
|
||||
|
||||
// Write a normal contact.
|
||||
|
@ -443,7 +453,8 @@ add_test(function test_write_alpha_id_dialling_number() {
|
|||
*/
|
||||
add_test(function test_write_dialling_number() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.ICCPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.ICCPDUHelper;
|
||||
|
||||
// with +
|
||||
let number = "+123456";
|
||||
|
@ -470,8 +481,9 @@ add_test(function test_write_dialling_number() {
|
|||
*/
|
||||
add_test(function test_read_number_with_length() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let iccHelper = worker.ICCPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let iccHelper = context.ICCPDUHelper;
|
||||
let number = "123456789";
|
||||
|
||||
iccHelper.readDiallingNumber = function(numLen) {
|
||||
|
@ -493,8 +505,9 @@ add_test(function test_read_number_with_length() {
|
|||
*/
|
||||
add_test(function test_write_number_with_length() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let iccHelper = worker.ICCPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let iccHelper = context.ICCPDUHelper;
|
||||
|
||||
function test(number, expectedNumber) {
|
||||
expectedNumber = expectedNumber || number;
|
||||
|
@ -537,7 +550,8 @@ add_test(function test_write_number_with_length() {
|
|||
*/
|
||||
add_test(function test_write_timestamp() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
|
||||
// current date
|
||||
let dateInput = new Date();
|
||||
|
@ -576,7 +590,8 @@ add_test(function test_write_timestamp() {
|
|||
*/
|
||||
add_test(function test_octect_BCD() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
|
||||
// 23
|
||||
let number = 23;
|
||||
|
@ -606,13 +621,15 @@ add_test(function test_octect_BCD() {
|
|||
*/
|
||||
add_test(function test_is_icc_service_available() {
|
||||
let worker = newUint8Worker();
|
||||
let ICCUtilsHelper = worker.ICCUtilsHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let ICCUtilsHelper = context.ICCUtilsHelper;
|
||||
let RIL = context.RIL;
|
||||
|
||||
function test_table(sst, geckoService, simEnabled, usimEnabled) {
|
||||
worker.RIL.iccInfoPrivate.sst = sst;
|
||||
worker.RIL.appType = CARD_APPTYPE_SIM;
|
||||
RIL.iccInfoPrivate.sst = sst;
|
||||
RIL.appType = CARD_APPTYPE_SIM;
|
||||
do_check_eq(ICCUtilsHelper.isICCServiceAvailable(geckoService), simEnabled);
|
||||
worker.RIL.appType = CARD_APPTYPE_USIM;
|
||||
RIL.appType = CARD_APPTYPE_USIM;
|
||||
do_check_eq(ICCUtilsHelper.isICCServiceAvailable(geckoService), usimEnabled);
|
||||
}
|
||||
|
||||
|
@ -628,7 +645,8 @@ add_test(function test_is_icc_service_available() {
|
|||
*/
|
||||
add_test(function test_is_gsm_8bit_alphabet() {
|
||||
let worker = newUint8Worker();
|
||||
let ICCUtilsHelper = worker.ICCUtilsHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let ICCUtilsHelper = context.ICCUtilsHelper;
|
||||
const langTable = PDU_NL_LOCKING_SHIFT_TABLES[PDU_NL_IDENTIFIER_DEFAULT];
|
||||
const langShiftTable = PDU_NL_SINGLE_SHIFT_TABLES[PDU_NL_IDENTIFIER_DEFAULT];
|
||||
|
||||
|
@ -644,8 +662,9 @@ add_test(function test_is_gsm_8bit_alphabet() {
|
|||
*/
|
||||
add_test(function test_icc_get_card_lock_state_fdn() {
|
||||
let worker = newUint8Worker();
|
||||
let ril = worker.RIL;
|
||||
let buf = worker.Buf;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let ril = context.RIL;
|
||||
let buf = context.Buf;
|
||||
|
||||
buf.sendParcel = function() {
|
||||
// Request Type.
|
||||
|
@ -681,8 +700,9 @@ add_test(function test_icc_get_card_lock_state_fdn() {
|
|||
|
||||
add_test(function test_get_network_name_from_icc() {
|
||||
let worker = newUint8Worker();
|
||||
let RIL = worker.RIL;
|
||||
let ICCUtilsHelper = worker.ICCUtilsHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let RIL = context.RIL;
|
||||
let ICCUtilsHelper = context.ICCUtilsHelper;
|
||||
|
||||
function testGetNetworkNameFromICC(operatorData, expectedResult) {
|
||||
let result = ICCUtilsHelper.getNetworkNameFromICC(operatorData.mcc,
|
||||
|
@ -780,8 +800,9 @@ add_test(function test_path_id_for_spid_and_spn() {
|
|||
postMessage: function(message) {
|
||||
// Do nothing
|
||||
}});
|
||||
let RIL = worker.RIL;
|
||||
let ICCFileHelper = worker.ICCFileHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let RIL = context.RIL;
|
||||
let ICCFileHelper = context.ICCFileHelper;
|
||||
|
||||
// Test SIM
|
||||
RIL.appType = CARD_APPTYPE_SIM;
|
||||
|
@ -804,7 +825,8 @@ add_test(function test_path_id_for_spid_and_spn() {
|
|||
*/
|
||||
add_test(function test_parse_pbr_tlvs() {
|
||||
let worker = newUint8Worker();
|
||||
let buf = worker.Buf;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let buf = context.Buf;
|
||||
|
||||
let pbrTlvs = [
|
||||
{tag: ICC_USIM_TYPE1_TAG,
|
||||
|
@ -842,7 +864,7 @@ add_test(function test_parse_pbr_tlvs() {
|
|||
},
|
||||
];
|
||||
|
||||
let pbr = worker.ICCUtilsHelper.parsePbrTlvs(pbrTlvs);
|
||||
let pbr = context.ICCUtilsHelper.parsePbrTlvs(pbrTlvs);
|
||||
do_check_eq(pbr.adn.fileId, 0x4F3a);
|
||||
do_check_eq(pbr.iap.fileId, 0x4F25);
|
||||
do_check_eq(pbr.pbc.fileId, 0x4F09);
|
||||
|
@ -860,8 +882,9 @@ add_test(function test_parse_pbr_tlvs() {
|
|||
*/
|
||||
add_test(function test_load_linear_fixed_ef() {
|
||||
let worker = newUint8Worker();
|
||||
let ril = worker.RIL;
|
||||
let io = worker.ICCIOHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let ril = context.RIL;
|
||||
let io = context.ICCIOHelper;
|
||||
|
||||
io.getResponse = function fakeGetResponse(options) {
|
||||
// When recordSize is provided, loadLinearFixedEF should call iccIO directly.
|
||||
|
@ -882,8 +905,9 @@ add_test(function test_load_linear_fixed_ef() {
|
|||
*/
|
||||
add_test(function test_load_linear_fixed_ef() {
|
||||
let worker = newUint8Worker();
|
||||
let ril = worker.RIL;
|
||||
let io = worker.ICCIOHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let ril = context.RIL;
|
||||
let io = context.ICCIOHelper;
|
||||
|
||||
io.getResponse = function fakeGetResponse(options) {
|
||||
do_check_true(true);
|
||||
|
@ -904,10 +928,11 @@ add_test(function test_load_linear_fixed_ef() {
|
|||
*/
|
||||
add_test(function test_read_pbr() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let record = worker.ICCRecordHelper;
|
||||
let buf = worker.Buf;
|
||||
let io = worker.ICCIOHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let record = context.ICCRecordHelper;
|
||||
let buf = context.Buf;
|
||||
let io = context.ICCIOHelper;
|
||||
|
||||
io.loadLinearFixedEF = function fakeLoadLinearFixedEF(options) {
|
||||
let pbr_1 = [
|
||||
|
@ -970,10 +995,11 @@ add_test(function test_read_pbr() {
|
|||
*/
|
||||
add_test(function test_read_email() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let record = worker.ICCRecordHelper;
|
||||
let buf = worker.Buf;
|
||||
let io = worker.ICCIOHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let record = context.ICCRecordHelper;
|
||||
let buf = context.Buf;
|
||||
let io = context.ICCIOHelper;
|
||||
let recordSize;
|
||||
|
||||
io.loadLinearFixedEF = function fakeLoadLinearFixedEF(options) {
|
||||
|
@ -1027,20 +1053,21 @@ add_test(function test_update_email() {
|
|||
const fileId = 0x4f50;
|
||||
const NUM_TESTS = 2;
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let iccHelper = worker.ICCPDUHelper;
|
||||
let ril = worker.RIL;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let iccHelper = context.ICCPDUHelper;
|
||||
let ril = context.RIL;
|
||||
ril.appType = CARD_APPTYPE_USIM;
|
||||
let recordHelper = worker.ICCRecordHelper;
|
||||
let buf = worker.Buf;
|
||||
let ioHelper = worker.ICCIOHelper;
|
||||
let recordHelper = context.ICCRecordHelper;
|
||||
let buf = context.Buf;
|
||||
let ioHelper = context.ICCIOHelper;
|
||||
let pbr = {email: {fileId: fileId, fileType: ICC_USIM_TYPE1_TAG},
|
||||
adn: {sfi: 1}};
|
||||
let count = 0;
|
||||
|
||||
// Override.
|
||||
ioHelper.updateLinearFixedEF = function(options) {
|
||||
options.pathId = worker.ICCFileHelper.getEFPath(options.fileId);
|
||||
options.pathId = context.ICCFileHelper.getEFPath(options.fileId);
|
||||
options.command = ICC_COMMAND_UPDATE_RECORD;
|
||||
options.p1 = options.recordNumber;
|
||||
options.p2 = READ_RECORD_ABSOLUTE_MODE;
|
||||
|
@ -1115,10 +1142,11 @@ add_test(function test_update_email() {
|
|||
*/
|
||||
add_test(function test_read_anr() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let record = worker.ICCRecordHelper;
|
||||
let buf = worker.Buf;
|
||||
let io = worker.ICCIOHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let record = context.ICCRecordHelper;
|
||||
let buf = context.Buf;
|
||||
let io = context.ICCIOHelper;
|
||||
let recordSize;
|
||||
|
||||
io.loadLinearFixedEF = function fakeLoadLinearFixedEF(options) {
|
||||
|
@ -1169,20 +1197,21 @@ add_test(function test_update_anr() {
|
|||
const fileId = 0x4f11;
|
||||
const NUM_TESTS = 2;
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let iccHelper = worker.ICCPDUHelper;
|
||||
let ril = worker.RIL;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let iccHelper = context.ICCPDUHelper;
|
||||
let ril = context.RIL;
|
||||
ril.appType = CARD_APPTYPE_USIM;
|
||||
let recordHelper = worker.ICCRecordHelper;
|
||||
let buf = worker.Buf;
|
||||
let ioHelper = worker.ICCIOHelper;
|
||||
let recordHelper = context.ICCRecordHelper;
|
||||
let buf = context.Buf;
|
||||
let ioHelper = context.ICCIOHelper;
|
||||
let pbr = {anr0: {fileId: fileId, fileType: ICC_USIM_TYPE1_TAG},
|
||||
adn: {sfi: 1}};
|
||||
let count = 0;
|
||||
|
||||
// Override.
|
||||
ioHelper.updateLinearFixedEF = function(options) {
|
||||
options.pathId = worker.ICCFileHelper.getEFPath(options.fileId);
|
||||
options.pathId = context.ICCFileHelper.getEFPath(options.fileId);
|
||||
options.command = ICC_COMMAND_UPDATE_RECORD;
|
||||
options.p1 = options.recordNumber;
|
||||
options.p2 = READ_RECORD_ABSOLUTE_MODE;
|
||||
|
@ -1259,10 +1288,11 @@ add_test(function test_update_anr() {
|
|||
*/
|
||||
add_test(function test_read_iap() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let record = worker.ICCRecordHelper;
|
||||
let buf = worker.Buf;
|
||||
let io = worker.ICCIOHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let record = context.ICCRecordHelper;
|
||||
let buf = context.Buf;
|
||||
let io = context.ICCIOHelper;
|
||||
let recordSize;
|
||||
|
||||
io.loadLinearFixedEF = function fakeLoadLinearFixedEF(options) {
|
||||
|
@ -1317,17 +1347,18 @@ add_test(function test_update_iap() {
|
|||
const recordNumber = 1;
|
||||
const fileId = 0x4f17;
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let ril = worker.RIL;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let ril = context.RIL;
|
||||
ril.appType = CARD_APPTYPE_USIM;
|
||||
let recordHelper = worker.ICCRecordHelper;
|
||||
let buf = worker.Buf;
|
||||
let ioHelper = worker.ICCIOHelper;
|
||||
let recordHelper = context.ICCRecordHelper;
|
||||
let buf = context.Buf;
|
||||
let ioHelper = context.ICCIOHelper;
|
||||
let count = 0;
|
||||
|
||||
// Override.
|
||||
ioHelper.updateLinearFixedEF = function(options) {
|
||||
options.pathId = worker.ICCFileHelper.getEFPath(options.fileId);
|
||||
options.pathId = context.ICCFileHelper.getEFPath(options.fileId);
|
||||
options.command = ICC_COMMAND_UPDATE_RECORD;
|
||||
options.p1 = options.recordNumber;
|
||||
options.p2 = READ_RECORD_ABSOLUTE_MODE;
|
||||
|
@ -1390,11 +1421,12 @@ add_test(function test_update_iap() {
|
|||
*/
|
||||
add_test(function test_update_adn_like() {
|
||||
let worker = newUint8Worker();
|
||||
let ril = worker.RIL;
|
||||
let record = worker.ICCRecordHelper;
|
||||
let io = worker.ICCIOHelper;
|
||||
let pdu = worker.ICCPDUHelper;
|
||||
let buf = worker.Buf;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let ril = context.RIL;
|
||||
let record = context.ICCRecordHelper;
|
||||
let io = context.ICCIOHelper;
|
||||
let pdu = context.ICCPDUHelper;
|
||||
let buf = context.Buf;
|
||||
|
||||
ril.appType = CARD_APPTYPE_SIM;
|
||||
const recordSize = 0x20;
|
||||
|
@ -1402,7 +1434,7 @@ add_test(function test_update_adn_like() {
|
|||
|
||||
// Override.
|
||||
io.updateLinearFixedEF = function(options) {
|
||||
options.pathId = worker.ICCFileHelper.getEFPath(options.fileId);
|
||||
options.pathId = context.ICCFileHelper.getEFPath(options.fileId);
|
||||
options.command = ICC_COMMAND_UPDATE_RECORD;
|
||||
options.p1 = options.recordNumber;
|
||||
options.p2 = READ_RECORD_ABSOLUTE_MODE;
|
||||
|
@ -1472,10 +1504,11 @@ add_test(function test_update_adn_like() {
|
|||
*/
|
||||
add_test(function test_find_free_record_id() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let recordHelper = worker.ICCRecordHelper;
|
||||
let buf = worker.Buf;
|
||||
let io = worker.ICCIOHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let recordHelper = context.ICCRecordHelper;
|
||||
let buf = context.Buf;
|
||||
let io = context.ICCIOHelper;
|
||||
|
||||
function writeRecord (record) {
|
||||
// Write data size
|
||||
|
@ -1529,13 +1562,15 @@ add_test(function test_find_free_record_id() {
|
|||
*/
|
||||
add_test(function test_read_icc_contacts() {
|
||||
let worker = newUint8Worker();
|
||||
let record = worker.ICCRecordHelper;
|
||||
let contactHelper = worker.ICCContactHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let record = context.ICCRecordHelper;
|
||||
let contactHelper = context.ICCContactHelper;
|
||||
let ril = context.RIL;
|
||||
|
||||
function do_test(aSimType, aContactType, aExpectedContact, aEnhancedPhoneBook) {
|
||||
worker.RIL.appType = aSimType;
|
||||
worker.RIL._isCdma = (aSimType === CARD_APPTYPE_RUIM);
|
||||
worker.RIL.iccInfoPrivate.cst = (aEnhancedPhoneBook) ?
|
||||
ril.appType = aSimType;
|
||||
ril._isCdma = (aSimType === CARD_APPTYPE_RUIM);
|
||||
ril.iccInfoPrivate.cst = (aEnhancedPhoneBook) ?
|
||||
[0x0, 0x0C, 0x0, 0x0, 0x0]:
|
||||
[0x0, 0x00, 0x0, 0x0, 0x0];
|
||||
|
||||
|
@ -1640,15 +1675,16 @@ add_test(function test_update_icc_contact() {
|
|||
const ANR0_RECORD_ID = 30;
|
||||
|
||||
let worker = newUint8Worker();
|
||||
let recordHelper = worker.ICCRecordHelper;
|
||||
let contactHelper = worker.ICCContactHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let recordHelper = context.ICCRecordHelper;
|
||||
let contactHelper = context.ICCContactHelper;
|
||||
let ril = context.RIL;
|
||||
|
||||
function do_test(aSimType, aContactType, aContact, aPin2, aFileType, aEnhancedPhoneBook) {
|
||||
worker.RIL.appType = aSimType;
|
||||
worker.RIL._isCdma = (aSimType === CARD_APPTYPE_RUIM);
|
||||
worker.RIL.iccInfoPrivate.cst = (aEnhancedPhoneBook) ?
|
||||
[0x0, 0x0C, 0x0, 0x0, 0x0]:
|
||||
[0x0, 0x00, 0x0, 0x0, 0x0];
|
||||
ril.appType = aSimType;
|
||||
ril._isCdma = (aSimType === CARD_APPTYPE_RUIM);
|
||||
ril.iccInfoPrivate.cst = (aEnhancedPhoneBook) ? [0x0, 0x0C, 0x0, 0x0, 0x0]
|
||||
: [0x0, 0x00, 0x0, 0x0, 0x0];
|
||||
|
||||
recordHelper.readPBR = function(onsuccess, onerror) {
|
||||
if (aFileType === ICC_USIM_TYPE1_TAG) {
|
||||
|
@ -1793,8 +1829,9 @@ add_test(function test_update_icc_contact_with_remove_type1_attr() {
|
|||
const ANR0_RECORD_ID = 30;
|
||||
|
||||
let worker = newUint8Worker();
|
||||
let recordHelper = worker.ICCRecordHelper;
|
||||
let contactHelper = worker.ICCContactHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let recordHelper = context.ICCRecordHelper;
|
||||
let contactHelper = context.ICCContactHelper;
|
||||
|
||||
recordHelper.updateADNLike = function(fileId, contact, pin2, onsuccess, onerror) {
|
||||
onsuccess();
|
||||
|
@ -1866,8 +1903,9 @@ add_test(function test_update_icc_contact_with_remove_type1_attr() {
|
|||
*/
|
||||
add_test(function test_find_free_icc_contact_sim() {
|
||||
let worker = newUint8Worker();
|
||||
let recordHelper = worker.ICCRecordHelper;
|
||||
let contactHelper = worker.ICCContactHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let recordHelper = context.ICCRecordHelper;
|
||||
let contactHelper = context.ICCContactHelper;
|
||||
// Correct record Id starts with 1, so put a null element at index 0.
|
||||
let records = [null];
|
||||
const MAX_RECORDS = 3;
|
||||
|
@ -1916,8 +1954,9 @@ add_test(function test_find_free_icc_contact_sim() {
|
|||
*/
|
||||
add_test(function test_find_free_icc_contact_usim() {
|
||||
let worker = newUint8Worker();
|
||||
let recordHelper = worker.ICCRecordHelper;
|
||||
let contactHelper = worker.ICCContactHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let recordHelper = context.ICCRecordHelper;
|
||||
let contactHelper = context.ICCContactHelper;
|
||||
const ADN1_FILE_ID = 0x6f3a;
|
||||
const ADN2_FILE_ID = 0x6f3b;
|
||||
const MAX_RECORDS = 3;
|
||||
|
@ -1968,7 +2007,8 @@ add_test(function test_find_free_icc_contact_usim() {
|
|||
*/
|
||||
add_test(function test_error_message_read_icc_contact () {
|
||||
let worker = newUint8Worker();
|
||||
let ril = worker.RIL;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let ril = context.RIL;
|
||||
|
||||
function do_test(options, expectedErrorMsg) {
|
||||
ril.sendChromeMessage = function(message) {
|
||||
|
@ -1997,7 +2037,8 @@ add_test(function test_error_message_read_icc_contact () {
|
|||
*/
|
||||
add_test(function test_error_message_update_icc_contact() {
|
||||
let worker = newUint8Worker();
|
||||
let ril = worker.RIL;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let ril = context.RIL;
|
||||
|
||||
const ICCID = "123456789";
|
||||
ril.iccInfo.iccid = ICCID;
|
||||
|
@ -2023,12 +2064,12 @@ add_test(function test_error_message_update_icc_contact() {
|
|||
do_test({contactType: "fdn", contact: {contactId: ICCID + "1"}}, GECKO_ERROR_SIM_PIN2);
|
||||
|
||||
// Error 5, No free record found in EF_ADN.
|
||||
let record = worker.ICCRecordHelper;
|
||||
let record = context.ICCRecordHelper;
|
||||
record.readPBR = function(onsuccess, onerror) {
|
||||
onsuccess([{adn: {fileId: 0x4f3a}}]);
|
||||
};
|
||||
|
||||
let io = worker.ICCIOHelper;
|
||||
let io = context.ICCIOHelper;
|
||||
io.loadLinearFixedEF = function(options) {
|
||||
options.totalRecords = 1;
|
||||
options.p1 = 1;
|
||||
|
@ -2063,9 +2104,10 @@ add_test(function test_error_message_update_icc_contact() {
|
|||
|
||||
add_test(function test_personalization_state() {
|
||||
let worker = newUint8Worker();
|
||||
let ril = worker.RIL;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let ril = context.RIL;
|
||||
|
||||
worker.ICCRecordHelper.readICCID = function fakeReadICCID() {};
|
||||
context.ICCRecordHelper.readICCID = function fakeReadICCID() {};
|
||||
|
||||
function testPersonalization(cardPersoState, geckoCardState) {
|
||||
let iccStatus = {
|
||||
|
@ -2105,9 +2147,10 @@ add_test(function test_personalization_state() {
|
|||
*/
|
||||
add_test(function test_card_app_state() {
|
||||
let worker = newUint8Worker();
|
||||
let ril = worker.RIL;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let ril = context.RIL;
|
||||
|
||||
worker.ICCRecordHelper.readICCID = function fakeReadICCID() {};
|
||||
context.ICCRecordHelper.readICCID = function fakeReadICCID() {};
|
||||
|
||||
function testCardAppState(cardAppState, geckoCardState) {
|
||||
let iccStatus = {
|
||||
|
@ -2144,9 +2187,10 @@ add_test(function test_card_app_state() {
|
|||
*/
|
||||
add_test(function test_icc_permanent_blocked() {
|
||||
let worker = newUint8Worker();
|
||||
let ril = worker.RIL;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let ril = context.RIL;
|
||||
|
||||
worker.ICCRecordHelper.readICCID = function fakeReadICCID() {};
|
||||
context.ICCRecordHelper.readICCID = function fakeReadICCID() {};
|
||||
|
||||
function testPermanentBlocked(pin1_replaced, universalPINState, pin1) {
|
||||
let iccStatus = {
|
||||
|
@ -2182,11 +2226,12 @@ add_test(function test_icc_permanent_blocked() {
|
|||
*/
|
||||
add_test(function test_set_icc_card_lock_facility_lock() {
|
||||
let worker = newUint8Worker();
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
worker.RILQUIRKS_V5_LEGACY = false;
|
||||
let aid = "123456789";
|
||||
let ril = worker.RIL;
|
||||
let ril = context.RIL;
|
||||
ril.aid = aid;
|
||||
let buf = worker.Buf;
|
||||
let buf = context.Buf;
|
||||
|
||||
let GECKO_CARDLOCK_TO_FACILITIY_LOCK = {};
|
||||
GECKO_CARDLOCK_TO_FACILITIY_LOCK[GECKO_CARDLOCK_PIN] = ICC_CB_FACILITY_SIM;
|
||||
|
@ -2243,8 +2288,9 @@ add_test(function test_set_icc_card_lock_facility_lock() {
|
|||
*/
|
||||
add_test(function test_unlock_card_lock_corporateLocked() {
|
||||
let worker = newUint8Worker();
|
||||
let ril = worker.RIL;
|
||||
let buf = worker.Buf;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let ril = context.RIL;
|
||||
let buf = context.Buf;
|
||||
const pin = "12345678";
|
||||
const puk = "12345678";
|
||||
|
||||
|
@ -2292,7 +2338,8 @@ add_test(function test_unlock_card_lock_corporateLocked() {
|
|||
*/
|
||||
add_test(function test_mcc_mnc_parsing() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.ICCUtilsHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.ICCUtilsHelper;
|
||||
|
||||
function do_test(imsi, mncLength, expectedMcc, expectedMnc) {
|
||||
let result = helper.parseMccMncFromImsi(imsi, mncLength);
|
||||
|
@ -2327,11 +2374,12 @@ add_test(function test_mcc_mnc_parsing() {
|
|||
*/
|
||||
add_test(function test_reading_ad_and_parsing_mcc_mnc() {
|
||||
let worker = newUint8Worker();
|
||||
let record = worker.SimRecordHelper;
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let ril = worker.RIL;
|
||||
let buf = worker.Buf;
|
||||
let io = worker.ICCIOHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let record = context.SimRecordHelper;
|
||||
let helper = context.GsmPDUHelper;
|
||||
let ril = context.RIL;
|
||||
let buf = context.Buf;
|
||||
let io = context.ICCIOHelper;
|
||||
|
||||
function do_test(mncLengthInEf, imsi, expectedMcc, expectedMnc) {
|
||||
ril.iccInfoPrivate.imsi = imsi;
|
||||
|
@ -2374,11 +2422,12 @@ add_test(function test_reading_ad_and_parsing_mcc_mnc() {
|
|||
|
||||
add_test(function test_reading_optional_efs() {
|
||||
let worker = newUint8Worker();
|
||||
let record = worker.SimRecordHelper;
|
||||
let gsmPdu = worker.GsmPDUHelper;
|
||||
let ril = worker.RIL;
|
||||
let buf = worker.Buf;
|
||||
let io = worker.ICCIOHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let record = context.SimRecordHelper;
|
||||
let gsmPdu = context.GsmPDUHelper;
|
||||
let ril = context.RIL;
|
||||
let buf = context.Buf;
|
||||
let io = context.ICCIOHelper;
|
||||
|
||||
function buildSST(supportedEf) {
|
||||
let sst = [];
|
||||
|
@ -2464,9 +2513,10 @@ add_test(function test_reading_optional_efs() {
|
|||
*/
|
||||
add_test(function test_fetch_sim_recodes() {
|
||||
let worker = newWorker();
|
||||
let RIL = worker.RIL;
|
||||
let iccRecord = worker.ICCRecordHelper;
|
||||
let simRecord = worker.SimRecordHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let RIL = context.RIL;
|
||||
let iccRecord = context.ICCRecordHelper;
|
||||
let simRecord = context.SimRecordHelper;
|
||||
|
||||
function testFetchSimRecordes(expectCalled) {
|
||||
let ifCalled = [];
|
||||
|
@ -2501,10 +2551,11 @@ add_test(function test_fetch_sim_recodes() {
|
|||
|
||||
add_test(function test_fetch_icc_recodes() {
|
||||
let worker = newWorker();
|
||||
let RIL = worker.RIL;
|
||||
let iccRecord = worker.ICCRecordHelper;
|
||||
let simRecord = worker.SimRecordHelper;
|
||||
let ruimRecord = worker.RuimRecordHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let RIL = context.RIL;
|
||||
let iccRecord = context.ICCRecordHelper;
|
||||
let simRecord = context.SimRecordHelper;
|
||||
let ruimRecord = context.RuimRecordHelper;
|
||||
let fetchTag = 0x00;
|
||||
|
||||
simRecord.fetchSimRecords = function() {
|
||||
|
@ -2535,10 +2586,11 @@ add_test(function test_fetch_icc_recodes() {
|
|||
*/
|
||||
add_test(function test_read_mwis() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let recordHelper = worker.SimRecordHelper;
|
||||
let buf = worker.Buf;
|
||||
let io = worker.ICCIOHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let recordHelper = context.SimRecordHelper;
|
||||
let buf = context.Buf;
|
||||
let io = context.ICCIOHelper;
|
||||
let mwisData;
|
||||
let postedMessage;
|
||||
|
||||
|
@ -2604,18 +2656,19 @@ add_test(function test_read_mwis() {
|
|||
*/
|
||||
add_test(function test_update_mwis() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let ril = worker.RIL;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let ril = context.RIL;
|
||||
ril.appType = CARD_APPTYPE_USIM;
|
||||
ril.iccInfoPrivate.mwis = [0x00, 0x00, 0x00, 0x00, 0x00];
|
||||
let recordHelper = worker.SimRecordHelper;
|
||||
let buf = worker.Buf;
|
||||
let ioHelper = worker.ICCIOHelper;
|
||||
let recordHelper = context.SimRecordHelper;
|
||||
let buf = context.Buf;
|
||||
let ioHelper = context.ICCIOHelper;
|
||||
let recordSize = ril.iccInfoPrivate.mwis.length;
|
||||
let recordNum = 1;
|
||||
|
||||
ioHelper.updateLinearFixedEF = function(options) {
|
||||
options.pathId = worker.ICCFileHelper.getEFPath(options.fileId);
|
||||
options.pathId = context.ICCFileHelper.getEFPath(options.fileId);
|
||||
options.command = ICC_COMMAND_UPDATE_RECORD;
|
||||
options.p1 = options.recordNumber;
|
||||
options.p2 = READ_RECORD_ABSOLUTE_MODE;
|
||||
|
@ -2736,18 +2789,19 @@ add_test(function test_read_new_sms_on_sim() {
|
|||
return _worker;
|
||||
},
|
||||
fakeWokerBuffer: function() {
|
||||
let context = _worker.ContextPool._contexts[0];
|
||||
let index = 0; // index for read
|
||||
let buf = [];
|
||||
_worker.Buf.writeUint8 = function(value) {
|
||||
context.Buf.writeUint8 = function(value) {
|
||||
buf.push(value);
|
||||
};
|
||||
_worker.Buf.readUint8 = function() {
|
||||
context.Buf.readUint8 = function() {
|
||||
return buf[index++];
|
||||
};
|
||||
_worker.Buf.seekIncoming = function(offset) {
|
||||
context.Buf.seekIncoming = function(offset) {
|
||||
index += offset;
|
||||
};
|
||||
_worker.Buf.getReadAvailable = function() {
|
||||
context.Buf.getReadAvailable = function() {
|
||||
return buf.length - index;
|
||||
};
|
||||
}
|
||||
|
@ -2756,8 +2810,9 @@ add_test(function test_read_new_sms_on_sim() {
|
|||
|
||||
let workerHelper = newSmsOnSimWorkerHelper();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.ICCIOHelper.loadLinearFixedEF = function fakeLoadLinearFixedEF(options) {
|
||||
context.ICCIOHelper.loadLinearFixedEF = function fakeLoadLinearFixedEF(options) {
|
||||
// SimStatus: Unread, SMSC:+0123456789, Sender: +9876543210, Text: How are you?
|
||||
let SimSmsPduHex = "0306911032547698040A9189674523010000208062917314080CC8F71D14969741F977FD07"
|
||||
// In 4.2.25 EF_SMS Short Messages of 3GPP TS 31.102:
|
||||
|
@ -2770,7 +2825,7 @@ add_test(function test_read_new_sms_on_sim() {
|
|||
|
||||
workerHelper.fakeWokerBuffer();
|
||||
|
||||
worker.Buf.writeString(SimSmsPduHex);
|
||||
context.Buf.writeString(SimSmsPduHex);
|
||||
|
||||
options.recordSize = 176; // Record length is fixed to 176 bytes.
|
||||
if (options.callback) {
|
||||
|
@ -2799,7 +2854,7 @@ add_test(function test_read_new_sms_on_sim() {
|
|||
}
|
||||
|
||||
function do_test() {
|
||||
worker.onRILMessage(newSmsOnSimParcel());
|
||||
worker.onRILMessage(0, newSmsOnSimParcel());
|
||||
|
||||
let postedMessage = workerHelper.postedMessage;
|
||||
|
||||
|
@ -2820,8 +2875,9 @@ add_test(function test_read_new_sms_on_sim() {
|
|||
*/
|
||||
add_test(function test_fcp_template_for_transparent_structure() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let berHelper = worker.BerTlvHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let berHelper = context.BerTlvHelper;
|
||||
|
||||
let tag_test = [
|
||||
0x62,
|
||||
|
@ -2857,8 +2913,9 @@ add_test(function test_fcp_template_for_transparent_structure() {
|
|||
*/
|
||||
add_test(function test_fcp_template_for_linear_fixed_structure() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let berHelper = worker.BerTlvHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let berHelper = context.BerTlvHelper;
|
||||
|
||||
let tag_test = [
|
||||
0x62,
|
||||
|
@ -2893,9 +2950,10 @@ add_test(function test_fcp_template_for_linear_fixed_structure() {
|
|||
|
||||
add_test(function test_icc_io_get_response_for_transparent_structure() {
|
||||
let worker = newUint8Worker();
|
||||
let buf = worker.Buf;
|
||||
let iccioHelper = worker.ICCIOHelper;
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let buf = context.Buf;
|
||||
let iccioHelper = context.ICCIOHelper;
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
|
||||
let responseArray = [
|
||||
// SIM response.
|
||||
|
@ -2927,9 +2985,10 @@ add_test(function test_icc_io_get_response_for_transparent_structure() {
|
|||
|
||||
add_test(function test_icc_io_get_response_for_linear_fixed_structure() {
|
||||
let worker = newUint8Worker();
|
||||
let buf = worker.Buf;
|
||||
let iccioHelper = worker.ICCIOHelper;
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let buf = context.Buf;
|
||||
let iccioHelper = context.ICCIOHelper;
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
|
||||
let responseArray = [
|
||||
// SIM response.
|
||||
|
|
|
@ -16,7 +16,8 @@ function parseMMI(mmi) {
|
|||
// Do nothing
|
||||
}
|
||||
});
|
||||
return worker.RIL._parseMMI(mmi);
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
return context.RIL._parseMMI(mmi);
|
||||
}
|
||||
|
||||
function getWorker() {
|
||||
|
@ -42,11 +43,12 @@ function getWorker() {
|
|||
function testSendMMI(mmi, error) {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
do_print("worker.postMessage " + worker.postMessage);
|
||||
|
||||
worker.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
worker.RIL.sendMMI({rilMessageType: "sendMMI", mmi: mmi});
|
||||
context.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
context.RIL.sendMMI({rilMessageType: "sendMMI", mmi: mmi});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
|
@ -371,25 +373,26 @@ add_test(function test_sendMMI_invalid() {
|
|||
add_test(function test_sendMMI_short_code() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
let ussdOptions;
|
||||
|
||||
worker.RIL.sendUSSD = function fakeSendUSSD(options){
|
||||
context.RIL.sendUSSD = function fakeSendUSSD(options){
|
||||
ussdOptions = options;
|
||||
worker.RIL[REQUEST_SEND_USSD](0, {
|
||||
context.RIL[REQUEST_SEND_USSD](0, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
worker.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
worker.RIL.sendMMI({mmi: "**"});
|
||||
context.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
context.RIL.sendMMI({mmi: "**"});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
do_check_eq(ussdOptions.ussd, "**");
|
||||
do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
|
||||
do_check_true(postedMessage.success);
|
||||
do_check_true(worker.RIL._ussdSession);
|
||||
do_check_true(context.RIL._ussdSession);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -403,15 +406,16 @@ add_test(function test_sendMMI_dial_string() {
|
|||
function setCallForwardSuccess(mmi) {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.RIL.setCallForward = function fakeSetCallForward(options) {
|
||||
worker.RIL[REQUEST_SET_CALL_FORWARD](0, {
|
||||
context.RIL.setCallForward = function fakeSetCallForward(options) {
|
||||
context.RIL[REQUEST_SET_CALL_FORWARD](0, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
worker.RIL.sendMMI({mmi: mmi});
|
||||
context.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
context.RIL.sendMMI({mmi: mmi});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
|
@ -434,17 +438,18 @@ add_test(function test_sendMMI_call_forwarding_deactivation() {
|
|||
add_test(function test_sendMMI_call_forwarding_interrogation() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
context.Buf.readInt32 = function fakeReadUint32() {
|
||||
return context.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
worker.Buf.readString = function fakeReadString() {
|
||||
context.Buf.readString = function fakeReadString() {
|
||||
return "+34666222333";
|
||||
};
|
||||
|
||||
worker.RIL.queryCallForwardStatus = function fakeQueryCallForward(options) {
|
||||
worker.Buf.int32Array = [
|
||||
context.RIL.queryCallForwardStatus = function fakeQueryCallForward(options) {
|
||||
context.Buf.int32Array = [
|
||||
0, // rules.timeSeconds
|
||||
145, // rules.toa
|
||||
49, // rules.serviceClass
|
||||
|
@ -452,13 +457,13 @@ add_test(function test_sendMMI_call_forwarding_interrogation() {
|
|||
1, // rules.active
|
||||
1 // rulesLength
|
||||
];
|
||||
worker.RIL[REQUEST_QUERY_CALL_FORWARD_STATUS](1, {
|
||||
context.RIL[REQUEST_QUERY_CALL_FORWARD_STATUS](1, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
worker.RIL.sendMMI({mmi: "*#21#"});
|
||||
context.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
context.RIL.sendMMI({mmi: "*#21#"});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
|
@ -476,19 +481,20 @@ add_test(function test_sendMMI_call_forwarding_interrogation() {
|
|||
add_test(function test_sendMMI_call_forwarding_interrogation_no_rules() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
context.Buf.readInt32 = function fakeReadUint32() {
|
||||
return 0;
|
||||
};
|
||||
|
||||
worker.RIL.queryCallForwardStatus = function fakeQueryCallForward(options) {
|
||||
worker.RIL[REQUEST_QUERY_CALL_FORWARD_STATUS](1, {
|
||||
context.RIL.queryCallForwardStatus = function fakeQueryCallForward(options) {
|
||||
context.RIL[REQUEST_QUERY_CALL_FORWARD_STATUS](1, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
worker.RIL.sendMMI({mmi: "*#21#"});
|
||||
context.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
context.RIL.sendMMI({mmi: "*#21#"});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
|
@ -544,15 +550,16 @@ add_test(function test_sendMMI_call_forwarding_CFAllConditional() {
|
|||
add_test(function test_sendMMI_change_PIN() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.RIL.changeICCPIN = function fakeChangeICCPIN(options) {
|
||||
worker.RIL[REQUEST_ENTER_SIM_PIN](0, {
|
||||
context.RIL.changeICCPIN = function fakeChangeICCPIN(options) {
|
||||
context.RIL[REQUEST_ENTER_SIM_PIN](0, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
worker.RIL.sendMMI({mmi: "**04*1234*4567*4567#"});
|
||||
context.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
context.RIL.sendMMI({mmi: "**04*1234*4567*4567#"});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
|
@ -589,15 +596,16 @@ add_test(function test_sendMMI_change_PIN_new_PIN_mismatch() {
|
|||
add_test(function test_sendMMI_change_PIN2() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.RIL.changeICCPIN2 = function fakeChangeICCPIN2(options){
|
||||
worker.RIL[REQUEST_ENTER_SIM_PIN2](0, {
|
||||
context.RIL.changeICCPIN2 = function fakeChangeICCPIN2(options){
|
||||
context.RIL[REQUEST_ENTER_SIM_PIN2](0, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
worker.RIL.sendMMI({mmi: "**042*1234*4567*4567#"});
|
||||
context.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
context.RIL.sendMMI({mmi: "**042*1234*4567*4567#"});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
|
@ -634,15 +642,16 @@ add_test(function test_sendMMI_change_PIN2_new_PIN2_mismatch() {
|
|||
add_test(function test_sendMMI_unblock_PIN() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.RIL.enterICCPUK = function fakeEnterICCPUK(options){
|
||||
worker.RIL[REQUEST_ENTER_SIM_PUK](0, {
|
||||
context.RIL.enterICCPUK = function fakeEnterICCPUK(options){
|
||||
context.RIL[REQUEST_ENTER_SIM_PUK](0, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
worker.RIL.sendMMI({mmi: "**05*1234*4567*4567#"});
|
||||
context.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
context.RIL.sendMMI({mmi: "**05*1234*4567*4567#"});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
|
@ -679,15 +688,16 @@ add_test(function test_sendMMI_unblock_PIN_new_PIN_mismatch() {
|
|||
add_test(function test_sendMMI_unblock_PIN2() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.RIL.enterICCPUK2 = function fakeEnterICCPUK2(options){
|
||||
worker.RIL[REQUEST_ENTER_SIM_PUK2](0, {
|
||||
context.RIL.enterICCPUK2 = function fakeEnterICCPUK2(options){
|
||||
context.RIL[REQUEST_ENTER_SIM_PUK2](0, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
worker.RIL.sendMMI({mmi: "**052*1234*4567*4567#"});
|
||||
context.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
context.RIL.sendMMI({mmi: "**052*1234*4567*4567#"});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
|
@ -724,16 +734,17 @@ add_test(function test_sendMMI_unblock_PIN2_new_PIN_mismatch() {
|
|||
add_test(function test_sendMMI_get_IMEI() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let mmiOptions;
|
||||
|
||||
worker.RIL.getIMEI = function getIMEI(options){
|
||||
context.RIL.getIMEI = function getIMEI(options){
|
||||
mmiOptions = options;
|
||||
worker.RIL[REQUEST_SEND_USSD](0, {
|
||||
context.RIL[REQUEST_SEND_USSD](0, {
|
||||
rilRequestError: ERROR_SUCCESS,
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.sendMMI({mmi: "*#06#"});
|
||||
context.RIL.sendMMI({mmi: "*#06#"});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
|
@ -747,16 +758,17 @@ add_test(function test_sendMMI_get_IMEI() {
|
|||
add_test(function test_sendMMI_get_IMEI_error() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let mmiOptions;
|
||||
|
||||
worker.RIL.getIMEI = function getIMEI(options){
|
||||
context.RIL.getIMEI = function getIMEI(options){
|
||||
mmiOptions = options;
|
||||
worker.RIL[REQUEST_SEND_USSD](0, {
|
||||
context.RIL[REQUEST_SEND_USSD](0, {
|
||||
rilRequestError: ERROR_RADIO_NOT_AVAILABLE,
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.sendMMI({mmi: "*#06#"});
|
||||
context.RIL.sendMMI({mmi: "*#06#"});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
|
@ -770,21 +782,22 @@ add_test(function test_sendMMI_get_IMEI_error() {
|
|||
add_test(function test_sendMMI_call_barring_BAIC_interrogation_voice() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.Buf.readInt32List = function fakeReadUint32List() {
|
||||
context.Buf.readInt32List = function fakeReadUint32List() {
|
||||
return [1];
|
||||
};
|
||||
|
||||
worker.RIL.queryICCFacilityLock =
|
||||
context.RIL.queryICCFacilityLock =
|
||||
function fakeQueryICCFacilityLock(options){
|
||||
worker.RIL[REQUEST_QUERY_FACILITY_LOCK](1, {
|
||||
context.RIL[REQUEST_QUERY_FACILITY_LOCK](1, {
|
||||
rilMessageType: "sendMMI",
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
worker.RIL.sendMMI({mmi: "*#33#"});
|
||||
context.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
context.RIL.sendMMI({mmi: "*#33#"});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
|
@ -800,20 +813,21 @@ add_test(function test_sendMMI_call_barring_BAIC_interrogation_voice() {
|
|||
add_test(function test_sendMMI_call_barring_BAIC_activation() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let mmiOptions;
|
||||
|
||||
worker.RIL.setICCFacilityLock =
|
||||
context.RIL.setICCFacilityLock =
|
||||
function fakeSetICCFacilityLock(options){
|
||||
mmiOptions = options;
|
||||
worker.RIL[REQUEST_SET_FACILITY_LOCK](0, {
|
||||
context.RIL[REQUEST_SET_FACILITY_LOCK](0, {
|
||||
rilMessageType: "sendMMI",
|
||||
procedure: MMI_PROCEDURE_ACTIVATION,
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
worker.RIL.sendMMI({mmi: "*33#"});
|
||||
context.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
context.RIL.sendMMI({mmi: "*33#"});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
|
@ -827,20 +841,21 @@ add_test(function test_sendMMI_call_barring_BAIC_activation() {
|
|||
add_test(function test_sendMMI_call_barring_BAIC_deactivation() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let mmiOptions;
|
||||
|
||||
worker.RIL.setICCFacilityLock =
|
||||
context.RIL.setICCFacilityLock =
|
||||
function fakeSetICCFacilityLock(options){
|
||||
mmiOptions = options;
|
||||
worker.RIL[REQUEST_SET_FACILITY_LOCK](0, {
|
||||
context.RIL[REQUEST_SET_FACILITY_LOCK](0, {
|
||||
rilMessageType: "sendMMI",
|
||||
procedure: MMI_PROCEDURE_DEACTIVATION,
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
worker.RIL.sendMMI({mmi: "#33#"});
|
||||
context.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
context.RIL.sendMMI({mmi: "#33#"});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
|
@ -860,24 +875,25 @@ add_test(function test_sendMMI_call_barring_BAIC_procedure_not_supported() {
|
|||
add_test(function test_sendMMI_USSD() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let ussdOptions;
|
||||
|
||||
worker.RIL.sendUSSD = function fakeSendUSSD(options){
|
||||
context.RIL.sendUSSD = function fakeSendUSSD(options){
|
||||
ussdOptions = options;
|
||||
worker.RIL[REQUEST_SEND_USSD](0, {
|
||||
context.RIL[REQUEST_SEND_USSD](0, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
worker.RIL.sendMMI({mmi: "*123#"});
|
||||
context.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
context.RIL.sendMMI({mmi: "*123#"});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
do_check_eq(ussdOptions.ussd, "*123#");
|
||||
do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
|
||||
do_check_true(postedMessage.success);
|
||||
do_check_true(worker.RIL._ussdSession);
|
||||
do_check_true(context.RIL._ussdSession);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -885,24 +901,25 @@ add_test(function test_sendMMI_USSD() {
|
|||
add_test(function test_sendMMI_USSD_error() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let ussdOptions;
|
||||
|
||||
worker.RIL.sendUSSD = function fakeSendUSSD(options){
|
||||
context.RIL.sendUSSD = function fakeSendUSSD(options){
|
||||
ussdOptions = options;
|
||||
worker.RIL[REQUEST_SEND_USSD](0, {
|
||||
context.RIL[REQUEST_SEND_USSD](0, {
|
||||
rilRequestError: ERROR_GENERIC_FAILURE
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
worker.RIL.sendMMI({mmi: "*123#"});
|
||||
context.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
context.RIL.sendMMI({mmi: "*123#"});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
do_check_eq(ussdOptions.ussd, "*123#");
|
||||
do_check_eq (postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE);
|
||||
do_check_false(postedMessage.success);
|
||||
do_check_false(worker.RIL._ussdSession);
|
||||
do_check_false(context.RIL._ussdSession);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -910,15 +927,16 @@ add_test(function test_sendMMI_USSD_error() {
|
|||
function setCallWaitingSuccess(mmi) {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.RIL.setCallWaiting = function fakeSetCallWaiting(options) {
|
||||
worker.RIL[REQUEST_SET_CALL_WAITING](0, {
|
||||
context.RIL.setCallWaiting = function fakeSetCallWaiting(options) {
|
||||
context.RIL[REQUEST_SET_CALL_WAITING](0, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
worker.RIL.sendMMI({mmi: mmi});
|
||||
context.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
context.RIL.sendMMI({mmi: mmi});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
|
@ -953,24 +971,25 @@ add_test(function test_sendMMI_call_waiting_erasure() {
|
|||
add_test(function test_sendMMI_call_waiting_interrogation() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.Buf.readInt32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
context.Buf.readInt32 = function fakeReadUint32() {
|
||||
return context.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
worker.RIL.queryCallWaiting = function fakeQueryCallWaiting(options) {
|
||||
worker.Buf.int32Array = [
|
||||
context.RIL.queryCallWaiting = function fakeQueryCallWaiting(options) {
|
||||
context.Buf.int32Array = [
|
||||
7, // serviceClass
|
||||
1, // enabled
|
||||
2 // length
|
||||
];
|
||||
worker.RIL[REQUEST_QUERY_CALL_WAITING](1, {
|
||||
context.RIL[REQUEST_QUERY_CALL_WAITING](1, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
worker.RIL.sendMMI({mmi: "*#43#"});
|
||||
context.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
context.RIL.sendMMI({mmi: "*#43#"});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
|
|
|
@ -12,18 +12,19 @@ function run_test() {
|
|||
*/
|
||||
function newUint8Worker() {
|
||||
let worker = newWorker();
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let index = 0; // index for read
|
||||
let buf = [];
|
||||
|
||||
worker.Buf.writeUint8 = function(value) {
|
||||
context.Buf.writeUint8 = function(value) {
|
||||
buf.push(value);
|
||||
};
|
||||
|
||||
worker.Buf.readUint8 = function() {
|
||||
context.Buf.readUint8 = function() {
|
||||
return buf[index++];
|
||||
};
|
||||
|
||||
worker.Buf.seekIncoming = function(offset) {
|
||||
context.Buf.seekIncoming = function(offset) {
|
||||
index += offset;
|
||||
};
|
||||
|
||||
|
@ -37,12 +38,13 @@ function newUint8Worker() {
|
|||
*/
|
||||
add_test(function test_is_ruim_service_available() {
|
||||
let worker = newWorker();
|
||||
worker.RIL._isCdma = true;
|
||||
worker.RIL.appType = CARD_APPTYPE_RUIM;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
context.RIL._isCdma = true;
|
||||
context.RIL.appType = CARD_APPTYPE_RUIM;
|
||||
|
||||
function test_table(cst, geckoService, enabled) {
|
||||
worker.RIL.iccInfoPrivate.cst = cst;
|
||||
do_check_eq(worker.ICCUtilsHelper.isICCServiceAvailable(geckoService),
|
||||
context.RIL.iccInfoPrivate.cst = cst;
|
||||
do_check_eq(context.ICCUtilsHelper.isICCServiceAvailable(geckoService),
|
||||
enabled);
|
||||
}
|
||||
|
||||
|
@ -59,8 +61,9 @@ add_test(function test_is_ruim_service_available() {
|
|||
*/
|
||||
add_test(function test_ruim_file_path_id() {
|
||||
let worker = newWorker();
|
||||
let RIL = worker.RIL;
|
||||
let ICCFileHelper = worker.ICCFileHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let RIL = context.RIL;
|
||||
let ICCFileHelper = context.ICCFileHelper;
|
||||
|
||||
RIL.appType = CARD_APPTYPE_RUIM;
|
||||
do_check_eq(ICCFileHelper.getEFPath(ICC_EF_CSIM_CST),
|
||||
|
@ -71,8 +74,9 @@ add_test(function test_ruim_file_path_id() {
|
|||
|
||||
add_test(function test_fetch_ruim_recodes() {
|
||||
let worker = newWorker();
|
||||
let RIL = worker.RIL;
|
||||
let ruimHelper = worker.RuimRecordHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let RIL = context.RIL;
|
||||
let ruimHelper = context.RuimRecordHelper;
|
||||
|
||||
function testFetchRuimRecordes(expectCalled) {
|
||||
let ifCalled = [];
|
||||
|
@ -115,9 +119,10 @@ add_test(function test_fetch_ruim_recodes() {
|
|||
*/
|
||||
add_test(function test_decode_imsi_value() {
|
||||
let worker = newUint8Worker();
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
function testDecodeImsiValue(encoded, length, expect) {
|
||||
let decoded = worker.RuimRecordHelper.decodeIMSIValue(encoded, length);
|
||||
let decoded = context.RuimRecordHelper.decodeIMSIValue(encoded, length);
|
||||
|
||||
do_check_eq(expect, decoded);
|
||||
}
|
||||
|
@ -145,9 +150,10 @@ add_test(function test_decode_imsi_value() {
|
|||
*/
|
||||
add_test(function test_get_imsi_m() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let buf = worker.Buf;
|
||||
let io = worker.ICCIOHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let buf = context.Buf;
|
||||
let io = context.ICCIOHelper;
|
||||
|
||||
function testDecodeImsi(encodedImsi, expectedImsi) {
|
||||
io.loadTransparentEF = function fakeLoadTransparentEF(options) {
|
||||
|
@ -167,8 +173,8 @@ add_test(function test_get_imsi_m() {
|
|||
}
|
||||
};
|
||||
|
||||
worker.RuimRecordHelper.getIMSI_M();
|
||||
let imsi = worker.RIL.iccInfoPrivate.imsi;
|
||||
context.RuimRecordHelper.getIMSI_M();
|
||||
let imsi = context.RIL.iccInfoPrivate.imsi;
|
||||
|
||||
do_check_eq(expectedImsi, imsi)
|
||||
}
|
||||
|
@ -187,9 +193,10 @@ add_test(function test_get_imsi_m() {
|
|||
*/
|
||||
add_test(function test_read_cdmahome() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let buf = worker.Buf;
|
||||
let io = worker.ICCIOHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let buf = context.Buf;
|
||||
let io = context.ICCIOHelper;
|
||||
|
||||
io.loadLinearFixedEF = function fakeLoadLinearFixedEF(options) {
|
||||
let cdmaHome = [0xc1, 0x34, 0xff, 0xff, 0x00];
|
||||
|
@ -214,8 +221,8 @@ add_test(function test_read_cdmahome() {
|
|||
};
|
||||
|
||||
function testCdmaHome(expectedSystemIds, expectedNetworkIds) {
|
||||
worker.RuimRecordHelper.readCDMAHome();
|
||||
let cdmaHome = worker.RIL.cdmaHome;
|
||||
context.RuimRecordHelper.readCDMAHome();
|
||||
let cdmaHome = context.RIL.cdmaHome;
|
||||
for (let i = 0; i < expectedSystemIds.length; i++) {
|
||||
do_check_eq(cdmaHome.systemId[i], expectedSystemIds[i]);
|
||||
do_check_eq(cdmaHome.networkId[i], expectedNetworkIds[i]);
|
||||
|
@ -234,9 +241,10 @@ add_test(function test_read_cdmahome() {
|
|||
*/
|
||||
add_test(function test_read_cdmaspn() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let buf = worker.Buf;
|
||||
let io = worker.ICCIOHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let buf = context.Buf;
|
||||
let io = context.ICCIOHelper;
|
||||
|
||||
function testReadSpn(file, expectedSpn, expectedDisplayCondition) {
|
||||
io.loadTransparentEF = function fakeLoadTransparentEF(options) {
|
||||
|
@ -256,9 +264,9 @@ add_test(function test_read_cdmaspn() {
|
|||
}
|
||||
};
|
||||
|
||||
worker.RuimRecordHelper.readSPN();
|
||||
do_check_eq(worker.RIL.iccInfo.spn, expectedSpn);
|
||||
do_check_eq(worker.RIL.iccInfoPrivate.spnDisplayCondition,
|
||||
context.RuimRecordHelper.readSPN();
|
||||
do_check_eq(context.RIL.iccInfo.spn, expectedSpn);
|
||||
do_check_eq(context.RIL.iccInfoPrivate.spnDisplayCondition,
|
||||
expectedDisplayCondition);
|
||||
}
|
||||
|
||||
|
@ -297,8 +305,9 @@ add_test(function test_cdma_spn_display_condition() {
|
|||
// Do nothing
|
||||
}
|
||||
});
|
||||
let RIL = worker.RIL;
|
||||
let ICCUtilsHelper = worker.ICCUtilsHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let RIL = context.RIL;
|
||||
let ICCUtilsHelper = context.ICCUtilsHelper;
|
||||
|
||||
// Set cdma.
|
||||
RIL._isCdma = true;
|
||||
|
|
|
@ -118,8 +118,9 @@ function newWriteHexOctetAsUint8Worker() {
|
|||
}
|
||||
});
|
||||
|
||||
worker.GsmPDUHelper.writeHexOctet = function(value) {
|
||||
worker.Buf.writeUint8(value);
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
context.GsmPDUHelper.writeHexOctet = function(value) {
|
||||
context.Buf.writeUint8(value);
|
||||
};
|
||||
|
||||
return worker;
|
||||
|
@ -139,7 +140,7 @@ function add_test_receiving_sms(expected, pdu) {
|
|||
|
||||
do_print("expect: " + expected);
|
||||
do_print("pdu: " + pdu);
|
||||
worker.onRILMessage(newSmsParcel(pdu));
|
||||
worker.onRILMessage(0, newSmsParcel(pdu));
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -154,8 +155,9 @@ function test_receiving_7bit_alphabets(lst, sst) {
|
|||
}
|
||||
let ril = test_receiving_7bit_alphabets__ril;
|
||||
let worker = test_receiving_7bit_alphabets__worker;
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let buf = worker.Buf;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
let buf = context.Buf;
|
||||
|
||||
function get7bitRawBytes(expected) {
|
||||
buf.outgoingIndex = 0;
|
||||
|
@ -183,11 +185,12 @@ function test_receiving_7bit_alphabets(lst, sst) {
|
|||
|
||||
function test_receiving_ucs2_alphabets(text) {
|
||||
let worker = test_receiving_7bit_alphabets__worker;
|
||||
let buf = worker.Buf;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let buf = context.Buf;
|
||||
|
||||
function getUCS2RawBytes(expected) {
|
||||
buf.outgoingIndex = 0;
|
||||
worker.GsmPDUHelper.writeUCS2String(expected);
|
||||
context.GsmPDUHelper.writeUCS2String(expected);
|
||||
|
||||
let subArray = buf.outgoingBytes.subarray(0, buf.outgoingIndex);
|
||||
return Array.slice(subArray);
|
||||
|
@ -220,8 +223,9 @@ test_receiving_ucs2_alphabets(ucs2str);
|
|||
// Bug 820220: B2G SMS: wrong order and truncated content in multi-part messages
|
||||
add_test(function test_sendSMS_UCS2_without_langIndex_langShiftIndex_defined() {
|
||||
let worker = newWriteHexOctetAsUint8Worker();
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.Buf.sendParcel = function() {
|
||||
context.Buf.sendParcel = function() {
|
||||
// Each sendParcel() call represents one outgoing segment of a multipart
|
||||
// SMS message. Here, we have the first segment send, so it's "Hello "
|
||||
// only.
|
||||
|
@ -242,7 +246,7 @@ add_test(function test_sendSMS_UCS2_without_langIndex_langShiftIndex_defined() {
|
|||
run_next_test();
|
||||
};
|
||||
|
||||
worker.RIL.sendSMS({
|
||||
context.RIL.sendSMS({
|
||||
number: "1",
|
||||
segmentMaxSeq: 2,
|
||||
fullBody: "Hello World!",
|
||||
|
|
|
@ -190,10 +190,11 @@ function pduToParcelData(cdmaPduHelper, pdu) {
|
|||
add_test(function test_processCdmaSmsStatusReport() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
function test_StatusReport(errorClass, msgStatus) {
|
||||
let msgId = 0;
|
||||
let sentSmsMap = worker.RIL._pendingSentSmsMap;
|
||||
let sentSmsMap = context.RIL._pendingSentSmsMap;
|
||||
|
||||
sentSmsMap[msgId] = {};
|
||||
|
||||
|
@ -226,7 +227,7 @@ add_test(function test_processCdmaSmsStatusReport() {
|
|||
msgStatus: msgStatus
|
||||
};
|
||||
|
||||
worker.RIL._processCdmaSmsStatusReport(message);
|
||||
context.RIL._processCdmaSmsStatusReport(message);
|
||||
|
||||
let postedMessage = workerHelper.postedMessage;
|
||||
|
||||
|
@ -263,8 +264,9 @@ add_test(function test_processCdmaSmsStatusReport() {
|
|||
add_test(function test_processCdmaSmsWapPush() {
|
||||
let workerHelper = _getWorker(),
|
||||
worker = workerHelper.worker,
|
||||
bitBufferHelper = worker.BitBufferHelper,
|
||||
cdmaPduHelper = worker.CdmaPDUHelper;
|
||||
context = worker.ContextPool._contexts[0],
|
||||
bitBufferHelper = context.BitBufferHelper,
|
||||
cdmaPduHelper = context.CdmaPDUHelper;
|
||||
|
||||
function test_CdmaSmsWapPdu(wdpData, reversed) {
|
||||
let orig_address = "0987654321",
|
||||
|
@ -293,7 +295,7 @@ add_test(function test_processCdmaSmsWapPush() {
|
|||
data: hexStringToBytes(hexString) })
|
||||
};
|
||||
|
||||
worker.onRILMessage(newSmsParcel(cdmaPduHelper, pdu));
|
||||
worker.onRILMessage(0, newSmsParcel(cdmaPduHelper, pdu));
|
||||
}
|
||||
|
||||
let postedMessage = workerHelper.postedMessage;
|
||||
|
|
|
@ -19,11 +19,12 @@ add_test(function test_CdmaPDUHelper_encodeUserDataReplyOption() {
|
|||
// Do nothing
|
||||
}
|
||||
});
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
let testDataBuffer = [];
|
||||
worker.BitBufferHelper.startWrite(testDataBuffer);
|
||||
context.BitBufferHelper.startWrite(testDataBuffer);
|
||||
|
||||
let helper = worker.CdmaPDUHelper;
|
||||
let helper = context.CdmaPDUHelper;
|
||||
helper.encodeUserDataReplyOption({requestStatusReport: true});
|
||||
|
||||
let expectedDataBuffer = [PDU_CDMA_MSG_USERDATA_REPLY_OPTION, 0x01, 0x40];
|
||||
|
@ -49,11 +50,12 @@ add_test(function test_CdmaPDUHelper_decodeUserDataMsgStatus() {
|
|||
// Do nothing
|
||||
}
|
||||
});
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
let helper = worker.CdmaPDUHelper;
|
||||
let helper = context.CdmaPDUHelper;
|
||||
function test_MsgStatus(octet) {
|
||||
let testDataBuffer = [octet];
|
||||
worker.BitBufferHelper.startRead(testDataBuffer);
|
||||
context.BitBufferHelper.startRead(testDataBuffer);
|
||||
let result = helper.decodeUserDataMsgStatus();
|
||||
|
||||
do_check_eq(result.errorClass, octet >>> 6);
|
||||
|
@ -85,10 +87,11 @@ add_test(function test_CdmaPDUHelper_decodeCdmaPDUMsg_Shift_jis() {
|
|||
// Do nothing
|
||||
}
|
||||
});
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
let helper = worker.CdmaPDUHelper;
|
||||
let helper = context.CdmaPDUHelper;
|
||||
function test_decodePDUMsg(testDataBuffer, expected, encoding, msgType, msgBodySize) {
|
||||
worker.BitBufferHelper.startRead(testDataBuffer);
|
||||
context.BitBufferHelper.startRead(testDataBuffer);
|
||||
let result = helper.decodeCdmaPDUMsg(encoding, msgType, msgBodySize);
|
||||
do_check_eq(result, expected);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,8 @@ add_test(function test_GsmPDUHelper_readDataCodingScheme() {
|
|||
}
|
||||
});
|
||||
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
function test_dcs(dcs, encoding, messageClass, mwi) {
|
||||
helper.readHexOctet = function() {
|
||||
return dcs;
|
||||
|
@ -159,7 +160,8 @@ add_test(function test_GsmPDUHelper_writeStringAsSeptets() {
|
|||
}
|
||||
});
|
||||
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
helper.resetOctetWritten = function() {
|
||||
helper.octetsWritten = 0;
|
||||
};
|
||||
|
@ -196,10 +198,10 @@ add_test(function test_GsmPDUHelper_readAddress() {
|
|||
postMessage: function(message) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
function test_address(addrHex, addrString) {
|
||||
let uint16Array = [];
|
||||
let ix = 0;
|
||||
|
@ -207,7 +209,7 @@ add_test(function test_GsmPDUHelper_readAddress() {
|
|||
uint16Array[i] = addrHex[i].charCodeAt();
|
||||
}
|
||||
|
||||
worker.Buf.readUint16 = function(){
|
||||
context.Buf.readUint16 = function(){
|
||||
if(ix >= uint16Array.length) {
|
||||
do_throw("out of range in uint16Array");
|
||||
}
|
||||
|
|
|
@ -27,7 +27,8 @@ add_test(function test_RadioInterface__countGsm7BitSeptets() {
|
|||
}
|
||||
});
|
||||
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let helper = context.GsmPDUHelper;
|
||||
helper.resetOctetWritten = function() {
|
||||
helper.octetsWritten = 0;
|
||||
};
|
||||
|
|
|
@ -29,6 +29,7 @@ function _getWorker() {
|
|||
add_test(function test_notification() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
function Call(callIndex, number) {
|
||||
this.callIndex = callIndex;
|
||||
|
@ -69,7 +70,7 @@ add_test(function test_notification() {
|
|||
do_print('Test case info: ' + JSON.stringify(testInfo));
|
||||
|
||||
// Set current calls.
|
||||
worker.RIL._processCalls(calls);
|
||||
context.RIL._processCalls(calls);
|
||||
|
||||
let notificationInfo = {
|
||||
notificationType: 1, // MT
|
||||
|
@ -79,7 +80,7 @@ add_test(function test_notification() {
|
|||
number: number
|
||||
};
|
||||
|
||||
worker.RIL._processSuppSvcNotification(notificationInfo);
|
||||
context.RIL._processSuppSvcNotification(notificationInfo);
|
||||
|
||||
let postedMessage = workerHelper.postedMessage;
|
||||
do_check_eq(postedMessage.rilMessageType, 'suppSvcNotification');
|
||||
|
@ -87,7 +88,7 @@ add_test(function test_notification() {
|
|||
do_check_eq(postedMessage.callIndex, resultCallIndex);
|
||||
|
||||
// Clear all existed calls.
|
||||
worker.RIL._processCalls(null);
|
||||
context.RIL._processCalls(null);
|
||||
}
|
||||
|
||||
testNotification(oneCall, SUPP_SVC_NOTIFICATION_CODE2_PUT_ON_HOLD, null,
|
||||
|
|
|
@ -14,16 +14,17 @@ function newUint8Worker() {
|
|||
let worker = newWorker();
|
||||
let index = 0; // index for read
|
||||
let buf = [];
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.Buf.writeUint8 = function(value) {
|
||||
context.Buf.writeUint8 = function(value) {
|
||||
buf.push(value);
|
||||
};
|
||||
|
||||
worker.Buf.readUint8 = function() {
|
||||
context.Buf.readUint8 = function() {
|
||||
return buf[index++];
|
||||
};
|
||||
|
||||
worker.Buf.seekIncoming = function(offset) {
|
||||
context.Buf.seekIncoming = function(offset) {
|
||||
index += offset;
|
||||
};
|
||||
|
||||
|
@ -36,22 +37,23 @@ function newUint8SupportOutgoingIndexWorker() {
|
|||
let worker = newWorker();
|
||||
let index = 4; // index for read
|
||||
let buf = [0, 0, 0, 0]; // Preserved parcel size
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.Buf.writeUint8 = function(value) {
|
||||
if (worker.Buf.outgoingIndex >= buf.length) {
|
||||
context.Buf.writeUint8 = function(value) {
|
||||
if (context.Buf.outgoingIndex >= buf.length) {
|
||||
buf.push(value);
|
||||
} else {
|
||||
buf[worker.Buf.outgoingIndex] = value;
|
||||
buf[context.Buf.outgoingIndex] = value;
|
||||
}
|
||||
|
||||
worker.Buf.outgoingIndex++;
|
||||
context.Buf.outgoingIndex++;
|
||||
};
|
||||
|
||||
worker.Buf.readUint8 = function() {
|
||||
context.Buf.readUint8 = function() {
|
||||
return buf[index++];
|
||||
};
|
||||
|
||||
worker.Buf.seekIncoming = function(offset) {
|
||||
context.Buf.seekIncoming = function(offset) {
|
||||
index += offset;
|
||||
};
|
||||
|
||||
|
@ -66,8 +68,9 @@ function newUint8SupportOutgoingIndexWorker() {
|
|||
*/
|
||||
add_test(function test_if_send_stk_terminal_profile() {
|
||||
let worker = newUint8Worker();
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let profileSend = false;
|
||||
worker.RIL.sendStkTerminalProfile = function(data) {
|
||||
context.RIL.sendStkTerminalProfile = function(data) {
|
||||
profileSend = true;
|
||||
};
|
||||
|
||||
|
@ -80,7 +83,7 @@ add_test(function test_if_send_stk_terminal_profile() {
|
|||
};
|
||||
worker.RILQUIRKS_SEND_STK_PROFILE_DOWNLOAD = false;
|
||||
|
||||
worker.RIL._processICCStatus(iccStatus);
|
||||
context.RIL._processICCStatus(iccStatus);
|
||||
|
||||
do_check_eq(profileSend, false);
|
||||
|
||||
|
@ -92,8 +95,9 @@ add_test(function test_if_send_stk_terminal_profile() {
|
|||
*/
|
||||
add_test(function test_send_stk_terminal_profile() {
|
||||
let worker = newUint8Worker();
|
||||
let ril = worker.RIL;
|
||||
let buf = worker.Buf;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let ril = context.RIL;
|
||||
let buf = context.Buf;
|
||||
|
||||
ril.sendStkTerminalProfile(STK_SUPPORTED_TERMINAL_PROFILE);
|
||||
|
||||
|
@ -112,8 +116,9 @@ add_test(function test_send_stk_terminal_profile() {
|
|||
*/
|
||||
add_test(function test_stk_terminal_response() {
|
||||
let worker = newUint8SupportOutgoingIndexWorker();
|
||||
let buf = worker.Buf;
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let buf = context.Buf;
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
|
||||
buf.sendParcel = function() {
|
||||
// Type
|
||||
|
@ -171,7 +176,7 @@ add_test(function test_stk_terminal_response() {
|
|||
input: "Mozilla",
|
||||
resultCode: STK_RESULT_OK
|
||||
};
|
||||
worker.RIL.sendStkTerminalResponse(response);
|
||||
context.RIL.sendStkTerminalResponse(response);
|
||||
});
|
||||
|
||||
// Test ComprehensionTlvHelper
|
||||
|
@ -181,8 +186,9 @@ add_test(function test_stk_terminal_response() {
|
|||
*/
|
||||
add_test(function test_write_location_info_tlv() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let tlvHelper = worker.ComprehensionTlvHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let tlvHelper = context.ComprehensionTlvHelper;
|
||||
|
||||
// Test with 2-digit mnc, and gsmCellId obtained from UMTS network.
|
||||
let loc = {
|
||||
|
@ -270,8 +276,9 @@ add_test(function test_write_location_info_tlv() {
|
|||
*/
|
||||
add_test(function test_write_disconnecting_cause() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let tlvHelper = worker.ComprehensionTlvHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let tlvHelper = context.ComprehensionTlvHelper;
|
||||
|
||||
tlvHelper.writeCauseTlv(RIL_ERROR_TO_GECKO_ERROR[ERROR_GENERIC_FAILURE]);
|
||||
let tag = pduHelper.readHexOctet();
|
||||
|
@ -291,7 +298,8 @@ add_test(function test_write_disconnecting_cause() {
|
|||
*/
|
||||
add_test(function test_get_size_of_length_octets() {
|
||||
let worker = newUint8Worker();
|
||||
let tlvHelper = worker.ComprehensionTlvHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let tlvHelper = context.ComprehensionTlvHelper;
|
||||
|
||||
let length = 0x70;
|
||||
do_check_eq(tlvHelper.getSizeOfLengthOctets(length), 1);
|
||||
|
@ -313,8 +321,9 @@ add_test(function test_get_size_of_length_octets() {
|
|||
*/
|
||||
add_test(function test_write_length() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let tlvHelper = worker.ComprehensionTlvHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let tlvHelper = context.ComprehensionTlvHelper;
|
||||
|
||||
let length = 0x70;
|
||||
tlvHelper.writeLength(length);
|
||||
|
@ -347,9 +356,10 @@ add_test(function test_write_length() {
|
|||
*/
|
||||
add_test(function test_stk_proactive_command_search_next_tag() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let berHelper = worker.BerTlvHelper;
|
||||
let stkHelper = worker.StkProactiveCmdHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let berHelper = context.BerTlvHelper;
|
||||
let stkHelper = context.StkProactiveCmdHelper;
|
||||
|
||||
let tag_test = [
|
||||
0xD0,
|
||||
|
@ -389,9 +399,10 @@ add_test(function test_stk_proactive_command_search_next_tag() {
|
|||
*/
|
||||
add_test(function test_stk_proactive_command_refresh() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let berHelper = worker.BerTlvHelper;
|
||||
let stkHelper = worker.StkProactiveCmdHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let berHelper = context.BerTlvHelper;
|
||||
let stkHelper = context.StkProactiveCmdHelper;
|
||||
|
||||
let refresh_1 = [
|
||||
0xD0,
|
||||
|
@ -422,9 +433,10 @@ add_test(function test_stk_proactive_command_refresh() {
|
|||
*/
|
||||
add_test(function test_stk_proactive_command_play_tone() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let berHelper = worker.BerTlvHelper;
|
||||
let stkHelper = worker.StkProactiveCmdHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let berHelper = context.BerTlvHelper;
|
||||
let stkHelper = context.StkProactiveCmdHelper;
|
||||
|
||||
let tone_1 = [
|
||||
0xD0,
|
||||
|
@ -464,9 +476,10 @@ add_test(function test_stk_proactive_command_play_tone() {
|
|||
*/
|
||||
add_test(function test_stk_proactive_command_poll_interval() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let berHelper = worker.BerTlvHelper;
|
||||
let stkHelper = worker.StkProactiveCmdHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let berHelper = context.BerTlvHelper;
|
||||
let stkHelper = context.StkProactiveCmdHelper;
|
||||
|
||||
let poll_1 = [
|
||||
0xD0,
|
||||
|
@ -498,9 +511,10 @@ add_test(function test_stk_proactive_command_poll_interval() {
|
|||
*/
|
||||
add_test(function test_read_septets_to_string() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let berHelper = worker.BerTlvHelper;
|
||||
let stkHelper = worker.StkProactiveCmdHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let berHelper = context.BerTlvHelper;
|
||||
let stkHelper = context.StkProactiveCmdHelper;
|
||||
|
||||
let display_text_1 = [
|
||||
0xd0,
|
||||
|
@ -529,9 +543,10 @@ add_test(function test_read_septets_to_string() {
|
|||
*/
|
||||
add_test(function test_stk_proactive_command_event_list() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let berHelper = worker.BerTlvHelper;
|
||||
let stkHelper = worker.StkProactiveCmdHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let berHelper = context.BerTlvHelper;
|
||||
let stkHelper = context.StkProactiveCmdHelper;
|
||||
|
||||
let event_1 = [
|
||||
0xD0,
|
||||
|
@ -565,10 +580,11 @@ add_test(function test_stk_proactive_command_event_list() {
|
|||
*/
|
||||
add_test(function test_stk_proactive_command_get_input() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let berHelper = worker.BerTlvHelper;
|
||||
let stkHelper = worker.StkProactiveCmdHelper;
|
||||
let stkCmdHelper = worker.StkCommandParamsFactory;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let berHelper = context.BerTlvHelper;
|
||||
let stkHelper = context.StkProactiveCmdHelper;
|
||||
let stkCmdHelper = context.StkCommandParamsFactory;
|
||||
|
||||
let get_input_1 = [
|
||||
0xD0,
|
||||
|
@ -633,9 +649,10 @@ add_test(function test_stk_proactive_command_get_input() {
|
|||
*/
|
||||
add_test(function test_stk_proactive_command_more_time() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let berHelper = worker.BerTlvHelper;
|
||||
let stkHelper = worker.StkProactiveCmdHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let berHelper = context.BerTlvHelper;
|
||||
let stkHelper = context.StkProactiveCmdHelper;
|
||||
|
||||
let more_time_1 = [
|
||||
0xD0,
|
||||
|
@ -662,10 +679,11 @@ add_test(function test_stk_proactive_command_more_time() {
|
|||
*/
|
||||
add_test(function test_stk_proactive_command_select_item() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let berHelper = worker.BerTlvHelper;
|
||||
let stkHelper = worker.StkProactiveCmdHelper;
|
||||
let stkFactory = worker.StkCommandParamsFactory;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let berHelper = context.BerTlvHelper;
|
||||
let stkHelper = context.StkProactiveCmdHelper;
|
||||
let stkFactory = context.StkCommandParamsFactory;
|
||||
|
||||
let select_item_1 = [
|
||||
0xD0,
|
||||
|
@ -749,10 +767,11 @@ add_test(function test_stk_proactive_command_select_item() {
|
|||
*/
|
||||
add_test(function test_stk_proactive_command_set_up_menu() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let berHelper = worker.BerTlvHelper;
|
||||
let stkHelper = worker.StkProactiveCmdHelper;
|
||||
let stkFactory = worker.StkCommandParamsFactory;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let berHelper = context.BerTlvHelper;
|
||||
let stkHelper = context.StkProactiveCmdHelper;
|
||||
let stkFactory = context.StkCommandParamsFactory;
|
||||
|
||||
let set_up_menu_1 = [
|
||||
0xD0,
|
||||
|
@ -832,10 +851,11 @@ add_test(function test_stk_proactive_command_set_up_menu() {
|
|||
*/
|
||||
add_test(function test_stk_proactive_command_set_up_call() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let berHelper = worker.BerTlvHelper;
|
||||
let stkHelper = worker.StkProactiveCmdHelper;
|
||||
let cmdFactory = worker.StkCommandParamsFactory;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let berHelper = context.BerTlvHelper;
|
||||
let stkHelper = context.StkProactiveCmdHelper;
|
||||
let cmdFactory = context.StkCommandParamsFactory;
|
||||
|
||||
let set_up_call_1 = [
|
||||
0xD0,
|
||||
|
@ -869,9 +889,10 @@ add_test(function test_stk_proactive_command_set_up_call() {
|
|||
*/
|
||||
add_test(function test_stk_proactive_command_timer_management() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let berHelper = worker.BerTlvHelper;
|
||||
let stkHelper = worker.StkProactiveCmdHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let berHelper = context.BerTlvHelper;
|
||||
let stkHelper = context.StkProactiveCmdHelper;
|
||||
|
||||
// Timer Management - Start
|
||||
let timer_management_1 = [
|
||||
|
@ -931,9 +952,10 @@ add_test(function test_stk_proactive_command_timer_management() {
|
|||
*/
|
||||
add_test(function test_stk_proactive_command_provide_local_information() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let berHelper = worker.BerTlvHelper;
|
||||
let stkHelper = worker.StkProactiveCmdHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let berHelper = context.BerTlvHelper;
|
||||
let stkHelper = context.StkProactiveCmdHelper;
|
||||
|
||||
// Verify IMEI
|
||||
let local_info_1 = [
|
||||
|
@ -979,9 +1001,10 @@ add_test(function test_stk_proactive_command_provide_local_information() {
|
|||
*/
|
||||
add_test(function test_stk_proactive_command_open_channel() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let berHelper = worker.BerTlvHelper;
|
||||
let stkHelper = worker.StkProactiveCmdHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let berHelper = context.BerTlvHelper;
|
||||
let stkHelper = context.StkProactiveCmdHelper;
|
||||
|
||||
// Open Channel
|
||||
let open_channel = [
|
||||
|
@ -1083,8 +1106,9 @@ add_test(function test_stk_proactive_command_open_channel() {
|
|||
*/
|
||||
add_test(function test_stk_event_download_location_status() {
|
||||
let worker = newUint8SupportOutgoingIndexWorker();
|
||||
let buf = worker.Buf;
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let buf = context.Buf;
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
|
||||
buf.sendParcel = function() {
|
||||
// Type
|
||||
|
@ -1153,7 +1177,7 @@ add_test(function test_stk_event_download_location_status() {
|
|||
gsmCellId: 0
|
||||
}
|
||||
};
|
||||
worker.RIL.sendStkEventDownload({
|
||||
context.RIL.sendStkEventDownload({
|
||||
event: event
|
||||
});
|
||||
});
|
||||
|
@ -1165,9 +1189,10 @@ add_test(function test_stk_event_download_location_status() {
|
|||
*/
|
||||
add_test(function test_stk_event_download_language_selection() {
|
||||
let worker = newUint8SupportOutgoingIndexWorker();
|
||||
let buf = worker.Buf;
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let iccHelper = worker.ICCPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let buf = context.Buf;
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let iccHelper = context.ICCPDUHelper;
|
||||
|
||||
buf.sendParcel = function() {
|
||||
// Type
|
||||
|
@ -1214,7 +1239,7 @@ add_test(function test_stk_event_download_language_selection() {
|
|||
eventType: STK_EVENT_TYPE_LANGUAGE_SELECTION,
|
||||
language: "zh"
|
||||
};
|
||||
worker.RIL.sendStkEventDownload({
|
||||
context.RIL.sendStkEventDownload({
|
||||
event: event
|
||||
});
|
||||
});
|
||||
|
@ -1224,8 +1249,9 @@ add_test(function test_stk_event_download_language_selection() {
|
|||
*/
|
||||
add_test(function test_stk_event_download_user_activity() {
|
||||
let worker = newUint8SupportOutgoingIndexWorker();
|
||||
let buf = worker.Buf;
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let buf = context.Buf;
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
|
||||
buf.sendParcel = function() {
|
||||
// Type
|
||||
|
@ -1262,7 +1288,7 @@ add_test(function test_stk_event_download_user_activity() {
|
|||
let event = {
|
||||
eventType: STK_EVENT_TYPE_USER_ACTIVITY
|
||||
};
|
||||
worker.RIL.sendStkEventDownload({
|
||||
context.RIL.sendStkEventDownload({
|
||||
event: event
|
||||
});
|
||||
});
|
||||
|
@ -1272,8 +1298,9 @@ add_test(function test_stk_event_download_user_activity() {
|
|||
*/
|
||||
add_test(function test_stk_event_download_idle_screen_available() {
|
||||
let worker = newUint8SupportOutgoingIndexWorker();
|
||||
let buf = worker.Buf;
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let buf = context.Buf;
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
|
||||
buf.sendParcel = function() {
|
||||
// Type
|
||||
|
@ -1310,7 +1337,7 @@ add_test(function test_stk_event_download_idle_screen_available() {
|
|||
let event = {
|
||||
eventType: STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE
|
||||
};
|
||||
worker.RIL.sendStkEventDownload({
|
||||
context.RIL.sendStkEventDownload({
|
||||
event: event
|
||||
});
|
||||
});
|
||||
|
@ -1320,8 +1347,9 @@ add_test(function test_stk_event_download_idle_screen_available() {
|
|||
*/
|
||||
add_test(function test_stk_event_download_browser_termination() {
|
||||
let worker = newUint8SupportOutgoingIndexWorker();
|
||||
let buf = worker.Buf;
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
let buf = context.Buf;
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
|
||||
buf.sendParcel = function() {
|
||||
// Type
|
||||
|
@ -1367,7 +1395,7 @@ add_test(function test_stk_event_download_browser_termination() {
|
|||
eventType: STK_EVENT_TYPE_BROWSER_TERMINATION,
|
||||
terminationCause: STK_BROWSER_TERMINATION_CAUSE_USER
|
||||
};
|
||||
worker.RIL.sendStkEventDownload({
|
||||
context.RIL.sendStkEventDownload({
|
||||
event: event
|
||||
});
|
||||
});
|
||||
|
|
|
@ -29,14 +29,15 @@ function _getWorker() {
|
|||
add_test(function test_setVoicePrivacyMode_success() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.RIL.setVoicePrivacyMode = function fakeSetVoicePrivacyMode(options) {
|
||||
worker.RIL[REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE](0, {
|
||||
context.RIL.setVoicePrivacyMode = function fakeSetVoicePrivacyMode(options) {
|
||||
context.RIL[REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE](0, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.setVoicePrivacyMode({
|
||||
context.RIL.setVoicePrivacyMode({
|
||||
enabled: true
|
||||
});
|
||||
|
||||
|
@ -50,14 +51,15 @@ add_test(function test_setVoicePrivacyMode_success() {
|
|||
add_test(function test_setVoicePrivacyMode_generic_failure() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.RIL.setVoicePrivacyMode = function fakeSetVoicePrivacyMode(options) {
|
||||
worker.RIL[REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE](0, {
|
||||
context.RIL.setVoicePrivacyMode = function fakeSetVoicePrivacyMode(options) {
|
||||
context.RIL[REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE](0, {
|
||||
rilRequestError: ERROR_GENERIC_FAILURE
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.setVoicePrivacyMode({
|
||||
context.RIL.setVoicePrivacyMode({
|
||||
enabled: true
|
||||
});
|
||||
|
||||
|
@ -71,18 +73,19 @@ add_test(function test_setVoicePrivacyMode_generic_failure() {
|
|||
add_test(function test_queryVoicePrivacyMode_success_enabled_true() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.Buf.readInt32List = function fakeReadUint32List() {
|
||||
context.Buf.readInt32List = function fakeReadUint32List() {
|
||||
return [1];
|
||||
};
|
||||
|
||||
worker.RIL.queryVoicePrivacyMode = function fakeQueryVoicePrivacyMode(options) {
|
||||
worker.RIL[REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE](1, {
|
||||
context.RIL.queryVoicePrivacyMode = function fakeQueryVoicePrivacyMode(options) {
|
||||
context.RIL[REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE](1, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.queryVoicePrivacyMode();
|
||||
context.RIL.queryVoicePrivacyMode();
|
||||
|
||||
let postedMessage = workerHelper.postedMessage;
|
||||
|
||||
|
@ -94,18 +97,19 @@ add_test(function test_queryVoicePrivacyMode_success_enabled_true() {
|
|||
add_test(function test_queryVoicePrivacyMode_success_enabled_false() {
|
||||
let workerHelper = _getWorker();
|
||||
let worker = workerHelper.worker;
|
||||
let context = worker.ContextPool._contexts[0];
|
||||
|
||||
worker.Buf.readInt32List = function fakeReadUint32List() {
|
||||
context.Buf.readInt32List = function fakeReadUint32List() {
|
||||
return [0];
|
||||
};
|
||||
|
||||
worker.RIL.queryVoicePrivacyMode = function fakeQueryVoicePrivacyMode(options) {
|
||||
worker.RIL[REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE](1, {
|
||||
context.RIL.queryVoicePrivacyMode = function fakeQueryVoicePrivacyMode(options) {
|
||||
context.RIL[REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE](1, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.queryVoicePrivacyMode();
|
||||
context.RIL.queryVoicePrivacyMode();
|
||||
|
||||
let postedMessage = workerHelper.postedMessage;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче