2013-02-08 08:03:36 +04:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
2014-11-06 07:09:56 +03:00
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
2013-02-08 08:03:36 +04:00
|
|
|
|
2014-11-06 07:09:56 +03:00
|
|
|
MARIONETTE_TIMEOUT = 60000;
|
|
|
|
MARIONETTE_HEAD_JS = "head.js";
|
2013-02-08 08:03:36 +04:00
|
|
|
|
2014-11-06 07:09:56 +03:00
|
|
|
const TEST_DATA = [
|
2013-02-08 08:03:36 +04:00
|
|
|
{command: "d01b810301140082028183850953656e642044544d46ac052143658709",
|
2014-11-06 07:09:56 +03:00
|
|
|
expect: {commandQualifier: 0x00,
|
2013-02-08 08:03:36 +04:00
|
|
|
text: "Send DTMF"}},
|
2014-07-14 13:06:45 +04:00
|
|
|
{command: "d010810301140082028183ac052143658709",
|
2014-11-06 07:09:56 +03:00
|
|
|
expect: {commandQualifier: 0x00}},
|
2013-02-08 08:03:36 +04:00
|
|
|
{command: "d0138103011400820281838500ac06c1cccccccc2c",
|
2014-11-06 07:09:56 +03:00
|
|
|
expect: {commandQualifier: 0x00,
|
2013-02-08 08:03:36 +04:00
|
|
|
text: ""}},
|
|
|
|
{command: "d01d810301140082028183850a42617369632049636f6eac02c1f29e020001",
|
2014-11-06 07:09:56 +03:00
|
|
|
expect: {commandQualifier: 0x00,
|
2014-08-25 06:32:35 +04:00
|
|
|
text: "Basic Icon",
|
|
|
|
iconSelfExplanatory: true,
|
2014-11-06 07:09:56 +03:00
|
|
|
icons: [BASIC_ICON]}},
|
2014-08-25 06:32:35 +04:00
|
|
|
{command: "d011810301140082028183ac02c1f29e020005",
|
2014-11-06 07:09:56 +03:00
|
|
|
expect: {commandQualifier: 0x00,
|
2014-08-25 06:32:35 +04:00
|
|
|
iconSelfExplanatory: true,
|
2014-11-06 07:09:56 +03:00
|
|
|
icons: [COLOR_TRANSPARENCY_ICON]}},
|
2013-02-08 08:03:36 +04:00
|
|
|
{command: "d028810301140082028183851980041704140420041004120421042204120423041904220415ac02c1f2",
|
2014-11-06 07:09:56 +03:00
|
|
|
expect: {commandQualifier: 0x00,
|
2013-02-08 08:03:36 +04:00
|
|
|
text: "ЗДРАВСТВУЙТЕ"}},
|
|
|
|
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b00b4",
|
2014-11-06 07:09:56 +03:00
|
|
|
expect: {commandQualifier: 0x00,
|
2013-02-08 08:03:36 +04:00
|
|
|
text: "Send DTMF 1"}},
|
|
|
|
{command: "d0148103011400820281838505804f60597dac02c1f2",
|
2014-11-06 07:09:56 +03:00
|
|
|
expect: {commandQualifier: 0x00,
|
2013-02-08 08:03:36 +04:00
|
|
|
text: "你好"}},
|
|
|
|
];
|
|
|
|
|
2014-11-06 07:09:56 +03:00
|
|
|
function testSendDTMF(aCommand, aExpect) {
|
|
|
|
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_DTMF, "typeOfCommand");
|
|
|
|
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
|
|
|
|
|
|
|
|
if (aExpect.text) {
|
|
|
|
is(aCommand.options.text, aExpect.text, "options.text");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aExpect.icons) {
|
|
|
|
isIcons(aCommand.options.icons, aExpect.icons);
|
|
|
|
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
|
|
|
|
"options.iconSelfExplanatory");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Start tests
|
|
|
|
startTestCommon(function() {
|
|
|
|
let icc = getMozIcc();
|
|
|
|
let promise = Promise.resolve();
|
|
|
|
for (let i = 0; i < TEST_DATA.length; i++) {
|
|
|
|
let data = TEST_DATA[i];
|
|
|
|
promise = promise.then(() => {
|
|
|
|
log("send_dtmf_cmd: " + data.command);
|
|
|
|
|
|
|
|
let promises = [];
|
|
|
|
// Wait onstkcommand event.
|
|
|
|
promises.push(waitForTargetEvent(icc, "stkcommand")
|
|
|
|
.then((aEvent) => testSendDTMF(aEvent.command, data.expect)));
|
|
|
|
// Send emulator command to generate stk unsolicited event.
|
|
|
|
promises.push(sendEmulatorStkPdu(data.command));
|
|
|
|
|
|
|
|
return Promise.all(promises);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return promise;
|
|
|
|
});
|