mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 814637 - Part 6: Marionette tests changes for new IccManager API. r=hsinyi
This commit is contained in:
parent
849a9230e3
commit
5a7cba4ad2
@ -3,9 +3,24 @@
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
let icc = navigator.mozIccManager;
|
||||
ok(icc instanceof MozIccManager,
|
||||
"icc is instanceof " + icc.constructor);
|
||||
let iccManager = navigator.mozIccManager;
|
||||
ok(iccManager instanceof MozIccManager,
|
||||
"iccManager is instanceof " + iccManager.constructor);
|
||||
|
||||
// TODO: Bug 932650 - B2G RIL: WebIccManager API - add marionette tests for
|
||||
// multi-sim
|
||||
// In single sim scenario, there is only one sim card, we can use below way to
|
||||
// check iccId and get icc object. But in multi-sim, the index of iccIds may
|
||||
// not map to sim slot directly, we should have a better way to handle this.
|
||||
let iccIds = iccManager.iccIds;
|
||||
ok(Array.isArray(iccIds), "iccIds is an array");
|
||||
is(iccIds.length, 1, "iccIds.length is " + iccIds.length);
|
||||
|
||||
let iccId = iccIds[0];
|
||||
is(iccId, "89014103211118510720", "iccId is " + iccId);
|
||||
|
||||
let icc = iccManager.getIccById(iccId);
|
||||
ok(icc instanceof MozIcc, "icc is instanceof " + icc.constructor);
|
||||
|
||||
/* Remove permission and execute finish() */
|
||||
let cleanUp = function () {
|
||||
|
@ -22,3 +22,7 @@ qemu = true
|
||||
[test_stk_select_item.js]
|
||||
[test_stk_setup_menu.js]
|
||||
[test_stk_setup_idle_mode_text.js]
|
||||
[test_icc_access_invalid_object.js]
|
||||
disabled = Bug 933654
|
||||
[test_icc_detected_undetected_event.js]
|
||||
disabled = Bug 933654
|
||||
|
@ -5,8 +5,24 @@ MARIONETTE_TIMEOUT = 30000;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
let icc = navigator.mozIccManager;
|
||||
ok(icc instanceof MozIccManager, "icc is instanceof " + icc.constructor);
|
||||
let iccManager = navigator.mozIccManager;
|
||||
ok(iccManager instanceof MozIccManager,
|
||||
"iccManager is instanceof " + iccManager.constructor);
|
||||
|
||||
// TODO: Bug 932650 - B2G RIL: WebIccManager API - add marionette tests for
|
||||
// multi-sim
|
||||
// In single sim scenario, there is only one sim card, we can use below way to
|
||||
// check iccId and get icc object. But in multi-sim, the index of iccIds may
|
||||
// not map to sim slot directly, we should have a better way to handle this.
|
||||
let iccIds = iccManager.iccIds;
|
||||
ok(Array.isArray(iccIds), "iccIds is an array");
|
||||
is(iccIds.length, 1, "iccIds.length is " + iccIds.length);
|
||||
|
||||
let iccId = iccIds[0];
|
||||
is(iccId, "89014103211118510720", "iccId is " + iccId);
|
||||
|
||||
let icc = iccManager.getIccById(iccId);
|
||||
ok(icc instanceof MozIcc, "icc is instanceof " + icc.constructor);
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
function sendStkPduToEmulator(command, func, expect) {
|
||||
|
121
dom/icc/tests/marionette/test_icc_access_invalid_object.js
Normal file
121
dom/icc/tests/marionette/test_icc_access_invalid_object.js
Normal file
@ -0,0 +1,121 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
MARIONETTE_HEAD_JS = "icc_header.js";
|
||||
|
||||
function setRadioEnabled(enabled) {
|
||||
SpecialPowers.addPermission("settings-write", true, document);
|
||||
|
||||
// TODO: Bug 856553 - [B2G] RIL: need an API to enable/disable radio
|
||||
let settings = navigator.mozSettings;
|
||||
let setLock = settings.createLock();
|
||||
let obj = {
|
||||
"ril.radio.disabled": !enabled
|
||||
};
|
||||
let setReq = setLock.set(obj);
|
||||
|
||||
setReq.addEventListener("success", function onSetSuccess() {
|
||||
log("set 'ril.radio.disabled' to " + enabled);
|
||||
});
|
||||
|
||||
setReq.addEventListener("error", function onSetError() {
|
||||
ok(false, "cannot set 'ril.radio.disabled' to " + enabled);
|
||||
});
|
||||
|
||||
SpecialPowers.removePermission("settings-write", document);
|
||||
}
|
||||
|
||||
/* Test access invalid icc object */
|
||||
taskHelper.push(function testAccessRemovedIccObject() {
|
||||
setRadioEnabled(false);
|
||||
iccManager.addEventListener("iccundetected", function oniccundetected(evt) {
|
||||
log("got icc undetected event");
|
||||
iccManager.removeEventListener("iccundetected", oniccundetected);
|
||||
is(evt.iccId, iccId, "icc " + evt.iccId + " becomes undetected");
|
||||
|
||||
// Test access iccInfo.
|
||||
try {
|
||||
is(icc.iccInfo, null, "iccInfo: expect to get null");
|
||||
} catch(e) {
|
||||
ok(false, "access iccInfo should not get exception");
|
||||
}
|
||||
|
||||
// Test access cardState.
|
||||
try {
|
||||
is(icc.cardState, null, "cardState: expect to get null");
|
||||
} catch(e) {
|
||||
ok(false, "access cardState should not get exception");
|
||||
}
|
||||
|
||||
// Test STK related function.
|
||||
try {
|
||||
icc.sendStkResponse({}, {});
|
||||
ok(false, "sendStkResponse() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
icc.sendStkMenuSelection(0, false);
|
||||
ok(false, "sendStkMenuSelection() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
icc.sendStkTimerExpiration({});
|
||||
ok(false, "sendStkTimerExpiration() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
icc.sendStkEventDownload({});
|
||||
ok(false, "sendStkEventDownload() should get exception");
|
||||
} catch(e) {}
|
||||
|
||||
// Test card lock related function.
|
||||
try {
|
||||
icc.getCardLock("");
|
||||
ok(false, "getCardLock() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
icc.unlockCardLock({});
|
||||
ok(false, "unlockCardLock() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
icc.setCardLock({});
|
||||
ok(false, "setCardLock() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
icc.getCardLockRetryCount("");
|
||||
ok(false, "getCardLockRetryCount() should get exception");
|
||||
} catch(e) {}
|
||||
|
||||
// Test contact related function.
|
||||
try {
|
||||
icc.readContacts("");
|
||||
ok(false, "readContacts() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
icc.updateContact("", {});
|
||||
ok(false, "updateContact() should get exception");
|
||||
} catch(e) {}
|
||||
|
||||
// Test secure element related function.
|
||||
try {
|
||||
icc.iccOpenChannel("");
|
||||
ok(false, "iccOpenChannel() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
icc.iccExchangeAPDU(0, {});
|
||||
ok(false, "iccExchangeAPDU() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
icc.iccCloseChannel(0);
|
||||
ok(false, "iccCloseChannel() should get exception");
|
||||
} catch(e) {}
|
||||
|
||||
// We should restore the radio status.
|
||||
setRadioEnabled(true);
|
||||
iccManager.addEventListener("iccdetected", function oniccdetected(evt) {
|
||||
iccManager.removeEventListener("iccdetected", oniccdetected);
|
||||
taskHelper.runNext();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Start test
|
||||
taskHelper.runNext();
|
@ -41,14 +41,12 @@ taskHelper.push(function testCardStateChange() {
|
||||
// Expect to get card state changing to null.
|
||||
if (icc.cardState === null) {
|
||||
icc.removeEventListener("cardstatechange", oncardstatechange);
|
||||
// We should restore radio status and wait for the cardstatechange event.
|
||||
// We should restore radio status and expect to get iccdetected event.
|
||||
setRadioEnabled(true);
|
||||
icc.addEventListener("cardstatechange", function oncardstatechange(evt) {
|
||||
log("card state changes to " + icc.cardState);
|
||||
if (icc.cardState === 'ready') {
|
||||
icc.removeEventListener("cardstatechange", oncardstatechange);
|
||||
taskHelper.runNext();
|
||||
}
|
||||
iccManager.addEventListener("iccdetected", function oniccdetected(evt) {
|
||||
log("icc iccdetected: " + evt.iccId);
|
||||
iccManager.removeEventListener("iccdetected", oniccdetected);
|
||||
taskHelper.runNext();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -0,0 +1,72 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
MARIONETTE_HEAD_JS = "icc_header.js";
|
||||
|
||||
function setRadioEnabled(enabled) {
|
||||
SpecialPowers.addPermission("settings-write", true, document);
|
||||
|
||||
// TODO: Bug 856553 - [B2G] RIL: need an API to enable/disable radio
|
||||
let settings = navigator.mozSettings;
|
||||
let setLock = settings.createLock();
|
||||
let obj = {
|
||||
"ril.radio.disabled": !enabled
|
||||
};
|
||||
let setReq = setLock.set(obj);
|
||||
|
||||
setReq.addEventListener("success", function onSetSuccess() {
|
||||
log("set 'ril.radio.disabled' to " + enabled);
|
||||
});
|
||||
|
||||
setReq.addEventListener("error", function onSetError() {
|
||||
ok(false, "cannot set 'ril.radio.disabled' to " + enabled);
|
||||
});
|
||||
|
||||
SpecialPowers.removePermission("settings-write", document);
|
||||
}
|
||||
|
||||
/* Test iccundetected event */
|
||||
taskHelper.push(function testIccUndetectedEvent() {
|
||||
setRadioEnabled(false);
|
||||
iccManager.addEventListener("iccundetected", function oniccundetected(evt) {
|
||||
log("got icc undetected event");
|
||||
iccManager.removeEventListener("iccundetected", oniccundetected);
|
||||
|
||||
// TODO: Bug 932650 - B2G RIL: WebIccManager API - add marionette tests for
|
||||
// multi-sim
|
||||
// In single sim scenario, there is only one sim card, we can use below way
|
||||
// to check iccIds.
|
||||
is(evt.iccId, iccId, "icc " + evt.iccId + " becomes undetected");
|
||||
is(iccManager.iccIds.length, 0,
|
||||
"iccIds.length becomes to " + iccManager.iccIds.length);
|
||||
is(iccManager.getIccById(evt.iccId), null,
|
||||
"should not get a valid icc object here");
|
||||
|
||||
taskHelper.runNext();
|
||||
});
|
||||
});
|
||||
|
||||
/* Test iccdetected event */
|
||||
taskHelper.push(function testIccDetectedEvent() {
|
||||
setRadioEnabled(true);
|
||||
iccManager.addEventListener("iccdetected", function oniccdetected(evt) {
|
||||
log("got icc detected event");
|
||||
iccManager.removeEventListener("iccdetected", oniccdetected);
|
||||
|
||||
// TODO: Bug 932650 - B2G RIL: WebIccManager API - add marionette tests for
|
||||
// multi-sim
|
||||
// In single sim scenario, there is only one sim card, we can use below way
|
||||
// to check iccIds.
|
||||
is(evt.iccId, iccId, "icc " + evt.iccId + " is detected");
|
||||
is(iccManager.iccIds.length, 1,
|
||||
"iccIds.length becomes to " + iccManager.iccIds.length);
|
||||
ok(iccManager.getIccById(evt.iccId) instanceof MozIcc,
|
||||
"should get a valid icc object here");
|
||||
|
||||
taskHelper.runNext();
|
||||
});
|
||||
});
|
||||
|
||||
// Start test
|
||||
taskHelper.runNext();
|
@ -96,14 +96,12 @@ taskHelper.push(function testCardIsNotReady() {
|
||||
// Expect iccInfo changes to null
|
||||
if (icc.iccInfo === null) {
|
||||
icc.removeEventListener("iccinfochange", oniccinfochange);
|
||||
// We should restore radio status and wait for the cardstatechange event.
|
||||
// We should restore radio status and expect to get iccdetected event.
|
||||
setRadioEnabled(true);
|
||||
icc.addEventListener("cardstatechange", function oncardstatechange(evt) {
|
||||
log("card state changes to " + icc.cardState);
|
||||
if (icc.cardState === 'ready') {
|
||||
icc.removeEventListener("cardstatechange", oncardstatechange);
|
||||
taskHelper.runNext();
|
||||
}
|
||||
iccManager.addEventListener("iccdetected", function oniccdetected(evt) {
|
||||
log("icc detected: " + evt.iccId);
|
||||
iccManager.removeEventListener("iccdetected", oniccdetected);
|
||||
taskHelper.runNext();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -5,7 +5,7 @@ MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
|
||||
function testDisplayText(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_DISPLAY_TEXT, expect.name);
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_DISPLAY_TEXT, expect.name);
|
||||
is(command.options.text, expect.text, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.userClear, expect.userClear, expect.name);
|
||||
@ -87,7 +87,7 @@ let tests = [
|
||||
commandQualifier: 0x80,
|
||||
text: "10 Second",
|
||||
userClear: true,
|
||||
duration: {timeUnit: icc.STK_TIME_UNIT_SECOND,
|
||||
duration: {timeUnit: iccManager.STK_TIME_UNIT_SECOND,
|
||||
timeInterval: 0x0A}}},
|
||||
];
|
||||
|
||||
|
@ -5,7 +5,7 @@ MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
|
||||
function testGetInKey(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_GET_INKEY, expect.name);
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_GET_INKEY, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.text, expect.text, expect.name);
|
||||
is(command.options.isAlphabet, expect.isAlphabet, expect.name);
|
||||
@ -98,7 +98,7 @@ let tests = [
|
||||
expect: {name: "get_inkey_cmd_14",
|
||||
commandQualifier: 0x00,
|
||||
text: "Enter \"+\"",
|
||||
duration: {timeUnit: icc.STK_TIME_UNIT_SECOND,
|
||||
duration: {timeUnit: iccManager.STK_TIME_UNIT_SECOND,
|
||||
timeInterval: 0x0A}}},
|
||||
];
|
||||
|
||||
|
@ -5,7 +5,7 @@ MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
|
||||
function testGetInput(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_GET_INPUT, expect.name);
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_GET_INPUT, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.text, expect.text, expect.name);
|
||||
is(command.options.minLength, expect.minLength, expect.name);
|
||||
|
@ -5,7 +5,7 @@ MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
|
||||
function testLaunchBrowser(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_LAUNCH_BROWSER, expect.name);
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_LAUNCH_BROWSER, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.url, expect.url, expect.name);
|
||||
if (command.options.confirmMessage) {
|
||||
|
@ -5,7 +5,7 @@ MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
|
||||
function testPollOff(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_POLL_OFF, expect.name);
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_POLL_OFF, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
|
||||
runNextTest();
|
||||
|
@ -5,47 +5,47 @@ MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
|
||||
function testLocalInfoLocation(cmd) {
|
||||
log("STK CMD " + JSON.stringify(cmd));
|
||||
is(cmd.typeOfCommand, icc.STK_CMD_PROVIDE_LOCAL_INFO);
|
||||
is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO);
|
||||
is(cmd.commandNumber, 0x01);
|
||||
is(cmd.commandQualifier, icc.STK_LOCAL_INFO_LOCATION_INFO);
|
||||
is(cmd.options.localInfoType, icc.STK_LOCAL_INFO_LOCATION_INFO);
|
||||
is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_LOCATION_INFO);
|
||||
is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_LOCATION_INFO);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
function testLocalInfoImei(cmd) {
|
||||
log("STK CMD " + JSON.stringify(cmd));
|
||||
is(cmd.typeOfCommand, icc.STK_CMD_PROVIDE_LOCAL_INFO);
|
||||
is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO);
|
||||
is(cmd.commandNumber, 0x01);
|
||||
is(cmd.commandQualifier, icc.STK_LOCAL_INFO_IMEI);
|
||||
is(cmd.options.localInfoType, icc.STK_LOCAL_INFO_IMEI);
|
||||
is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_IMEI);
|
||||
is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_IMEI);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
function testLocalInfoDate(cmd) {
|
||||
log("STK CMD " + JSON.stringify(cmd));
|
||||
is(cmd.typeOfCommand, icc.STK_CMD_PROVIDE_LOCAL_INFO);
|
||||
is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO);
|
||||
is(cmd.commandNumber, 0x01);
|
||||
is(cmd.commandQualifier, icc.STK_LOCAL_INFO_DATE_TIME_ZONE);
|
||||
is(cmd.options.localInfoType, icc.STK_LOCAL_INFO_DATE_TIME_ZONE);
|
||||
is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_DATE_TIME_ZONE);
|
||||
is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_DATE_TIME_ZONE);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
function testLocalInfoLanguage(cmd) {
|
||||
log("STK CMD " + JSON.stringify(cmd));
|
||||
is(cmd.typeOfCommand, icc.STK_CMD_PROVIDE_LOCAL_INFO);
|
||||
is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO);
|
||||
is(cmd.commandNumber, 0x01);
|
||||
is(cmd.commandQualifier, icc.STK_LOCAL_INFO_LANGUAGE);
|
||||
is(cmd.options.localInfoType, icc.STK_LOCAL_INFO_LANGUAGE);
|
||||
is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_LANGUAGE);
|
||||
is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_LANGUAGE);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
function testRefresh(cmd) {
|
||||
log("STK CMD " + JSON.stringify(cmd));
|
||||
is(cmd.typeOfCommand, icc.STK_CMD_REFRESH);
|
||||
is(cmd.typeOfCommand, iccManager.STK_CMD_REFRESH);
|
||||
is(cmd.commandNumber, 0x01);
|
||||
is(cmd.commandQualifier, 0x01);
|
||||
is(cmd.options, null);
|
||||
@ -55,10 +55,10 @@ function testRefresh(cmd) {
|
||||
|
||||
function testTimerManagementStart(cmd) {
|
||||
log("STK CMD " + JSON.stringify(cmd));
|
||||
is(cmd.typeOfCommand, icc.STK_CMD_TIMER_MANAGEMENT);
|
||||
is(cmd.typeOfCommand, iccManager.STK_CMD_TIMER_MANAGEMENT);
|
||||
is(cmd.commandNumber, 0x01);
|
||||
is(cmd.commandQualifier, icc.STK_TIMER_START);
|
||||
is(cmd.options.timerAction, icc.STK_TIMER_START);
|
||||
is(cmd.commandQualifier, iccManager.STK_TIMER_START);
|
||||
is(cmd.options.timerAction, iccManager.STK_TIMER_START);
|
||||
is(cmd.options.timerId, 0x01);
|
||||
is(cmd.options.timerValue, (0x01 * 60 * 60) + (0x02 * 60) + 0x03);
|
||||
|
||||
@ -67,10 +67,10 @@ function testTimerManagementStart(cmd) {
|
||||
|
||||
function testTimerManagementDeactivate(cmd) {
|
||||
log("STK CMD " + JSON.stringify(cmd));
|
||||
is(cmd.typeOfCommand, icc.STK_CMD_TIMER_MANAGEMENT);
|
||||
is(cmd.typeOfCommand, iccManager.STK_CMD_TIMER_MANAGEMENT);
|
||||
is(cmd.commandNumber, 0x01);
|
||||
is(cmd.commandQualifier, icc.STK_TIMER_DEACTIVATE);
|
||||
is(cmd.options.timerAction, icc.STK_TIMER_DEACTIVATE);
|
||||
is(cmd.commandQualifier, iccManager.STK_TIMER_DEACTIVATE);
|
||||
is(cmd.options.timerAction, iccManager.STK_TIMER_DEACTIVATE);
|
||||
is(cmd.options.timerId, 0x04);
|
||||
|
||||
runNextTest();
|
||||
@ -78,10 +78,10 @@ function testTimerManagementDeactivate(cmd) {
|
||||
|
||||
function testTimerManagementGetCurrentValue(cmd) {
|
||||
log("STK CMD " + JSON.stringify(cmd));
|
||||
is(cmd.typeOfCommand, icc.STK_CMD_TIMER_MANAGEMENT);
|
||||
is(cmd.typeOfCommand, iccManager.STK_CMD_TIMER_MANAGEMENT);
|
||||
is(cmd.commandNumber, 0x01);
|
||||
is(cmd.commandQualifier, icc.STK_TIMER_GET_CURRENT_VALUE);
|
||||
is(cmd.options.timerAction, icc.STK_TIMER_GET_CURRENT_VALUE);
|
||||
is(cmd.commandQualifier, iccManager.STK_TIMER_GET_CURRENT_VALUE);
|
||||
is(cmd.options.timerAction, iccManager.STK_TIMER_GET_CURRENT_VALUE);
|
||||
is(cmd.options.timerId, 0x08);
|
||||
|
||||
runNextTest();
|
||||
|
@ -5,7 +5,7 @@ MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
|
||||
function testRefresh(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_REFRESH, expect.name);
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_REFRESH, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
|
||||
runNextTest();
|
||||
|
@ -5,7 +5,7 @@ MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
|
||||
function testSelectItem(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SELECT_ITEM, expect.name);
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SELECT_ITEM, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.title, expect.title, expect.name);
|
||||
for (let index in command.options.items) {
|
||||
|
@ -5,7 +5,7 @@ MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
|
||||
function testSendDTMF(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SEND_DTMF, expect.name);
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SEND_DTMF, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
if (command.options.text) {
|
||||
is(command.options.text, expect.text, expect.name);
|
||||
|
@ -5,7 +5,7 @@ MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
|
||||
function testSendSMS(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SEND_SMS, expect.name);
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SEND_SMS, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
if (command.options.text) {
|
||||
is(command.options.text, expect.title, expect.name);
|
||||
|
@ -5,7 +5,7 @@ MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
|
||||
function testSendSS(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SEND_SS, expect.name);
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SEND_SS, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
if (command.options.text) {
|
||||
is(command.options.text, expect.title, expect.name);
|
||||
|
@ -5,7 +5,7 @@ MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
|
||||
function testSendUSSD(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SEND_USSD, expect.name);
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SEND_USSD, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
if (command.options.text) {
|
||||
is(command.options.text, expect.title, expect.name);
|
||||
|
@ -5,7 +5,7 @@ MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
|
||||
function testSetupCall(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SET_UP_CALL, expect.name);
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SET_UP_CALL, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.confirmMessage, expect.confirmMessage, expect.name);
|
||||
is(command.options.address, expect.address, expect.name);
|
||||
@ -68,7 +68,7 @@ let tests = [
|
||||
commandQualifier: 0x01,
|
||||
confirmMessage: "Duration",
|
||||
address: "+012340123456,1,2",
|
||||
duration: {timeUnit: icc.STK_TIME_UNIT_SECOND,
|
||||
duration: {timeUnit: iccManager.STK_TIME_UNIT_SECOND,
|
||||
timeInterval: 0x0A}}},
|
||||
{command: "d028810301100082028183850c434f4e4649524d4154494f4e8609911032042143651c2c850443414c4c",
|
||||
func: testSetupCall,
|
||||
@ -336,7 +336,7 @@ let tests = [
|
||||
commandQualifier: 0x00,
|
||||
confirmMessage: "Not busy",
|
||||
address: "+012340123456,1,2",
|
||||
duration: {timeUnit: icc.STK_TIME_UNIT_SECOND,
|
||||
duration: {timeUnit: iccManager.STK_TIME_UNIT_SECOND,
|
||||
timeInterval: 0x0A}}},
|
||||
|
||||
];
|
||||
|
@ -5,7 +5,7 @@ MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
|
||||
function testSetupEventList(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SET_UP_EVENT_LIST, expect.name);
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SET_UP_EVENT_LIST, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
for (let index in command.options.eventList) {
|
||||
is(command.options.eventList[index], expect.eventList[index], expect.name);
|
||||
|
@ -5,7 +5,7 @@ MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
|
||||
function testSetupIdleModeText(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SET_UP_IDLE_MODE_TEXT, expect.name);
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SET_UP_IDLE_MODE_TEXT, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.text, expect.text, expect.name);
|
||||
|
||||
|
@ -5,7 +5,7 @@ MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
|
||||
function testSetupMenu(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SET_UP_MENU, expect.name);
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SET_UP_MENU, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.title, expect.title, expect.name);
|
||||
for (let index in command.options.items) {
|
||||
@ -22,14 +22,14 @@ function isFirstMenuItemNull(command) {
|
||||
|
||||
function testInitialSetupMenu(command) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SET_UP_MENU);
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SET_UP_MENU);
|
||||
is(isFirstMenuItemNull(command), false);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
function testRemoveSetupMenu(command) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SET_UP_MENU);
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SET_UP_MENU);
|
||||
is(isFirstMenuItemNull(command), true);
|
||||
|
||||
runNextTest();
|
||||
|
@ -26,14 +26,13 @@ function changeSetting(key, value, callback) {
|
||||
|
||||
function setRadioEnabled(enabled, callback) {
|
||||
changeSetting("ril.radio.disabled", !enabled, function() {
|
||||
icc.addEventListener("cardstatechange", function handler() {
|
||||
// Wait until card state changes to "ready" after turning on radio.
|
||||
// Wait until card state changes to "not-ready" after turning off radio.
|
||||
if ((enabled && icc.cardState == "ready") ||
|
||||
(!enabled && icc.cardState != "ready")) {
|
||||
icc.removeEventListener("cardstatechange", handler);
|
||||
callback();
|
||||
}
|
||||
// Wait for iccdetected event after turning on radio.
|
||||
// Wait for iccundetected event after turning off radio.
|
||||
let event = (enabled) ? "iccdetected" : "iccundetected";
|
||||
icc.addEventListener(event, function handler(evt) {
|
||||
log(event + ": " + evt.iccId);
|
||||
icc.removeEventListener(event, handler);
|
||||
callback();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user