Bug 1123624 - Part 2-2: Wrapping and mofiying the test data in test_stk_*.js. r=bevis

This commit is contained in:
Edgar Chen 2015-02-04 17:46:27 +08:00
Родитель c365ee709e
Коммит 1637825d9b
18 изменённых файлов: 1557 добавлений и 381 удалений

Просмотреть файл

@ -6,36 +6,102 @@ MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
// Open channel.
{command: "d04f81030140018202818205074f70656e204944350702030403041f0239020578470a065465737447700272730d08f4557365724c6f670d08f4557365725077643c0301ad9c3e0521010101019e020007",
{command: "D02E" + // Length
"8103014001" + // Command details
"82028182" + // Device identities
"05074F70656E204944" + // Alpha identifier
"9E020007" + // Icon identifier
"86099111223344556677F8" + // Address
"350702030403041F02" + // Bear description
"39020578", // Buffer size
expect: {typeOfCommand: MozIccManager.STK_CMD_OPEN_CHANNEL,
commandQualifier: 0x01,
text: "Open ID",
iconSelfExplanatory: true,
icons: [COLOR_ICON, COLOR_TRANSPARENCY_ICON]}},
{command: "d0448103014001820281820500350702030403041f0239020578470a065465737447700272730d08f4557365724c6f670d08f4557365725077643c0301ad9c3e052101010101",
{command: "D023" + // Length
"8103014001" + // Command details
"82028182" + // Device identities
"0500" + // Alpha identifier
"86099111223344556677F8" + // Address
"350702030403041F02" + // Bear description
"39020578", // Buffer size
expect: {typeOfCommand: MozIccManager.STK_CMD_OPEN_CHANNEL,
commandQualifier: 0x01,
text: ""}},
{command: "d05381030140018202818205094f70656e2049442031350702030403041f0239020578470a065465737447700272730d08f4557365724c6f670d08f4557365725077643c0301ad9c3e052101010101d004000900b4",
{command: "D02C" + // Length
"8103014001" + // Command details
"82028182" + // Device identities
"05094F70656E2049442031" + // Alpha identifier
"86099111223344556677F8" + // Address
"350702030403041F02" + // Bear description
"39020578", // Buffer size
expect: {typeOfCommand: MozIccManager.STK_CMD_OPEN_CHANNEL,
commandQualifier: 0x01,
text: "Open ID 1"}},
// Close channel.
{command: "d01b810301410082028121850a436c6f73652049442031d004000a00b4",
{command: "D00D" + // Length
"8103014100" + // Command details
"82028182" + // Device identities
"9E020007", // Icon identifier
expect: {typeOfCommand: MozIccManager.STK_CMD_CLOSE_CHANNEL,
commandQualifier: 0x00,
iconSelfExplanatory: true,
icons: [COLOR_ICON, COLOR_TRANSPARENCY_ICON]}},
{command: "D015" + // Length
"8103014100" + // Command details
"82028121" + // Device identities
"850A436C6F73652049442031", // Alpha identifier
expect: {typeOfCommand: MozIccManager.STK_CMD_CLOSE_CHANNEL,
commandQualifier: 0x00,
text: "Close ID 1"}},
// Recive data.
{command: "d022810301420082028121850e5265636569766520446174612031b701c8d004000e00b4",
// Receive data.
{command: "D00C" + // Length
"8103014200" + // Command details
"82028121" + // Device identities
"B701C8", // Channel data length
expect: {typeOfCommand: MozIccManager.STK_CMD_RECEIVE_DATA,
commandQualifier: 0x00}},
{command: "D01C" + // Length
"8103014200" + // Command details
"82028121" + // Device identities
"850E5265636569766520446174612031" + // Alpha identifier
"B701C8", // Channel data length
expect: {typeOfCommand: MozIccManager.STK_CMD_RECEIVE_DATA,
commandQualifier: 0x00,
text: "Receive Data 1"}},
// Send data.
{command: "d026810301430182028121850b53656e6420446174612031b6080001020304050607d004000b00b4",
{command: "D017" + // Length
"8103014301" + // Command details
"82028121" + // Device identities
"9E020007" + // Icon identifier
"B6080001020304050607", // Channel data
expect: {typeOfCommand: MozIccManager.STK_CMD_SEND_DATA,
commandQualifier: 0x01,
iconSelfExplanatory: true,
icons: [COLOR_ICON, COLOR_TRANSPARENCY_ICON]}},
{command: "D020" + // Length
"8103014301" + // Command details
"82028121" + // Device identities
"850B53656E6420446174612031" + // Alpha identifier
"B6080001020304050607", // Channel data
expect: {typeOfCommand: MozIccManager.STK_CMD_SEND_DATA,
commandQualifier: 0x01,
text: "Send Data 1"}},
];
function testBipCommand(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, aExpect.typeOfCommand, "typeOfCommand");
is(aCommand.options.text, aExpect.text, "options.text");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
if (aExpect.icons) {
// text is optional.
if ("text" in aExpect) {
is(aCommand.options.text, aExpect.text, "options.text");
}
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");

Просмотреть файл

@ -5,139 +5,176 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d01a8103012180820281028d0f04546f6f6c6b697420546573742031",
expect: {commandQualifier: 0x80,
{command: "D01A" + // Length
"8103012101" + // Command details
"82028102" + // Device identities
"8D0F04546F6F6C6B697420546573742031", // Text string
expect: {commandQualifier: 0x01,
text: "Toolkit Test 1",
userClear: true}},
{command: "d01a8103012181820281028d0f04546f6f6c6b697420546573742032",
responseNeeded: false}},
{command: "D01C" + // Length
"8103012181" + // Command details
"82028102" + // Device identities
"8D0F04546F6F6C6B697420546573742032" + // Text string
"2B00", // Immediate response
expect: {commandQualifier: 0x81,
text: "Toolkit Test 2",
isHighPriority: true,
userClear: true}},
{command: "d081ad8103012180820281028d81a1045468697320636f6d6d616e6420696e7374727563747320746865204d4520746f20646973706c617920612074657874206d6573736167652e20497420616c6c6f7773207468652053494d20746f20646566696e6520746865207072696f72697479206f662074686174206d6573736167652c20616e6420746865207465787420737472696e6720666f726d61742e2054776f207479706573206f66207072696f",
responseNeeded: true}},
{command: "D081AD" + // Length
"8103012180" + // Command details
"82028102" + // Device identities
"8D81A1045468697320636F6D6D616E6420696E73747275" + // Text string
"63747320746865204D4520746F20646973706C61792061" +
"2074657874206D6573736167652E20497420616C6C6F77" +
"73207468652053494D20746F20646566696E6520746865" +
"207072696F72697479206F662074686174206D65737361" +
"67652C20616E6420746865207465787420737472696E67" +
"20666F726D61742E2054776F207479706573206F662070" +
"72696F",
expect: {commandQualifier: 0x80,
text: "This command instructs the ME to display a text message. It allows the SIM to define the priority of that message, and the text string format. Two types of prio",
userClear: true}},
{command: "d01a8103012180820281028d0f043c474f2d4241434b57415244533e",
text: "This command instructs the ME to display a text message. " +
"It allows the SIM to define the priority of that message," +
" and the text string format. Two types of prio",
responseNeeded: false}},
{command: "D01A" + // Length
"8103012180" + // Command details
"82028102" + // Device identities
"8D0F043C474F2D4241434B57415244533E", // Text string
expect: {commandQualifier: 0x80,
text: "<GO-BACKWARDS>",
userClear: true}},
{command: "d0248103012180820281028d1908041704140420041004120421042204120423041904220415",
responseNeeded: false}},
{command: "D024" + // Length
"8103012180" + // Command details
"82028102" + // Device identities
"8D19080417041404200410041204210422041204230419" + // Text string
"04220415",
expect: {commandQualifier: 0x80,
text: "ЗДРАВСТВУЙТЕ",
userClear: true}},
{command: "d0108103012180820281028d05084f60597d",
responseNeeded: false}},
{command: "D010" + // Length
"8103012180" + // Command details
"82028102" + // Device identities
"8D05084F60597D", // Text string
expect: {commandQualifier: 0x80,
text: "你好",
userClear: true}},
{command: "d0288103012180820281020d1d00d3309bfc06c95c301aa8e80259c3ec34b9ac07c9602f58ed159bb940",
responseNeeded: false}},
{command: "D028" + // Length
"8103012180" + // Command details
"82028102" + // Device identities
"0D1D00D3309BFC06C95C301AA8E80259C3EC34B9AC07C9" + // Text string
"602F58ED159BB940",
expect: {commandQualifier: 0x80,
text: "Saldo 2.04 E. Validez 20/05/13. ",
userClear: true}},
{command: "d0198103012180820281028D0A043130205365636F6E648402010A",
responseNeeded: false}},
{command: "D019" + // Length
"8103012180" + // Command details
"82028102" + // Device identities
"8D0A043130205365636F6E64" + // Text string
"8402010A", // Duration
expect: {commandQualifier: 0x80,
text: "10 Second",
userClear: true,
responseNeeded: false,
duration: {timeUnit: MozIccManager.STK_TIME_UNIT_SECOND,
timeInterval: 0x0A}}},
{command: "d01a8103012180820281028d0b0442617369632049636f6e9e020001",
{command: "D01A" + // Length
"8103012180" + // Command details
"82028102" + // Device identities
"8D0B0442617369632049636F6E" + // Text string
"9E020001", // Icon identifier
expect: {commandQualifier: 0x80,
text: "Basic Icon",
userClear: true,
responseNeeded: false,
iconSelfExplanatory: true,
icons: [BASIC_ICON]}},
{command: "D026810301210082028102" +
"8D" +
"1B" +
{command: "D026" + // Length
"8103012100" + // Command details
"82028102" + // Device identities
"8D1B" + // Text string
"00" + // 7BIT
"D4F79BBD4ED341D4F29C0E3A4A9F55A8" +
"0E8687C158A09B304905",
"D4F79BBD4ED341D4F29C0E3A4A9F55A80E8687C158A09B304905",
expect: {commandQualifier: 0x00,
text: "Toolkit Test GROUP:0x00, 7BIT"}},
{command: "D029810301210082028102" +
"8D" +
"1E" +
text: "Toolkit Test GROUP:0x00, 7BIT",
responseNeeded: false}},
{command: "D029" + // Length
"8103012100" + // Command details
"82028102" + // Device identities
"8D1E" + // Text string
"04" + // 8BIT
"546F6F6C6B697420546573742047524F" +
"55503A307830302C2038424954",
"546F6F6C6B697420546573742047524F55503A307830302C2038424954",
expect: {commandQualifier: 0x00,
text: "Toolkit Test GROUP:0x00, 8BIT"}},
{command: "D046810301210082028102" +
"8D" +
"3B" +
text: "Toolkit Test GROUP:0x00, 8BIT",
responseNeeded: false}},
{command: "D046" + // Length
"8103012100" + // Command details
"82028102" + // Device identities
"8D3B" + // Text string
"08" + // UCS2
"0054006F006F006C006B006900740020" +
"0054006500730074002000470052004F" +
"00550050003A0030007800300030002C" +
"00200055004300530032",
"0054006F006F006C006B0069007400200054006500730074002000470052004F" +
"00550050003A0030007800300030002C00200055004300530032",
expect: {commandQualifier: 0x00,
text: "Toolkit Test GROUP:0x00, UCS2"}},
{command: "D026810301210082028102" +
"8D" +
"1B" +
text: "Toolkit Test GROUP:0x00, UCS2",
responseNeeded: false}},
{command: "D026" + // Length
"8103012100" + // Command details
"82028102" + // Device identities
"8D1B" + // Text string
"12" + // 7BIT + Class 2
"D4F79BBD4ED341D4F29C0E3A4A9F55A8" +
"0E868FC158A09B304905",
"D4F79BBD4ED341D4F29C0E3A4A9F55A80E868FC158A09B304905",
expect: {commandQualifier: 0x00,
text: "Toolkit Test GROUP:0x10, 7BIT"}},
{command: "D029810301210082028102" +
"8D" +
"1E" +
text: "Toolkit Test GROUP:0x10, 7BIT",
responseNeeded: false}},
{command: "D029" + // Length
"8103012100" + // Command details
"82028102" + // Device identities
"8D1E" + // Text string
"16" + // 8BIT + Class 2
"546F6F6C6B697420546573742047524F" +
"55503A307831302C2038424954",
"546F6F6C6B697420546573742047524F55503A307831302C2038424954",
expect: {commandQualifier: 0x00,
text: "Toolkit Test GROUP:0x10, 8BIT"}},
{command: "D046810301210082028102" +
"8D" +
"3B" +
text: "Toolkit Test GROUP:0x10, 8BIT",
responseNeeded: false}},
{command: "D046" + // Length
"8103012100" + // Command details
"82028102" + // Device identities
"8D3B" + // Text string
"1A" + // UCS2 + Class 2
"0054006F006F006C006B006900740020" +
"0054006500730074002000470052004F" +
"00550050003A0030007800310030002C" +
"00200055004300530032",
"0054006F006F006C006B0069007400200054006500730074002000470052004F" +
"00550050003A0030007800310030002C00200055004300530032",
expect: {commandQualifier: 0x00,
text: "Toolkit Test GROUP:0x10, UCS2"}},
{command: "D026810301210082028102" +
"8D" +
"1B" +
text: "Toolkit Test GROUP:0x10, UCS2",
responseNeeded: false}},
{command: "D026" + // Length
"8103012100" + // Command details
"82028102" + // Device identities
"8D1B" + // Text string
"F2" + // 7BIT + Class 2
"D4F79BBD4ED341D4F29C0E3A4A9F55A8" +
"0E8637C258A09B304905",
"D4F79BBD4ED341D4F29C0E3A4A9F55A80E8637C258A09B304905",
expect: {commandQualifier: 0x00,
text: "Toolkit Test GROUP:0xF0, 7BIT"}},
{command: "D029810301210082028102" +
"8D" +
"1E" +
text: "Toolkit Test GROUP:0xF0, 7BIT",
responseNeeded: false}},
{command: "D029" + // Length
"8103012100" + // Command details
"82028102" + // Device identities
"8D1E" + // Text string
"F6" + // 8BIT + Class 2
"546F6F6C6B697420546573742047524F" +
"55503A307846302C2038424954",
"546F6F6C6B697420546573742047524F55503A307846302C2038424954",
expect: {commandQualifier: 0x00,
text: "Toolkit Test GROUP:0xF0, 8BIT"}},
text: "Toolkit Test GROUP:0xF0, 8BIT",
responseNeeded: false}},
// Bug 1088573: this test case is to ensure that we provide |length| argument
// in |integer| format to GsmPDUHelper.readSeptetsToString().
{command: "D0" +
"81" + // 2-byte length encoded:
"FC" + // 252
"810301210082028102" +
"8D" +
"81" + // 2-byte length encoded:
"F0" + // 240
{command: "D081FC" + // Length (2-byte length encoded: 252)
"8103012100" + // Command details
"82028102" + // Device identities
"8D" + // Text string
"81F0" + // 2-byte length encoded: 240
"00" + // 7BIT
"C332A85D9ECFC3E732685E068DDF6DF8" +
"7B5E0691CB20D96D061A87E5E131BD2C" +
"2FCF416537A8FD269741E3771B2E2FCF" +
"E76517685806B5CBF379F85C0695E774" +
"50D86C4E8FD165D0BC2E07C1D9F579BA" +
"5C97CF41E5B13CEC9E83CA7490BB0C22" +
"BFD374103C3C0795E9F232882E7FBBE3" +
"F5B20B24BBCD40E5391DC42E83DCEFB6" +
"585E06B5C3F874BBDE0691CBA071581E" +
"1ED3CBF2F21C14369BD3637458CC2EBB" +
"40C3329D5E0699DFEE313DFD76BBC3EC" +
"34BD0C0A83CAF432280C87CBDF757BB9" +
"0C8287E5207619346D1E73A0783D0D9A" +
"9FCA733A885C96BFEBEC32280C9A6689" +
"C332A85D9ECFC3E732685E068DDF6DF87B5E0691CB20D96D061A87E5E131BD2C" +
"2FCF416537A8FD269741E3771B2E2FCFE76517685806B5CBF379F85C0695E774" +
"50D86C4E8FD165D0BC2E07C1D9F579BA5C97CF41E5B13CEC9E83CA7490BB0C22" +
"BFD374103C3C0795E9F232882E7FBBE3F5B20B24BBCD40E5391DC42E83DCEFB6" +
"585E06B5C3F874BBDE0691CBA071581E1ED3CBF2F21C14369BD3637458CC2EBB" +
"40C3329D5E0699DFEE313DFD76BBC3EC34BD0C0A83CAF432280C87CBDF757BB9" +
"0C8287E5207619346D1E73A0783D0D9A9FCA733A885C96BFEBEC32280C9A6689" +
"CE621654768382D529551A64268B2E",
expect: {commandQualifier: 0x00,
text: "Ce message se compose de 273 caracteres en mode " +
@ -145,19 +182,26 @@ const TEST_DATA = [
"ecrans et ne doit pas etre tronque. 273 est le " +
"nombre maximum de caracteres affichable. Cette " +
"fonctionnalite a ete approuvee par le SMG9 qui s'est " +
"deroule a SYDNEY en AUSTRALIE."}},
"deroule a SYDNEY en AUSTRALIE.",
responseNeeded: false}},
];
function testDisplayText(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_DISPLAY_TEXT,
"typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.text, aExpect.text, "options.text");
is(aCommand.options.userClear, aExpect.userClear, "options.userClear");
is(aCommand.options.isHighPriority, aExpect.isHighPriority,
"options.isHighPriority");
if (aExpect.duration) {
is(aCommand.options.userClear, !!(aExpect.commandQualifier & 0x80),
"options.userClear");
is(aCommand.options.isHighPriority, !!(aExpect.commandQualifier & 0x01),
"options.isHighPriority");
is(aCommand.options.text, aExpect.text, "options.text");
is(aCommand.options.responseNeeded, aExpect.responseNeeded,
"options.responseNeeded");
// duration is optional.
if ("duration" in aExpect) {
let duration = aCommand.options.duration;
is(duration.timeUnit, aExpect.duration.timeUnit,
"options.duration.timeUnit");
@ -165,7 +209,8 @@ function testDisplayText(aCommand, aExpect) {
"options.duration.timeInterval");
}
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");

Просмотреть файл

@ -5,34 +5,93 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d0148103012200820281828d09004537bd2c07896022",
{command: "D014" + // Length
"8103012200" + // Command details
"82028182" + // Device identities
"8D09004537BD2C07896022", // Text string
expect: {commandQualifier: 0x00,
text: "Enter \"0\""}},
{command: "d081ad8103012201820281828d81a104456e746572202278222e205468697320636f6d6d616e6420696e7374727563747320746865204d4520746f20646973706c617920746578742c20616e6420746f2065787065637420746865207573657220746f20656e74657220612073696e676c65206368617261637465722e20416e7920726573706f6e736520656e7465726564206279207468652075736572207368616c6c206265207061737365642074",
{command: "D00B" + // Length
"8103012200" + // Command details
"82028182" + // Device identities
"8D00", // Text string
expect: {commandQualifier: 0x00,
text: null}},
{command: "D00C" + // Length
"8103012200" + // Command details
"82028182" + // Device identities
"8D0100", // Text string
expect: {commandQualifier: 0x00,
text: ""}},
{command: "D081AD" + // Length
"8103012201" + // Command details
"82028182" + // Device identities
"8D81A104456E746572202278222E205468697320636F6D" + // Text string
"6D616E6420696E7374727563747320746865204D452074" +
"6F20646973706C617920746578742C20616E6420746F20" +
"65787065637420746865207573657220746F20656E7465" +
"7220612073696E676C65206368617261637465722E2041" +
"6E7920726573706F6E736520656E746572656420627920" +
"7468652075736572207368616C6C206265207061737365" +
"642074",
expect: {commandQualifier: 0x01,
text: "Enter \"x\". This command instructs the ME to display text, and to expect the user to enter a single character. Any response entered by the user shall be passed t",
isAlphabet: true}},
{command: "d0168103012200820281828d0b043c54494d452d4f55543e",
text: "Enter \"x\". This command instructs the ME to display " +
"text, and to expect the user to enter a single character. " +
"Any response entered by the user shall be passed t"}},
{command: "D016" + // Length
"8103012200" + // Command details
"82028182" + // Device identities
"8D0B043C54494D452D4F55543E", // Text string
expect: {commandQualifier: 0x00,
text: "<TIME-OUT>"}},
{command: "d081998103012200820281828d818d080417041404200410041204210422041204230419042204150417041404200410041204210422041204230419042204150417041404200410041204210422041204230419042204150417041404200410041204210422041204230419042204150417041404200410041204210422041204230419042204150417041404200410041204210422041204230419",
{command: "D08199" + // Length
"8103012200" + // Command details
"82028182" + // Device identities
"8D818D0804170414042004100412042104220412042304" + // Text string
"1904220415041704140420041004120421042204120423" +
"0419042204150417041404200410041204210422041204" +
"2304190422041504170414042004100412042104220412" +
"0423041904220415041704140420041004120421042204" +
"1204230419042204150417041404200410041204210422" +
"041204230419",
expect: {commandQualifier: 0x00,
text: "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙ"}},
{command: "d0118103012203820281828d0604456e746572",
text: "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДР" +
"АВСТВУЙТЕЗДРАВСТВУЙ"}},
{command: "D011" + // Length
"8103012203" + // Command details
"82028182" + // Device identities
"8D0604456E746572", // Text string
expect: {commandQualifier: 0x03,
text: "Enter",
isAlphabet: true,
isUCS2: true}},
{command: "d0158103012204820281828d0a04456e74657220594553",
text: "Enter"}},
{command: "D015" + // Length
"8103012204" + // Command details
"82028182" + // Device identities
"8D0A04456E74657220594553", // Text string
expect: {commandQualifier: 0x04,
text: "Enter YES",
isYesNoRequested: true}},
{command: "d0198103012200820281828d0a043c4e4f2d49434f4e3e1e020002",
text: "Enter YES"}},
{command: "D019" + // Length
"8103012200" + // Command details
"82028182" + // Device identities
"8D0A043C4E4F2D49434F4E3E" + // Text string
"1E020002", // Icon identifier
expect: {commandQualifier: 0x00,
// The record number 02 in EFimg is not defined, so no icon will be
// shown, but the text string should still be displayed.
text: "<NO-ICON>"}},
{command: "D0198103012200820281828D0A04456E74657220222B228402010A",
{command: "D016" + // Length
"8103012280" + // Command details
"82028182" + // Device identities
"8D07043C49434F4E3E" + // Text string
"1E020101", // Icon identifier
expect: {commandQualifier: 0x80,
text: "<ICON>",
iconSelfExplanatory: false,
icons : [BASIC_ICON]}},
{command: "D019" + // Length
"8103012200" + // Command details
"82028182" + // Device identities
"8D0A04456E74657220222B22" + // Text string
"8402010A", // Duration
expect: {commandQualifier: 0x00,
text: "Enter \"+\"",
duration: {timeUnit: MozIccManager.STK_TIME_UNIT_SECOND,
@ -40,15 +99,24 @@ const TEST_DATA = [
];
function testGetInKey(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_GET_INKEY, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.text, aExpect.text, "options.text");
is(aCommand.options.isAlphabet, aExpect.isAlphabet, "options.isAlphabet");
is(aCommand.options.isUCS2, aExpect.isUCS2, "options.isUCS2");
is(aCommand.options.isYesNoRequested, aExpect.isYesNoRequested,
"options.isYesNoRequested");
if (aExpect.duration) {
is(aCommand.options.isAlphabet, !!(aExpect.commandQualifier & 0x01),
"options.isAlphabet");
is(aCommand.options.isUCS2, !!(aExpect.commandQualifier & 0x02),
"options.isUCS2");
is(aCommand.options.isYesNoRequested, !!(aExpect.commandQualifier & 0x04),
"options.isYesNoRequested");
is(aCommand.options.isHelpAvailable, !!(aExpect.commandQualifier & 0x80),
"options.isHelpAvailable");
is(aCommand.options.text, aExpect.text, "options.text");
is(aCommand.options.minLength, 1, "options.minLength");
is(aCommand.options.maxLength, 1, "options.maxLength");
// duration is optional.
if ("duration" in aExpect) {
let duration = aCommand.options.duration;
is(duration.timeUnit, aExpect.duration.timeUnit,
"options.duration.timeUnit");
@ -56,7 +124,8 @@ function testGetInKey(aCommand, aExpect) {
"options.duration.timeInterval");
}
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");

Просмотреть файл

@ -5,67 +5,135 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d01b8103012300820281828d0c04456e74657220313233343591020505",
{command: "D01B" + // Length
"8103012300" + // Command details
"82028182" + // Device identities
"8D0C04456E746572203132333435" + // Text string
"91020505", // Response length
expect: {commandQualifier: 0x00,
text: "Enter 12345",
minLength: 5,
maxLength: 5}},
{command: "d01a8103012308820281828d0b004537bd2c07d96eaad10a91020505",
{command: "D01A" + // Length
"8103012308" + // Command details
"82028182" + // Device identities
"8D0B004537BD2C07D96EAAD10A" + // Text string
"91020505", // Response length
expect: {commandQualifier: 0x08,
text: "Enter 67*#+",
minLength: 5,
maxLength: 5,
isPacked: true}},
{command: "d01b8103012301820281828d0c04456e74657220416243644591020505",
maxLength: 5}},
{command: "D01B" + // Length
"8103012301" + // Command details
"82028182" + // Device identities
"8D0C04456E746572204162436445" + // Text string
"91020505", // Response length
expect: {commandQualifier: 0x01,
text: "Enter AbCdE",
minLength: 5,
maxLength: 5,
isAlphabet: true}},
{command: "d0278103012304820281828d180450617373776f726420313c53454e443e3233343536373891020408",
maxLength: 5}},
{command: "D027" + // Length
"8103012304" + // Command details
"82028182" + // Device identities
"8D180450617373776F726420313C53454E443E323334" + // Text string
"35363738" +
"91020408", // Response length
expect: {commandQualifier: 0x04,
text: "Password 1<SEND>2345678",
minLength: 4,
maxLength: 8,
hideInput: true}},
{command: "d01e8103012300820281828d0f043c474f2d4241434b57415244533e91020008",
maxLength: 8}},
{command: "D01E" + // Length
"8103012300" + // Command details
"82028182" + // Device identities
"8D0F043C474F2D4241434B57415244533E" + // Text string
"91020008", // Response length
expect: {commandQualifier: 0x00,
text: "<GO-BACKWARDS>",
minLength: 0,
maxLength: 8}},
{command: "d081b18103012300820281828d81a1042a2a2a313131313131313131312323232a2a2a323232323232323232322323232a2a2a333333333333333333332323232a2a2a343434343434343434342323232a2a2a353535353535353535352323232a2a2a363636363636363636362323232a2a2a373737373737373737372323232a2a2a383838383838383838382323232a2a2a393939393939393939392323232a2a2a303030303030303030302323239102a0a0",
{command: "D081B1" + // Length
"8103012300" + // Command details
"82028182" + // Device identities
"8D81A1042A2A2A313131313131313131312323232A2A2A" + // Text string
"323232323232323232322323232A2A2A33333333333333" +
"3333332323232A2A2A343434343434343434342323232A" +
"2A2A353535353535353535352323232A2A2A3636363636" +
"36363636362323232A2A2A373737373737373737372323" +
"232A2A2A383838383838383838382323232A2A2A393939" +
"393939393939392323232A2A2A30303030303030303030" +
"232323" +
"9102A0A0", // Response length
expect: {commandQualifier: 0x00,
text: "***1111111111###***2222222222###***3333333333###***4444444444###***5555555555###***6666666666###***7777777777###***8888888888###***9999999999###***0000000000###",
text: "***1111111111###***2222222222###***3333333333###***444444" +
"4444###***5555555555###***6666666666###***7777777777###**" +
"*8888888888###***9999999999###***0000000000###",
minLength: 160,
maxLength: 160}},
{command: "d0819d8103012301820281828d818d08041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041991020505",
{command: "D0819D" + // Length
"8103012301" + // Command details
"82028182" + // Device identities
"8D818D0804170414042004100412042104220412042304" + // Text string
"1904220415041704140420041004120421042204120423" +
"0419042204150417041404200410041204210422041204" +
"2304190422041504170414042004100412042104220412" +
"0423041904220415041704140420041004120421042204" +
"1204230419042204150417041404200410041204210422" +
"041204230419" +
"91020505", // Response length
expect: {commandQualifier: 0x01,
text: "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙ",
text: "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУ" +
"ЙТЕЗДРАВСТВУЙ",
minLength: 5,
maxLength: 5,
isAlphabet: true}},
{command: "d01b8103012303820281828d0c04456e7465722048656c6c6f910205ff",
maxLength: 5}},
{command: "D01B" + // Length
"8103012303" + // Command details
"82028182" + // Device identities
"8D0C04456E7465722048656C6C6F" + // Text string
"910205FF", // Response length
expect: {commandQualifier: 0x03,
text: "Enter Hello",
minLength: 5,
maxLength: 0xFF,
isAlphabet: true,
isUCS2: true}},
{command: "d081ba8103012300820281828d0704456e7465723a9102a0a01781a1042a2a2a313131313131313131312323232a2a2a323232323232323232322323232a2a2a333333333333333333332323232a2a2a343434343434343434342323232a2a2a353535353535353535352323232a2a2a363636363636363636362323232a2a2a373737373737373737372323232a2a2a383838383838383838382323232a2a2a393939393939393939392323232a2a2a30303030303030303030232323",
maxLength: 0xFF}},
{command: "D081BA" + // Length
"8103012300" + // Command details
"82028182" + // Device identities
"8D0704456E7465723A" + // Text string
"9102A0A0" + // Response length
"1781A1042A2A2A313131313131313131312323232A2A2A" + // Default text
"323232323232323232322323232A2A2A33333333333333" +
"3333332323232A2A2A343434343434343434342323232A" +
"2A2A353535353535353535352323232A2A2A3636363636" +
"36363636362323232A2A2A373737373737373737372323" +
"232A2A2A383838383838383838382323232A2A2A393939" +
"393939393939392323232A2A2A30303030303030303030" +
"232323",
expect: {commandQualifier: 0x00,
text: "Enter:",
minLength: 160,
maxLength: 160,
defaultText: "***1111111111###***2222222222###***3333333333###***4444444444###***5555555555###***6666666666###***7777777777###***8888888888###***9999999999###***0000000000###"}},
{command: "d01d8103012300820281828d0a043c4e4f2d49434f4e3e9102000a1e020002",
defaultText: "***1111111111###***2222222222###***3333333333###**" +
"*4444444444###***5555555555###***6666666666###***7" +
"777777777###***8888888888###***9999999999###***000" +
"0000000###"}},
{command: "D01D" + // Length
"8103012300" + // Command details
"82028182" + // Device identities
"8D0A043C4E4F2D49434F4E3E" + // Text string
"9102000A" + // Response length
"1E020002", // Icon identifier
expect: {commandQualifier: 0x00,
// The record number 02 in EFimg is not defined, so no icon will be
// shown, but the text string should still be displayed.
text: "<NO-ICON>",
minLength: 0,
maxLength: 10}},
{command: "d0208103012300820281828d0d043c42415349432d49434f4e3e9102000a1e020101",
expect: {commandQualifier: 0x00,
{command: "D020" + // Length
"8103012380" + // Command details
"82028182" + // Device identities
"8D0D043C42415349432D49434F4E3E" + // Text string
"9102000A" + // Response length
"1E020101", // Icon identifier
expect: {commandQualifier: 0x80,
text: "<BASIC-ICON>",
minLength: 0,
maxLength: 10,
@ -74,33 +142,31 @@ const TEST_DATA = [
];
function testGetInput(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_GET_INPUT, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.isAlphabet, !!(aExpect.commandQualifier & 0x01),
"options.isAlphabet");
is(aCommand.options.isUCS2, !!(aExpect.commandQualifier & 0x02),
"options.isUCS2");
is(aCommand.options.hideInput, !!(aExpect.commandQualifier & 0x04),
"options.hideInput");
is(aCommand.options.isPacked, !!(aExpect.commandQualifier & 0x08),
"options.isPacked");
is(aCommand.options.isHelpAvailable, !!(aExpect.commandQualifier & 0x80),
"options.isHelpAvailable");
is(aCommand.options.text, aExpect.text, "options.text");
is(aCommand.options.minLength, aExpect.minLength, "options.minLength");
is(aCommand.options.maxLength, aExpect.maxLength, "options.maxLength");
if (aExpect.defaultText) {
// defaultText is optional.
if ("defaultText" in aExpect) {
is(aCommand.options.defaultText, aExpect.defaultText, "options.defaultText");
}
if (aExpect.isAlphabet) {
is(aCommand.options.isAlphabet, aExpect.isAlphabet, "options.isAlphabet");
}
if (aExpect.isUCS2) {
is(aCommand.options.isUCS2, aExpect.isUCS2, "options.isUCS2");
}
if (aExpect.isPacked) {
is(aCommand.options.isPacked, aExpect.isPacked, "options.isPacked");
}
if (aExpect.hideInput) {
is(aCommand.options.hideInput, aExpect.hideInput, "options.hideInput");
}
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");

Просмотреть файл

@ -5,60 +5,118 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d0188103011500820281823100050b44656661756c742055524c",
{command: "D018" + // Length
"8103011500" + // Command details
"82028182" + // Device identities
"3100" + // URL
"050B44656661756C742055524C", // Alpha identifier
expect: {commandQualifier: 0x00,
url: "",
mode: MozIccManager.STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED,
confirmMessage: { text: "Default URL" }}},
{command: "d01f8103011500820281823112687474703a2f2f7878782e7979792e7a7a7a0500",
{command: "D01F" + // Length
"8103011500" + // Command details
"82028182" + // Device identities
"3112687474703A2F2F7878782E7979792E7A7A7A" + // URL
"0500", // Alpha identifier
expect: {commandQualifier: 0x00,
url: "http://xxx.yyy.zzz",
mode: MozIccManager.STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED,
confirmMessage: { text: "" }}},
{command: "d0208103011500820281823100320103" +
"0d10046162632e6465662e6768692e6a6b6c", // "0D" String TLV is useless for Launch Browser.
{command: "D023" + // Length
"8103011500" + // Command details
"82028182" + // Device identities
"300100" + // Browser identity
"3100" + // URL
"320103" + // Bear
"0D10046162632E6465662E6768692E6A6B6C", // Text string
expect: {commandQualifier: 0x00,
url: ""}},
{command: "d0188103011502820281823100050b44656661756c742055524c",
// Browser identity, Bear and Text string are useless.
url: "",
mode: MozIccManager.STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED}},
{command: "D018" + // Length
"8103011502" + // Command details
"82028182" + // Device identities
"3100" + // URL
"050B44656661756C742055524C", // Alpha identifier
expect: {commandQualifier: 0x02,
url: "",
mode: MozIccManager.STK_BROWSER_MODE_USING_EXISTING_BROWSER,
confirmMessage: { text: "Default URL" }}},
{command: "d0188103011503820281823100050b44656661756c742055524c",
{command: "D018" + // Length
"8103011503" + // Command details
"82028182" + // Device identities
"3100" + // URL
"050B44656661756C742055524C", // Alpha identifier
expect: {commandQualifier: 0x03,
url: "",
mode: MozIccManager.STK_BROWSER_MODE_USING_NEW_BROWSER,
confirmMessage: { text: "Default URL"}}},
{command: "d0268103011502820281823100051980041704140420041004120421042204120423041904220415",
{command: "D026" + // Length
"8103011502" + // Command details
"82028182" + // Device identities
"3100" + // URL
"051980041704140420041004120421042204120423" + // Alpha identifier
"041904220415",
expect: {commandQualifier: 0x02,
url: "",
mode: MozIccManager.STK_BROWSER_MODE_USING_EXISTING_BROWSER,
confirmMessage: { text: "ЗДРАВСТВУЙТЕ" }}},
{command: "d021810301150282028182310005104e6f742073656c66206578706c616e2e1e020101",
{command: "D021" + // Length
"8103011502" + // Command details
"82028182" + // Device identities
"3100" + // URL
"05104E6F742073656C66206578706C616E2E" + // Alpha identifier
"1E020101", // Icon identifier
expect: {commandQualifier: 0x02,
url: "",
mode: MozIccManager.STK_BROWSER_MODE_USING_EXISTING_BROWSER,
confirmMessage: { text: "Not self explan.",
iconSelfExplanatory: false,
icons : [BASIC_ICON] }
}},
{command: "d01281030115028202818231000505804f60597d",
{command: "D012" + // Length
"8103011502" + // Command details
"82028182" + // Device identities
"3100" + // URL
"0505804F60597D", // Alpha identifier
expect: {commandQualifier: 0x02,
url: "",
mode: MozIccManager.STK_BROWSER_MODE_USING_EXISTING_BROWSER,
confirmMessage: { text: "你好" }}},
{command: "d01281030115008202818230010031001e020001",
{command: "D00F" + // Length
"8103011500" + // Command details
"82028182" + // Device identities
"3100" + // URL
"1E020001", // Icon identifier
expect: {commandQualifier: 0x00,
url: "",
mode: MozIccManager.STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED,
confirmMessage: { iconSelfExplanatory: true,
icons: [BASIC_ICON] }}},
{command: "d01281030115008202818230010031001e020003",
{command: "D00F" + // Length
"8103011500" + // Command details
"82028182" + // Device identities
"3100" + // URL
"1E020003", // Icon identifier
expect: {commandQualifier: 0x00,
url: "",
mode: MozIccManager.STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED,
confirmMessage: { iconSelfExplanatory: true,
icons: [COLOR_ICON] }}},
];
function testLaunchBrowser(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_LAUNCH_BROWSER,
"typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.url, aExpect.url, "options.url");
if (aExpect.confirmMessage) {
is(aCommand.options.url, aExpect.url, "options.url");
is(aCommand.options.mode, aExpect.mode, "options.mode");
// confirmMessage is optional
if ("confirmMessage" in aExpect) {
isStkText(aCommand.options.confirmMessage, aExpect.confirmMessage,
"options.confirmMessage");
}

Просмотреть файл

@ -6,31 +6,38 @@ MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
// Location
{command: "d009810301260082028182",
expect: {commandNumber: 0x01,
commandQualifier: MozIccManager.STK_LOCAL_INFO_LOCATION_INFO,
{command: "D009" + // Length
"8103012600" + // Command details
"82028182", // Device identities
expect: {commandQualifier: MozIccManager.STK_LOCAL_INFO_LOCATION_INFO,
localInfoType: MozIccManager.STK_LOCAL_INFO_LOCATION_INFO}},
// Imei
{command: "d009810301260182028182",
expect: {commandNumber: 0x01,
commandQualifier: MozIccManager.STK_LOCAL_INFO_IMEI,
{command: "D009" + // Length
"8103012601" + // Command details
"82028182", // Device identities
expect: {commandQualifier: MozIccManager.STK_LOCAL_INFO_IMEI,
localInfoType: MozIccManager.STK_LOCAL_INFO_IMEI}},
// Data
{command: "d009810301260382028182",
expect: {commandNumber: 0x01,
commandQualifier: MozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE,
{command: "D009" + // Length
"8103012603" + // Command details
"82028182", // Device identities
expect: {commandQualifier: MozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE,
localInfoType: MozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE}},
// Language
{command: "d009810301260482028182",
expect: {commandNumber: 0x01,
commandQualifier: MozIccManager.STK_LOCAL_INFO_LANGUAGE,
{command: "D009" + // Length
"8103012604" + // Command details
"82028182", // Device identities
expect: {commandQualifier: MozIccManager.STK_LOCAL_INFO_LANGUAGE,
localInfoType: MozIccManager.STK_LOCAL_INFO_LANGUAGE}},
];
function testLocalInfo(aCommand, aExpect) {
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO, "typeOfCommand");
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO,
"typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.localInfoType, aExpect.localInfoType, "options.localInfoType");
is(aCommand.options.localInfoType, aExpect.localInfoType,
"options.localInfoType");
}
// Start tests

Просмотреть файл

@ -5,11 +5,14 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d009810301040082028182",
{command: "D009" + // Length
"8103010400" + // Command details
"82028182", // Device identities
expect: {commandQualifier: 0x00}}
];
function testPollOff(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_POLL_OFF, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
}
@ -21,7 +24,7 @@ startTestCommon(function() {
for (let i = 0; i < TEST_DATA.length; i++) {
let data = TEST_DATA[i];
promise = promise.then(() => {
log("pull_off_cmd: " + data.command);
log("poll_off_cmd: " + data.command);
let promises = [];
// Wait onstkcommand event.

Просмотреть файл

@ -5,13 +5,19 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d0108103010101820281829205013f002fe2",
{command: "D010" + // Length
"8103010101" + // Command details
"82028182" + // Device identities
"9205013F002FE2", // File list
expect: {commandQualifier: 0x01}},
{command: "d009810301010482028182",
{command: "D009" + // Length
"8103010104" + // Command details
"82028182", // Device identities
expect: {commandQualifier: 0x04}}
];
function testRefresh(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_REFRESH, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
}

Просмотреть файл

@ -5,28 +5,160 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d03d810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034",
{command: "D03D" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"850E546F6F6C6B69742053656C656374" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033" + // Item
"8F07044974656D2034", // Item
expect: {commandQualifier: 0x00,
title: "Toolkit Select",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}]}},
{command: "d081fc810301240082028182850a4c617267654d656e75318f05505a65726f8f044f4f6e658f044e54776f8f064d54687265658f054c466f75728f054b466976658f044a5369788f0649536576656e8f064845696768748f05474e696e658f0646416c7068618f0645427261766f8f0844436861726c69658f064344656c74618f05424563686f8f0941466f782d74726f748f0640426c61636b8f063f42726f776e8f043e5265648f073d4f72616e67658f073c59656c6c6f778f063b477265656e8f053a426c75658f073956696f6c65748f0538477265798f063757686974658f06366d696c6c698f06356d6963726f8f05346e616e6f8f05337069636f",
items: [{identifier: 1, text: "Item 1"},
{identifier: 2, text: "Item 2"},
{identifier: 3, text: "Item 3"},
{identifier: 4, text: "Item 4"}]}},
{command: "D081FC" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"850A4C617267654D656E7531" + // Alpha identifier
"8F05505A65726F" + // Item
"8F044F4F6E65" + // Item
"8F044E54776F" + // Item
"8F064D5468726565" + // Item
"8F054C466F7572" + // Item
"8F054B46697665" + // Item
"8F044A536978" + // Item
"8F0649536576656E" + // Item
"8F06484569676874" + // Item
"8F05474E696E65" + // Item
"8F0646416C706861" + // Item
"8F0645427261766F" + // Item
"8F0844436861726C6965" + // Item
"8F064344656C7461" + // Item
"8F05424563686F" + // Item
"8F0941466F782D74726F74" + // Item
"8F0640426C61636B" + // Item
"8F063F42726F776E" + // Item
"8F043E526564" + // Item
"8F073D4F72616E6765" + // Item
"8F073C59656C6C6F77" + // Item
"8F063B477265656E" + // Item
"8F053A426C7565" + // Item
"8F073956696F6C6574" + // Item
"8F053847726579" + // Item
"8F06375768697465" + // Item
"8F06366D696C6C69" + // Item
"8F06356D6963726F" + // Item
"8F05346E616E6F" + // Item
"8F05337069636F", // Item
expect: {commandQualifier: 0x00,
title: "LargeMenu1",
items: [{identifier: 80, text: "Zero"}, {identifier: 79, text: "One"}, {identifier: 78, text: "Two"}, {identifier: 77, text: "Three"}, {identifier: 76, text: "Four"}, {identifier: 75, text: "Five"}, {identifier: 74, text: "Six"}, {identifier: 73, text: "Seven"}, {identifier: 72, text: "Eight"}, {identifier: 71, text: "Nine"}, {identifier: 70, text: "Alpha"}, {identifier: 69, text: "Bravo"}, {identifier: 68, text: "Charlie"}, {identifier: 67, text: "Delta"}, {identifier: 66, text: "Echo"}, {identifier: 65, text: "Fox-trot"}, {identifier: 64, text: "Black"}, {identifier: 63, text: "Brown"}, {identifier: 62, text: "Red"}, {identifier: 61, text: "Orange"}, {identifier: 60, text: "Yellow"}, {identifier: 59, text: "Green"}, {identifier: 58, text: "Blue"}, {identifier: 57, text: "Violet"}, {identifier: 56, text: "Grey"}, {identifier: 55, text: "White"}, {identifier: 54, text: "milli"}, {identifier: 53, text: "micro"}, {identifier: 52, text: "nano"}, {identifier: 51, text: "pico"}]}},
{command: "d081fb810301240082028182850a4c617267654d656e75328f1eff43616c6c20466f7277617264696e6720556e636f6e646974696f6e616c8f1dfe43616c6c20466f7277617264696e67204f6e205573657220427573798f1cfd43616c6c20466f7277617264696e67204f6e204e6f205265706c798f26fc43616c6c20466f7277617264696e67204f6e2055736572204e6f7420526561636861626c658f1efb42617272696e67204f6620416c6c204f7574676f696e672043616c6c738f2cfa42617272696e67204f6620416c6c204f7574676f696e6720496e7465726e6174696f6e616c2043616c6c738f11f9434c492050726573656e746174696f6e",
items: [{identifier: 80, text: "Zero"},
{identifier: 79, text: "One"},
{identifier: 78, text: "Two"},
{identifier: 77, text: "Three"},
{identifier: 76, text: "Four"},
{identifier: 75, text: "Five"},
{identifier: 74, text: "Six"},
{identifier: 73, text: "Seven"},
{identifier: 72, text: "Eight"},
{identifier: 71, text: "Nine"},
{identifier: 70, text: "Alpha"},
{identifier: 69, text: "Bravo"},
{identifier: 68, text: "Charlie"},
{identifier: 67, text: "Delta"},
{identifier: 66, text: "Echo"},
{identifier: 65, text: "Fox-trot"},
{identifier: 64, text: "Black"},
{identifier: 63, text: "Brown"},
{identifier: 62, text: "Red"},
{identifier: 61, text: "Orange"},
{identifier: 60, text: "Yellow"},
{identifier: 59, text: "Green"},
{identifier: 58, text: "Blue"},
{identifier: 57, text: "Violet"},
{identifier: 56, text: "Grey"},
{identifier: 55, text: "White"},
{identifier: 54, text: "milli"},
{identifier: 53, text: "micro"},
{identifier: 52, text: "nano"},
{identifier: 51, text: "pico"}]}},
{command: "D081FB" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"850A4C617267654D656E7532" + // Alpha identifier
"8F1EFF43616C6C20466F7277617264696E6720556E636F6E6469" + // Item
"74696F6E616C" +
"8F1DFE43616C6C20466F7277617264696E67204F6E2055736572" + // Item
"2042757379" +
"8F1CFD43616C6C20466F7277617264696E67204F6E204E6F2052" + // Item
"65706C79" +
"8F26FC43616C6C20466F7277617264696E67204F6E2055736572" + // Item
"204E6F7420526561636861626C65" +
"8F1EFB42617272696E67204F6620416C6C204F7574676F696E67" + // Item
"2043616C6C73" +
"8F2CFA42617272696E67204F6620416C6C204F7574676F696E67" + // Item
"20496E7465726E6174696F6E616C2043616C6C73" +
"8F11F9434C492050726573656E746174696F6E", // Item
expect: {commandQualifier: 0x00,
title: "LargeMenu2",
items: [{identifier: 255, text: "Call Forwarding Unconditional"}, {identifier: 254, text: "Call Forwarding On User Busy"}, {identifier: 253, text: "Call Forwarding On No Reply"}, {identifier: 252, text: "Call Forwarding On User Not Reachable"}, {identifier: 251, text: "Barring Of All Outgoing Calls"}, {identifier: 250, text: "Barring Of All Outgoing International Calls"}, {identifier: 249, text: "CLI Presentation"}]}},
{command: "d081fd8103012400820281828581ed5468652053494d207368616c6c20737570706c79206120736574206f66206974656d732066726f6d207768696368207468652075736572206d61792063686f6f7365206f6e652e2045616368206974656d20636f6d70726973657320612073686f7274206964656e74696669657220287573656420746f20696e646963617465207468652073656c656374696f6e2920616e642061207465787420737472696e672e204f7074696f6e616c6c79207468652053494d206d617920696e636c75646520616e20616c706861206964656e7469666965722e2054686520616c706861206964656e74696669657220698f020159",
items: [{identifier: 255, text: "Call Forwarding Unconditional"},
{identifier: 254, text: "Call Forwarding On User Busy"},
{identifier: 253, text: "Call Forwarding On No Reply"},
{identifier: 252, text: "Call Forwarding On User Not Reachable"},
{identifier: 251, text: "Barring Of All Outgoing Calls"},
{identifier: 250, text: "Barring Of All Outgoing International Calls"},
{identifier: 249, text: "CLI Presentation"}]}},
{command: "D081FD" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"8581ED5468652053494D207368616C6C20737570" + // Alpha identifier
"706C79206120736574206F66206974656D732066" +
"726F6D207768696368207468652075736572206D" +
"61792063686F6F7365206F6E652E204561636820" +
"6974656D20636F6D70726973657320612073686F" +
"7274206964656E74696669657220287573656420" +
"746F20696E646963617465207468652073656C65" +
"6374696F6E2920616E6420612074657874207374" +
"72696E672E204F7074696F6E616C6C7920746865" +
"2053494D206D617920696E636C75646520616E20" +
"616C706861206964656E7469666965722E205468" +
"6520616C706861206964656E7469666965722069" +
"8F020159", // Item
expect: {commandQualifier: 0x00,
title: "The SIM shall supply a set of items from which the user may choose one. Each item comprises a short identifier (used to indicate the selection) and a text string. Optionally the SIM may include an alpha identifier. The alpha identifier i",
title: "The SIM shall supply a set of items from which the user " +
"may choose one. Each item comprises a short identifier " +
"(used to indicate the selection) and a text string. " +
"Optionally the SIM may include an alpha identifier. " +
"The alpha identifier i",
items: [{identifier: 1, text: "Y"}]}},
{command: "d039810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20331803131026",
{command: "D039" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"850E546F6F6C6B69742053656C656374" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033" + // Item
"1803131026", // Items next action indicator
expect: {commandQualifier: 0x00,
title: "Toolkit Select",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}],
nextActionList: [MozIccManager.STK_CMD_SEND_SMS, MozIccManager.STK_CMD_SET_UP_CALL, MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO]}},
{command: "d03e810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20339e0201019f0401030303",
items: [{identifier: 1, text: "Item 1"},
{identifier: 2, text: "Item 2"},
{identifier: 3, text: "Item 3"}],
nextActionList: [MozIccManager.STK_CMD_SEND_SMS,
MozIccManager.STK_CMD_SET_UP_CALL,
MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO]}},
{command: "D03E" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"850E546F6F6C6B69742053656C656374" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033" + // Item
"9E020101" + // Icon identifier
"9F0401030303", // Item icon identifier list
expect: {commandQualifier: 0x00,
title: "Toolkit Select",
iconSelfExplanatory: false,
@ -34,50 +166,121 @@ const TEST_DATA = [
items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: false, icons: [COLOR_ICON]},
{identifier: 2, text: "Item 2", iconSelfExplanatory: false, icons: [COLOR_ICON]},
{identifier: 3, text: "Item 3", iconSelfExplanatory: false, icons: [COLOR_ICON]}]}},
{command: "d03e810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20339e0200019f0400050505",
{command: "D028" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"850E546F6F6C6B69742053656C656374" + // Alpha identifier
"8F0101" + // Item
"8F0102" + // Item
"8F0103" + // Item
"9F0400050505", // Item icon identifier list
expect: {commandQualifier: 0x00,
title: "Toolkit Select",
iconSelfExplanatory: true,
icons: [BASIC_ICON],
items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
{identifier: 2, text: "Item 2", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
{identifier: 3, text: "Item 3", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]}]}},
{command: "d034810301240382028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d2033",
expect: {commandQualifier: 0x03,
items: [{identifier: 1, text: "", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
{identifier: 2, text: "", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
{identifier: 3, text: "", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]}]}},
{command: "D034" + // Length
"8103012483" + // Command details
"82028182" + // Device identities
"850E546F6F6C6B69742053656C656374" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033", // Item
expect: {commandQualifier: 0x83,
title: "Toolkit Select",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001000b4d108000600b4000600b4",
items: [{identifier: 1, text: "Item 1"},
{identifier: 2, text: "Item 2"},
{identifier: 3, text: "Item 3"}]}},
{command: "D03D" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"8510546F6F6C6B69742053656C6563742031" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"D004001000B4" + // Text attribute
"D108000600B4000600B4", // Item text attribute list
expect: {commandQualifier: 0x00,
title: "Toolkit Select 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
{command: "d0578103012400820281828510820c04108784908082919282938992858f1201820d0410878490808291928293899285318f1202820d0410878490808291928293899285328f1203820d041087849080829192829389928533",
items: [{identifier: 1, text: "Item 1"},
{identifier: 2, text: "Item 2"}]}},
{command: "D069" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"851980041704140420041004120421042204120423041904220415" + // Alpha identifier
"8F1C01800417041404200410041204210422041204230419042204150031" + // Item
"8F1102810D089794A09092A1A292A399A29532" + // Item
"8F1203820D041087849080829192829389928533", // Item
expect: {commandQualifier: 0x00,
title: "ЗДРАВСТВУЙТЕ",
items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"}, {identifier: 2, text: "ЗДРАВСТВУЙТЕ2"}, {identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}]}},
{command: "d0388103012400820281828509800038003030eb00308f0a01800038003030eb00318f0a02800038003030eb00328f0a03800038003030eb0033",
items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"},
{identifier: 2, text: "ЗДРАВСТВУЙТЕ2"},
{identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}]}},
{command: "D038" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"8509800038003030EB0030" + // Alpha identifier
"8F0A01800038003030EB0031" + // Item
"8F0A02800038003030EB0032" + // Item
"8F0A03800038003030EB0033", // Item
expect: {commandQualifier: 0x00,
title: "80ル0",
items: [{identifier: 1, text: "80ル1"}, {identifier: 2, text: "80ル2"}, {identifier: 3, text: "80ル3"}]}},
{command: "d03081030124008202818285078104613831eb308f08018104613831eb318f08028104613831eb328f08038104613831eb33",
items: [{identifier: 1, text: "80ル1"},
{identifier: 2, text: "80ル2"},
{identifier: 3, text: "80ル3"}]}},
{command: "D030" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"85078104613831EB30" + // Alpha identifier
"8F08018104613831EB31" + // Item
"8F08028104613831EB32" + // Item
"8F08038104613831EB33", // Item
expect: {commandQualifier: 0x00,
title: "81ル0",
items: [{identifier: 1, text: "81ル1"}, {identifier: 2, text: "81ル2"}, {identifier: 3, text: "81ル3"}]}},
{command: "d0348103012400820281828508820430a03832cb308f0901820430a03832cb318f0902820430a03832cb328f0903820430a03832cb33",
items: [{identifier: 1, text: "81ル1"},
{identifier: 2, text: "81ル2"},
{identifier: 3, text: "81ル3"}]}},
{command: "D034" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"8508820430A03832CB30" + // Alpha identifier
"8F0901820430A03832CB31" + // Item
"8F0902820430A03832CB32" + // Item
"8F0903820430A03832CB33", // Item
expect: {commandQualifier: 0x00,
title: "82ル0",
items: [{identifier: 1, text: "82ル1"}, {identifier: 2, text: "82ル2"}, {identifier: 3, text: "82ル3"}]}},
{command: "d039810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20331803000081",
items: [{identifier: 1, text: "82ル1"},
{identifier: 2, text: "82ル2"},
{identifier: 3, text: "82ル3"}]}},
{command: "D03C" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"850E546F6F6C6B69742053656C656374" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033" + // Item
"1803000081" + // Items next action indicator
"100102", // Item identifier
expect: {commandQualifier: 0x00,
title: "Toolkit Select",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}],
nextActionList: [MozIccManager.STK_NEXT_ACTION_NULL, MozIccManager.STK_NEXT_ACTION_NULL, MozIccManager.STK_NEXT_ACTION_END_PROACTIVE_SESSION]}},
items: [{identifier: 1, text: "Item 1"},
{identifier: 2, text: "Item 2"},
{identifier: 3, text: "Item 3"}],
nextActionList: [MozIccManager.STK_NEXT_ACTION_NULL,
MozIccManager.STK_NEXT_ACTION_NULL,
MozIccManager.STK_NEXT_ACTION_END_PROACTIVE_SESSION],
defaultItem: 1}},
];
function testSelectItem(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SELECT_ITEM, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.presentationType, aCommand.commandQualifier & 0x03,
"presentationType");
is(aCommand.options.isHelpAvailable, !!(aCommand.commandQualifier & 0x80),
"isHelpAvailable");
is(aCommand.options.title, aExpect.title, "options.title");
is(aCommand.options.presentationType, aCommand.commandQualifier & 0x03, "presentationType");
for (let index in aExpect.items) {
let item = aCommand.options.items[index];
@ -94,18 +297,25 @@ function testSelectItem(aCommand, aExpect) {
}
}
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");
}
if (aExpect.nextActionList) {
// nextActionList is optional.
if ("nextActionList" in aExpect) {
for (let index in aExpect.nextActionList) {
is(aCommand.options.nextActionList[index], aExpect.nextActionList[index],
"options.nextActionList[" + index + "]");
}
}
// defaultItem is optional.
if ("defaultItem" in aExpect) {
is(aCommand.options.defaultItem, aExpect.defaultItem, "options.defaultItem");
}
}
// Start tests

Просмотреть файл

@ -5,43 +5,79 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d01b810301140082028183850953656e642044544d46ac052143658709",
{command: "D01B" + // Length
"8103011400" + // Command details
"82028183" + // Device identities
"850953656E642044544D46" + // Alpha identifier
"AC052143658709", // DTMF string
expect: {commandQualifier: 0x00,
text: "Send DTMF"}},
{command: "d010810301140082028183ac052143658709",
{command: "D010" + // Length
"8103011400" + // Command details
"82028183" + // Device identities
"AC052143658709", // DTMF string
expect: {commandQualifier: 0x00}},
{command: "d0138103011400820281838500ac06c1cccccccc2c",
{command: "D013" + // Length
"8103011400" + // Command details
"82028183" + // Device identities
"8500" + // Alpha identifier
"AC06C1CCCCCCCC2C", // DTMF string
expect: {commandQualifier: 0x00,
text: ""}},
{command: "d01d810301140082028183850a42617369632049636f6eac02c1f29e020001",
{command: "D01D" + // Length
"8103011400" + // Command details
"82028183" + // Device identities
"850A42617369632049636F6E" + // Alpha identifier
"AC02C1F2" + // DTMF string
"9E020001", // Icon identifier
expect: {commandQualifier: 0x00,
text: "Basic Icon",
iconSelfExplanatory: true,
icons: [BASIC_ICON]}},
{command: "d011810301140082028183ac02c1f29e020005",
{command: "D011" + // Length
"8103011400" + // Command details
"82028183" + // Device identities
"AC02C1F2" + // DTMF string
"9E020005", // Icon identifier
expect: {commandQualifier: 0x00,
iconSelfExplanatory: true,
icons: [COLOR_TRANSPARENCY_ICON]}},
{command: "d028810301140082028183851980041704140420041004120421042204120423041904220415ac02c1f2",
{command: "D028" + // Length
"8103011400" + // Command details
"82028183" + // Device identities
"851980041704140420041004120421042204120423041904220415" + // Alpha identifier
"AC02C1F2", // DTMF string
expect: {commandQualifier: 0x00,
text: "ЗДРАВСТВУЙТЕ"}},
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b00b4",
{command: "D023" + // Length
"8103011400" + // Command details
"82028183" + // Device identities
"850B53656E642044544D462031" + // Alpha identifier
"AC052143658709" + // DTMF string
"D004000B00B4", // Text attribute
expect: {commandQualifier: 0x00,
text: "Send DTMF 1"}},
{command: "d0148103011400820281838505804f60597dac02c1f2",
{command: "D014" + // Length
"8103011400" + // Command details
"82028183" + // Device identities
"8505804F60597D" + // Alpha identifier
"AC02C1F2", // DTMF string
expect: {commandQualifier: 0x00,
text: "你好"}},
];
function testSendDTMF(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_DTMF, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
if (aExpect.text) {
// text is optional.
if ("text" in aExpect) {
is(aCommand.options.text, aExpect.text, "options.text");
}
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");

Просмотреть файл

@ -5,66 +5,173 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d02e81030113008202818386099111223344556677f88b180100099110325476f840f40c54657374204d657373616765",
{command: "D02E" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"86099111223344556677F8" + // Address
"8B180100099110325476F840F40C54657374204D657373616765", // 3GPP-SMS TPDU
expect: {commandQualifier: 0x00}},
{command: "d03d810301130082028183850d53686f7274204d65737361676586099111223344556677f88b180100099110325476f840f00d53f45b4e0735cbf379f85c06",
{command: "D03D" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"850D53686F7274204D657373616765" + // Alpha identifier
"86099111223344556677F8" + // Address
"8B180100099110325476F840F00D53F45B4E0735CBF379F85C06", // 3GPP-SMS TPDU
expect: {commandQualifier: 0x00,
text: "Short Message"}},
{command: "d081fd810301130182028183853854686520616464726573732064617461206f626a65637420686f6c6473207468652052501144657374696e6174696f6e114164647265737386099111223344556677f88b81ac0100099110325476f840f4a054776f2074797065732061726520646566696e65643a202d20412073686f7274206d65737361676520746f2062652073656e7420746f20746865206e6574776f726b20696e20616e20534d532d5355424d4954206d6573736167652c206f7220616e20534d532d434f4d4d414e44206d6573736167652c20776865726520746865207573657220646174612063616e20626520706173736564207472616e7370",
{command: "D081FD" + // Length
"8103011301" + // Command details
"82028183" + // Device identities
"853854686520616464726573732064617461206F62" + // Alpha identifier
"6A65637420686F6C64732074686520525011446573" +
"74696E6174696F6E1141646472657373" +
"86099111223344556677F8" + // Address
"8B81AC0100099110325476F840F4A054776F20747970" + // 3GPP-SMS TPDU
"65732061726520646566696E65643A202D2041207368" +
"6F7274206D65737361676520746F2062652073656E74" +
"20746F20746865206E6574776F726B20696E20616E20" +
"534D532D5355424D4954206D6573736167652C206F72" +
"20616E20534D532D434F4D4D414E44206D6573736167" +
"652C2077686572652074686520757365722064617461" +
"2063616E20626520706173736564207472616E7370",
expect: {commandQualifier: 0x01,
text: "The address data object holds the RP_Destination_Address"}},
{command: "d081c381030113018202818386099111223344556677f88b81ac0100099110325476f840f4a054776f2074797065732061726520646566696e65643a202d20412073686f7274206d65737361676520746f2062652073656e7420746f20746865206e6574776f726b20696e20616e20534d532d5355424d4954206d6573736167652c206f7220616e20534d532d434f4d4d414e44206d6573736167652c20776865726520746865207573657220646174612063616e20626520706173736564207472616e7370",
{command: "D081C3" + // Length
"8103011301" + // Command details
"82028183" + // Device identities
"86099111223344556677F8" + // Address
"8B81AC0100099110325476F840F4A054776F20747970" + // 3GPP-SMS TPDU
"65732061726520646566696E65643A202D2041207368" +
"6F7274206D65737361676520746F2062652073656E74" +
"20746F20746865206E6574776F726B20696E20616E20" +
"534D532D5355424D4954206D6573736167652C206F72" +
"20616E20534D532D434F4D4D414E44206D6573736167" +
"652C2077686572652074686520757365722064617461" +
"2063616E20626520706173736564207472616E7370",
expect: {commandQualifier: 0x01}},
{command: "d081fd8103011300820281838581e654776f2074797065732061726520646566696e65643a202d20412073686f7274206d65737361676520746f2062652073656e7420746f20746865206e6574776f726b20696e20616e20534d532d5355424d4954206d6573736167652c206f7220616e20534d532d434f4d4d414e44206d6573736167652c20776865726520746865207573657220646174612063616e20626520706173736564207472616e73706172656e746c793b202d20412073686f7274206d65737361676520746f2062652073656e7420746f20746865206e6574776f726b20696e20616e20534d532d5355424d4954208b09010002911040f00120",
{command: "D081FD" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"8581E654776F207479706573206172652064656669" + // Alpha identifier
"6E65643A202D20412073686F7274206D6573736167" +
"6520746F2062652073656E7420746F20746865206E" +
"6574776F726B20696E20616E20534D532D5355424D" +
"4954206D6573736167652C206F7220616E20534D53" +
"2D434F4D4D414E44206D6573736167652C20776865" +
"726520746865207573657220646174612063616E20" +
"626520706173736564207472616E73706172656E74" +
"6C793B202D20412073686F7274206D657373616765" +
"20746F2062652073656E7420746F20746865206E65" +
"74776F726B20696E20616E20534D532D5355424D49" +
"5420" +
"8B09010002911040F00120", // 3GPP-SMS TPDU
expect: {commandQualifier: 0x00,
text: "Two types are defined: - A short message to be sent to the network in an SMS-SUBMIT message, or an SMS-COMMAND message, where the user data can be passed transparently; - A short message to be sent to the network in an SMS-SUBMIT "}},
{command: "d030810301130082028183850086099111223344556677f88b180100099110325476f840f40c54657374204d657373616765",
func: testSendSMS,
text: "Two types are defined: - A short message to be sent to " +
"the network in an SMS-SUBMIT message, or an SMS-COMMAND " +
"message, where the user data can be passed transparently; " +
"- A short message to be sent to the network in an " +
"SMS-SUBMIT "}},
{command: "D030" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"8500" + // Alpha identifier
"86099111223344556677F8" + // Address
"8B180100099110325476F840F40C54657374204D657373616765", // 3GPP-SMS TPDU
expect: {commandQualifier: 0x00,
text: ""}},
{command: "d05581030113008202818385198004170414042004100412042104220412042304190422041586099111223344556677f88b240100099110325476f8400818041704140420041004120421042204120423041904220415",
{command: "D055" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"851980041704140420041004120421042204120423041904220415" + // Alpha identifier
"86099111223344556677F8" + // Address
"8B240100099110325476F8400818041704140420041004120421042204120423041904220415", // 3GPP-SMS TPDU
expect: {commandQualifier: 0x00,
text: "ЗДРАВСТВУЙТЕ"}},
{command: "d04b810301130082028183850f810c089794a09092a1a292a399a29586099111223344556677f88b240100099110325476f8400818041704140420041004120421042204120423041904220415",
{command: "D04B" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"850F810C089794A09092A1A292A399A295" + // Alpha identifier
"86099111223344556677F8" + // Address
"8B240100099110325476F8400818041704140420041004120421042204120423041904220415", // 3GPP-SMS TPDU
expect: {commandQualifier: 0x00,
text: "ЗДРАВСТВУЙТЕ"}},
{command: "d03b81030113008202818385074e4f2049434f4e86099111223344556677f88b180100099110325476f840f40c54657374204d6573736167659e020002",
{command: "D03B" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"85074E4F2049434F4E" + // Alpha identifier
"86099111223344556677F8" + // Address
"8B180100099110325476F840F40C54657374204D657373616765" + // 3GPP-SMS TPDU
"9E020002", // Icon identifier
expect: {commandQualifier: 0x00,
// The record number 02 in EFimg is not defined, so no icon will be
// shown, but the text string should still be displayed.
text: "NO ICON"}},
{command: "d03281030113008202818386099111223344556677f88b180100099110325476f840f40c54657374204d6573736167659e020001",
{command: "D032" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"86099111223344556677F8" + // Address
"8B180100099110325476F840F40C54657374204D657373616765" + // 3GPP-SMS TPDU
"9E020001", // Icon identifier
expect: {commandQualifier: 0x00,
iconSelfExplanatory: true,
icons: [BASIC_ICON]}},
{command: "d03b810301130082028183850753656e6420534d86099111223344556677f88b180100099110325476f840f40c54657374204d6573736167651e020101",
{command: "D03B" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"850753656E6420534D" + // Alpha identifier
"86099111223344556677F8" + // Address
"8B180100099110325476F840F40C54657374204D657373616765" + // 3GPP-SMS TPDU
"1E020101", // Icon identifier
expect: {commandQualifier: 0x00,
text: "Send SM",
iconSelfExplanatory: false,
icons: [BASIC_ICON]}},
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001000b4",
{command: "D02C" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"851054657874204174747269627574652031" + // Alpha identifier
"8B09010002911040F00120" + // 3GPP-SMS TPDU
"D004001000B4", // Text attribute
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d0358103011300820281838509800038003030eb003086099111223344556677f88b140100099110325476f84008080038003030eb0031",
expect: {commandQualifier: 0x00,
{command: "D035" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"8509800038003030EB0030" + // Alpha identifier
"86099111223344556677F8" + // Address
"8B140100099110325476F84008080038003030EB0031",
expect: {commandQualifier: 0x00, // 3GPP-SMS TPDU
text: "80ル0"}},
{command: "d03381030113008202818385078104613831eb3186099111223344556677f88b140100099110325476f84008080038003030eb0032",
expect: {commandQualifier: 0x00,
{command: "D033" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"85078104613831EB31" + // Alpha identifier
"86099111223344556677F8" + // Address
"8B140100099110325476F84008080038003030EB0032",
expect: {commandQualifier: 0x00, // 3GPP-SMS TPDU
text: "81ル1"}},
{command: "d0348103011300820281838508820430a03832cb3286099111223344556677f88b140100099110325476f84008080038003030eb0033",
expect: {commandQualifier: 0x00,
{command: "D034" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"8508820430A03832CB32" + // Alpha identifier
"86099111223344556677F8" + // Address
"8B140100099110325476F84008080038003030EB0033",
expect: {commandQualifier: 0x00, // 3GPP-SMS TPDU
text: "82ル2"}},
];
function testSendSMS(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_SMS, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
if (aExpect.text) {
// text is optional.
if ("text" in aExpect) {
is(aCommand.options.text, aExpect.text, "options.text");
}
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");

Просмотреть файл

@ -5,47 +5,101 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d029810301110082028183850c43616c6c20466f7277617264891091aa120a214365870921436587a901fb",
{command: "D029" + // Length
"8103011100" + // Command details
"82028183" + // Device identities
"850C43616C6C20466F7277617264" + // Alpha identifier
"891091AA120A214365870921436587A901FB", // SS string
expect: {commandQualifier: 0x00,
text: "Call Forward"}},
{command: "d01b810301110082028183891091aa120a214365870921436587a901fb",
expect: {name: "send_ss_cmd_1_without_alpha_identifier",
commandQualifier: 0x00}},
{command: "d081fd8103011100820281838581eb4576656e20696620746865204669786564204469616c6c696e67204e756d626572207365727669636520697320656e61626c65642c2074686520737570706c656d656e74617279207365727669636520636f6e74726f6c20737472696e6720696e636c7564656420696e207468652053454e442053532070726f61637469766520636f6d6d616e64207368616c6c206e6f7420626520636865636b656420616761696e73742074686f7365206f66207468652046444e206c6973742e2055706f6e20726563656976696e67207468697320636f6d6d616e642c20746865204d45207368616c6c20646563698904ffba13fb",
{command: "D01B" + // Length
"8103011100" + // Command details
"82028183" + // Device identities
"891091AA120A214365870921436587A901FB", // SS string
expect: {commandQualifier: 0x00}},
{command: "D081FD" + // Length
"8103011100" + // Command details
"82028183" + // Device identities
"8581EB4576656E2069662074686520466978656420" + // Alpha identifier
"4469616C6C696E67204E756D626572207365727669" +
"636520697320656E61626C65642C20746865207375" +
"70706C656D656E7461727920736572766963652063" +
"6F6E74726F6C20737472696E6720696E636C756465" +
"6420696E207468652053454E442053532070726F61" +
"637469766520636F6D6D616E64207368616C6C206E" +
"6F7420626520636865636B656420616761696E7374" +
"2074686F7365206F66207468652046444E206C6973" +
"742E2055706F6E20726563656976696E6720746869" +
"7320636F6D6D616E642C20746865204D4520736861" +
"6C6C2064656369" +
"8904FFBA13FB", // SS string
expect: {commandQualifier: 0x00,
text: "Even if the Fixed Dialling Number service is enabled, the supplementary service control string included in the SEND SS proactive command shall not be checked against those of the FDN list. Upon receiving this command, the ME shall deci"}},
{command: "d01d8103011100820281838500891091aa120a214365870921436587a901fb",
text: "Even if the Fixed Dialling Number service is enabled, " +
"the supplementary service control string included in the " +
"SEND SS proactive command shall not be checked against " +
"those of the FDN list. Upon receiving this command, the " +
"ME shall deci"}},
{command: "D01D" + // Length
"8103011100" + // Command details
"82028183" + // Device identities
"8500" + // Alpha identifier
"891091AA120A214365870921436587A901FB", // SS string
expect: {commandQualifier: 0x00,
text: ""}},
{command: "d02b810301110082028183850a42617369632049636f6e891091aa120a214365870921436587a901fb9e020001",
{command: "D02B" + // Length
"8103011100" + // Command details
"82028183" + // Device identities
"850A42617369632049636F6E" + // Alpha identifier
"891091AA120A214365870921436587A901FB" + // SS string
"9E020001", // Icon identifier
expect: {commandQualifier: 0x00,
text: "Basic Icon",
iconSelfExplanatory: true,
icons: [BASIC_ICON]}},
{command: "d01f810301110082028183891091aa120a214365870921436587a901fb9e020003",
{command: "D01F" + // Length
"8103011100" + // Command details
"82028183" + // Device identities
"891091AA120A214365870921436587A901FB" + // SS string
"9E020103", // Icon identifier
expect: {commandQualifier: 0x00,
iconSelfExplanatory: true,
iconSelfExplanatory: false,
icons: [COLOR_ICON]}},
{command: "d036810301110082028183851980041704140420041004120421042204120423041904220415891091aa120a214365870921436587a901fb",
{command: "D036" + // Length
"8103011100" + // Command details
"82028183" + // Device identities
"851980041704140420041004120421042204120423041904220415" + // Alpha identifier
"891091AA120A214365870921436587A901FB", // SS string
expect: {commandQualifier: 0x00,
text: "ЗДРАВСТВУЙТЕ"}},
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001000b4",
{command: "D033" + // Length
"8103011100" + // Command details
"82028183" + // Device identities
"851054657874204174747269627574652031" + // Alpha identifier
"891091AA120A214365870921436587A901FB" + // SS string
"D004001000B4", // Text attribute
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d0228103011100820281838505804f60597d891091aa120a214365870921436587a901fb",
{command: "D022" + // Length
"8103011100" + // Command details
"82028183" + // Device identities
"8505804F60597D" + // Alpha identifier
"891091AA120A214365870921436587A901FB", // SS string
expect: {commandQualifier: 0x00,
text: "你好"}},
];
function testSendSS(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_SS, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
if (aExpect.text) {
// text is optional.
if ("text" in aExpect) {
is(aCommand.options.text, aExpect.text, "options.text");
}
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");

Просмотреть файл

@ -5,54 +5,139 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d050810301120082028183850a372d62697420555353448a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
{command: "D050" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"850A372D6269742055535344" + // Alpha identifier
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560",
expect: {commandQualifier: 0x00,
text: "7-bit USSD"}},
{command: "d0448103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
{command: "D044" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560",
expect: {commandQualifier: 0x00}},
{command: "d058810301120082028183850a382d62697420555353448a41444142434445464748494a4b4c4d4e4f505152535455565758595a2d6162636465666768696a6b6c6d6e6f707172737475767778797a2d31323334353637383930",
{command: "D058" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"850A382D6269742055535344" + // Alpha identifier
"8A41444142434445464748494A4B4C4D4E4F5051525354" + // USSD string
"55565758595A2D6162636465666768696A6B6C6D6E6F70" +
"7172737475767778797A2D31323334353637383930",
expect: {commandQualifier: 0x00,
text: "8-bit USSD"}},
{command: "d02f81030112008202818385095543533220555353448a1948041704140420041004120421042204120423041904220415",
{command: "D02F" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"8509554353322055535344" + // Alpha identifier
"8A1948041704140420041004120421042204120423041904220415", // USSD string
expect: {commandQualifier: 0x00,
text: "UCS2 USSD"}},
{command: "d081fd8103011200820281838581b66f6e636520612052454c4541534520434f4d504c455445206d65737361676520636f6e7461696e696e672074686520555353442052657475726e20526573756c74206d657373616765206e6f7420636f6e7461696e696e6720616e206572726f7220686173206265656e2072656365697665642066726f6d20746865206e6574776f726b2c20746865204d45207368616c6c20696e666f726d207468652053494d20746861742074686520636f6d6d616e64206861738a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
{command: "D081FD" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"8581B66F6E636520612052454C4541534520434F4D" + // Alpha identifier
"504C455445206D65737361676520636F6E7461696E" +
"696E672074686520555353442052657475726E2052" +
"6573756C74206D657373616765206E6F7420636F6E" +
"7461696E696E6720616E206572726F722068617320" +
"6265656E2072656365697665642066726F6D207468" +
"65206E6574776F726B2C20746865204D4520736861" +
"6C6C20696E666F726D207468652053494D20746861" +
"742074686520636F6D6D616E6420686173" +
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560",
expect: {commandQualifier: 0x00,
text: "once a RELEASE COMPLETE message containing the USSD Return Result message not containing an error has been received from the network, the ME shall inform the SIM that the command has"}},
{command: "d04681030112008202818385008a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
text: "once a RELEASE COMPLETE message containing the USSD " +
"Return Result message not containing an error has been " +
"received from the network, the ME shall inform the SIM " +
"that the command has"}},
{command: "D046" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"8500" + // Alpha identifier
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560",
expect: {commandQualifier: 0x00,
text: ""}},
{command: "d054810301120082028183850a42617369632049636f6e8a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e5609e020001",
{command: "D054" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"850A42617369632049636F6E" + // Alpha identifier
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560" +
"9E020001", // Icon identifier
expect: {commandQualifier: 0x00,
text: "Basic Icon",
iconSelfExplanatory: true,
icons: [BASIC_ICON]}},
{command: "d0488103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e5609e020003",
{command: "D048" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560" +
"9E020103", // Icon identifier
expect: {commandQualifier: 0x00,
iconSelfExplanatory: true,
iconSelfExplanatory: false,
icons: [COLOR_ICON]}},
{command: "d05f8103011200820281838519800417041404200410041204210422041204230419042204158a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
{command: "D05F" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"851980041704140420041004120421042204120423041904220415" + // Alpha identifier
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560",
expect: {commandQualifier: 0x00,
text: "ЗДРАВСТВУЙТЕ"}},
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001000b4",
{command: "D05C" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"851054657874204174747269627574652031" + // Alpha identifier
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560" +
"D004001000B4", // Text attribute
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001000b4",
{command: "D04A" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560" +
"D004001000B4", // Text attribute
expect: {commandQualifier: 0x00}},
{command: "d04b8103011200820281838505804f60597d8a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
{command: "D04B" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"8505804F60597D" + // Alpha identifier
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560",
expect: {commandQualifier: 0x00,
text: "你好"}},
];
function testSendUSSD(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_USSD, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
if (aExpect.text) {
// text is optional.
if ("text" in aExpect) {
is(aCommand.options.text, aExpect.text, "options.text");
}
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");

Просмотреть файл

@ -5,73 +5,174 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d01e81030110008202818385084e6f7420627573798609911032042143651c2c",
{command: "D01E" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"85084E6F742062757379" + // Alpha identifier
"8609911032042143651C2C", // Address
expect: {commandQualifier: 0x00,
confirmMessage: { text: "Not busy" },
address: "+012340123456,1,2"}},
{command: "d01d81030110028202818385074f6e20686f6c648609911032042143651c2c",
{command: "D01D" + // Length
"8103011002" + // Command details
"82028183" + // Device identities
"85074F6E20686F6C64" + // Alpha identifier
"8609911032042143651C2C", // Address
expect: {commandQualifier: 0x02,
confirmMessage: { text: "On hold" },
address: "+012340123456,1,2"}},
{command: "d020810301100482028183850a446973636f6e6e6563748609911032042143651c2c",
{command: "D020" + // Length
"8103011004" + // Command details
"82028183" + // Device identities
"850A446973636F6E6E656374" + // Alpha identifier
"8609911032042143651C2C", // Address
expect: {commandQualifier: 0x04,
confirmMessage: { text: "Disconnect" },
address: "+012340123456,1,2"}},
{command: "d02b81030110008202818385114361706162696c69747920636f6e6669678609911032042143651c2c870201a0",
{command: "D02B" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"85114361706162696C69747920636F6E666967" + // Alpha identifier
"8609911032042143651C2C" + // Address
"870201A0", // Capability configuration parameters
expect: {commandQualifier: 0x00,
confirmMessage: { text: "Capability config" },
address: "+012340123456,1,2"}},
{command: "d01c81030110018202818386119110325476981032547698103254769810",
{command: "D01C" + // Length
"8103011001" + // Command details
"82028183" + // Device identities
"86119110325476981032547698103254769810", // Address
expect: {commandQualifier: 0x01,
address: "+01234567890123456789012345678901"}},
{command: "d081fd8103011001820281838581ed54687265652074797065732061726520646566696e65643a202d2073657420757020612063616c6c2c20627574206f6e6c79206966206e6f742063757272656e746c792062757379206f6e20616e6f746865722063616c6c3b202d2073657420757020612063616c6c2c2070757474696e6720616c6c206f746865722063616c6c732028696620616e7929206f6e20686f6c643b202d2073657420757020612063616c6c2c20646973636f6e6e656374696e6720616c6c206f746865722063616c6c732028696620616e79292066697273742e20466f722065616368206f662074686573652074797065732c2086029110",
{command: "D081FD" + // Length
"8103011001" + // Command details
"82028183" + // Device identities
"8581ED546872656520747970657320617265206465" + // Alpha identifier
"66696E65643A202D2073657420757020612063616C" +
"6C2C20627574206F6E6C79206966206E6F74206375" +
"7272656E746C792062757379206F6E20616E6F7468" +
"65722063616C6C3B202D2073657420757020612063" +
"616C6C2C2070757474696E6720616C6C206F746865" +
"722063616C6C732028696620616E7929206F6E2068" +
"6F6C643B202D2073657420757020612063616C6C2C" +
"20646973636F6E6E656374696E6720616C6C206F74" +
"6865722063616C6C732028696620616E7929206669" +
"7273742E20466F722065616368206F662074686573" +
"652074797065732C20" +
"86029110", // Address
expect: {commandQualifier: 0x01,
confirmMessage: { text: "Three types are defined: - set up a call, but only if not currently busy on another call; - set up a call, putting all other calls (if any) on hold; - set up a call, disconnecting all other calls (if any) first. For each of these types, " },
confirmMessage: {
text: "Three types are defined: - set up a call, but only if " +
"not currently busy on another call; - set up a call, " +
"putting all other calls (if any) on hold; - set up a " +
"call, disconnecting all other calls (if any) first. For " +
"each of these types, "
},
address: "+01"}},
{command: "d02281030110018202818385084475726174696f6e8609911032042143651c2c8402010a",
{command: "D022" + // Length
"8103011001" + // Command details
"82028183" + // Device identities
"85084475726174696F6E" + // Alpha identifier
"8609911032042143651C2C" + // Address
"8402010A", // Duration
expect: {commandQualifier: 0x01,
confirmMessage: { text: "Duration" },
address: "+012340123456,1,2",
duration: {timeUnit: MozIccManager.STK_TIME_UNIT_SECOND,
timeInterval: 0x0A}}},
{command: "d028810301100082028183850c434f4e4649524d4154494f4e8609911032042143651c2c850443414c4c",
{command: "D028" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"850C434F4E4649524D4154494F4E" + // Alpha identifier
"8609911032042143651C2C" + // Address
"850443414C4C", // Alpha identifier
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION" },
callMessage: { text: "CALL" },
address: "+012340123456,1,2"}},
{command: "d03081030110008202818385165365742075702063616c6c2049636f6e20332e312e318609911032042143651c2c9e020101",
{command: "D030" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"85165365742075702063616C6C2049636F6E20332E312E31" + // Alpha identifier
"8609911032042143651C2C" + // Address
"9E020101", // Icon identifier
expect: {commandQualifier: 0x00,
confirmMessage: { text: "Set up call Icon 3.1.1",
iconSelfExplanatory: false,
icons: [BASIC_ICON] },
address: "+012340123456,1,2"}},
{command: "d04c81030110008202818385165365742075702063616c6c2049636f6e20332e342e318609911032042143651c2c9e02000185165365742075702063616c6c2049636f6e20332e342e329e020001",
{command: "D04C" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"85165365742075702063616C6C2049636F6E20332E342E31" + // Alpha identifier
"8609911032042143651C2C" + // Address
"9E020001" + // Icon identifier
"85165365742075702063616C6C2049636F6E20332E342E32" + // Alpha identifier
"9E020003", // Icon identifier
expect: {commandQualifier: 0x00,
confirmMessage: { text: "Set up call Icon 3.4.1",
iconSelfExplanatory: true,
icons: [BASIC_ICON] },
callMessage: { text: "Set up call Icon 3.4.2" },
callMessage: { text: "Set up call Icon 3.4.2" ,
iconSelfExplanatory: true,
icons: [COLOR_ICON] },
address: "+012340123456,1,2"}},
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e00b4d004000600b4",
{command: "D038" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"850E434F4E4649524D4154494F4E2031" + // Alpha identifier
"8609911032042143651C2C" + // Address
"850643414C4C2031" + // Alpha identifier
"D004000E00B4" + // Text attribute
"D004000600B4", // Text attribute
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 1" },
callMessage: { text: "CALL 1" },
address: "+012340123456,1,2"}},
{command: "d04c810301100082028183851b800417041404200410041204210422041204230419042204150031860791103204214365851b800417041404200410041204210422041204230419042204150032",
{command: "D04C" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"851B800417041404200410041204210422041204230419042204150031" + // Alpha identifier
"860791103204214365" + // Address
"851B800417041404200410041204210422041204230419042204150032", // Alpha identifier
expect: {commandQualifier: 0x00,
confirmMessage: { text: "ЗДРАВСТВУЙТЕ1" },
callMessage: { text: "ЗДРАВСТВУЙТЕ2" },
address: "+012340123456"}},
{command: "d0198103011000820281838505804e0d5fd9860791103204214365",
{command: "D019" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"8505804E0D5FD9" + // Alpha identifier
"860791103204214365", // Address
expect: {commandQualifier: 0x00,
confirmMessage: { text: "不忙" },
address: "+012340123456"}},
{command: "d022810301100082028183850580786e5b9a860791103204214365850780625375358bdd",
{command: "D022" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"850580786E5B9A" + // Alpha identifier
"860791103204214365" + // Address
"850780625375358BDD", // Alpha identifier
expect: {commandQualifier: 0x00,
confirmMessage: { text: "确定" },
callMessage: { text: "打电话" },
address: "+012340123456"}},
{command: "d01c8103011000820281838609911032042143651c2c9e0200019e020103",
{command: "D016" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"8500" + // Alpha identifier
"860791103204214365" + // Address
"8500", // Alpha identifier
expect: {commandQualifier: 0x00,
confirmMessage: { text: "" },
callMessage: { text: "" },
address: "+012340123456"}},
{command: "D01C" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"8609911032042143651C2C" + // Address
"9E020001" + // Icon identifier
"9E020103", // Icon identifier
expect: {commandQualifier: 0x00,
confirmMessage: { iconSelfExplanatory: true,
icons: [BASIC_ICON] },
@ -81,23 +182,25 @@ const TEST_DATA = [
];
function testSetupCall(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SET_UP_CALL,
"typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier,
"commandQualifier");
is(aCommand.options.address, aExpect.address,
"options.address");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.address, aExpect.address, "options.address");
if (aExpect.confirmMessage) {
// confirmMessage is optional.
if ("confirmMessage" in aExpect) {
isStkText(aCommand.options.confirmMessage, aExpect.confirmMessage);
}
if (aExpect.callMessage) {
// callMessage is optional.
if ("callMessage" in aExpect) {
isStkText(aCommand.options.callMessage, aExpect.callMessage);
}
let duration = aCommand.options.duration;
if (duration) {
// duration is optional.
if ("duration" in aExpect) {
let duration = aCommand.options.duration;
is(duration.timeUnit, aExpect.duration.timeUnit, "duration.timeUnit");
is(duration.timeInterval, aExpect.duration.timeInterval,
"duration.timeInterval");

Просмотреть файл

@ -5,27 +5,46 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d00c810301050082028182990104",
{command: "D00C" + // Length
"8103010500" + // Command details
"82028182" + // Device identities
"990104", // Event list
expect: {commandQualifier: 0x00,
eventList: [4]}},
{command: "d00d81030105008202818299020507",
{command: "D00D" + // Length
"8103010500" + // Command details
"82028182" + // Device identities
"99020507", // Event list
expect: {commandQualifier: 0x00,
eventList: [5, 7]}},
{command: "d00c810301050082028182990107",
{command: "D00C" + // Length
"8103010500" + // Command details
"82028182" + // Device identities
"990107", // Event list
expect: {commandQualifier: 0x00,
eventList: [7]}},
{command: "d00c810301050082028182990107",
{command: "D00C" + // Length
"8103010500" + // Command details
"82028182" + // Device identities
"990107", // Event list
expect: {commandQualifier: 0x00,
eventList: [7]}},
{command: "d00b8103010500820281829900",
{command: "D00B" + // Length
"8103010500" + // Command details
"82028182" + // Device identities
"9900", // Event list
expect: {commandQualifier: 0x00,
eventList: null}},
{command: "d00c810301050082028182990107",
{command: "D00C" + // Length
"8103010500" + // Command details
"82028182" + // Device identities
"990107", // Event list
expect: {commandQualifier: 0x00,
eventList: [7]}}
];
function testSetupEventList(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SET_UP_EVENT_LIST,
"typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");

Просмотреть файл

@ -5,40 +5,81 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d01a8103012800820281828d0f0449646c65204d6f64652054657874",
{command: "D01A" + // Length
"8103012800" + // Command details
"82028182" + // Device identities
"8D0F0449646C65204D6F64652054657874", // Text string
expect: {commandQualifier: 0x00,
text: "Idle Mode Text"}},
{command: "d081fd8103012800820281828d81f100547419344d3641737498cd06cdeb70383b0f0a83e8653c1d34a7cbd3ee330b7447a7c768d01c1d66b341e232889c9ec3d9e17c990c12e741747419d42c82c27350d80d4a93d96550fb4d2e83e8653c1d943683e8e832a85904a5e7a0b0985d06d1df20f21b94a6bba8e832082e2fcfcb6e7a989e7ebb41737a9e5d06a5e72076d94c0785e7a0b01b946ec3d9e576d94d0fd3d36f37885c1ea7e7e9b71b447f83e8e832a85904b5c3eeba393ca6d7e565b90b444597416932bb0c6abfc96510bd8ca783e6e8309b0d129741e4f41cce0ee7cb6450da0d0a83da61b7bb2c07d1d1613aa8ec9ed7e5e539888e0ed341ee32",
{command: "D081FD" + // Length
"8103012800" + // Command details
"82028182" + // Device identities
"8D81F100547419344D3641737498CD06CDEB70383B0F0A" + // Text string
"83E8653C1D34A7CBD3EE330B7447A7C768D01C1D66B341" +
"E232889C9EC3D9E17C990C12E741747419D42C82C27350" +
"D80D4A93D96550FB4D2E83E8653C1D943683E8E832A859" +
"04A5E7A0B0985D06D1DF20F21B94A6BBA8E832082E2FCF" +
"CB6E7A989E7EBB41737A9E5D06A5E72076D94C0785E7A0" +
"B01B946EC3D9E576D94D0FD3D36F37885C1EA7E7E9B71B" +
"447F83E8E832A85904B5C3EEBA393CA6D7E565B90B4445" +
"97416932BB0C6ABFC96510BD8CA783E6E8309B0D129741" +
"E4F41CCE0EE7CB6450DA0D0A83DA61B7BB2C07D1D1613A" +
"A8EC9ED7E5E539888E0ED341EE32",
expect: {commandQualifier: 0x00,
text: "The SIM shall supply a text string, which shall be displayed by the ME as an idle mode text if the ME is able to do it.The presentation style is left as an implementation decision to the ME manufacturer. The idle mode text shall be displayed in a manner that ensures that ne"}},
{command: "d0198103012800820281828d0a0449646c6520746578749e020001",
text: "The SIM shall supply a text string, which shall be " +
"displayed by the ME as an idle mode text if the ME is " +
"able to do it.The presentation style is left as an " +
"implementation decision to the ME manufacturer. The idle " +
"mode text shall be displayed in a manner that ensures " +
"that ne"}},
{command: "D019" + // Length
"8103012800" + // Command details
"82028182" + // Device identities
"8D0A0449646C652074657874" + // Text string
"9E020101", // Icon identifier
expect: {commandQualifier: 0x00,
text: "Idle text",
iconSelfExplanatory: true,
iconSelfExplanatory: false,
icons: [BASIC_ICON]}},
{command: "d0198103012800820281828d0a0449646c6520746578749e020007",
{command: "D019" + // Length
"8103012800" + // Command details
"82028182" + // Device identities
"8D0A0449646C652074657874" + // Text string
"9E020007", // Icon identifier
expect: {commandQualifier: 0x00,
text: "Idle text",
iconSelfExplanatory: true,
icons: [COLOR_ICON, COLOR_TRANSPARENCY_ICON]}},
{command: "d0248103012800820281828d1908041704140420041004120421042204120423041904220415",
{command: "D024" + // Length
"8103012800" + // Command details
"82028182" + // Device identities
"8D1908041704140420041004120421042204120423041904220415", // Text string
expect: {commandQualifier: 0x00,
text: "ЗДРАВСТВУЙТЕ"}},
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001000b4",
{command: "D022" + // Length
"8103012800" + // Command details
"82028182" + // Device identities
"8D110449646C65204D6F646520546578742031" + // Text string
"D004001000B4", // Text attribute
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 1"}},
{command: "d0108103012800820281828d05084f60597d",
{command: "D010" + // Length
"8103012800" + // Command details
"82028182" + // Device identities
"8D05084F60597D", // Text string
expect: {commandQualifier: 0x00,
text: "你好"}},
];
function testSetupIdleModeText(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SET_UP_IDLE_MODE_TEXT,
"typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.text, aExpect.text, "options.text");
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");

Просмотреть файл

@ -5,28 +5,163 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d081fc810301250082028182850a4c617267654d656e75318f05505a65726f8f044f4f6e658f044e54776f8f064d54687265658f054c466f75728f054b466976658f044a5369788f0649536576656e8f064845696768748f05474e696e658f0646416c7068618f0645427261766f8f0844436861726c69658f064344656c74618f05424563686f8f0941466f782d74726f748f0640426c61636b8f063f42726f776e8f043e5265648f073d4f72616e67658f073c59656c6c6f778f063b477265656e8f053a426c75658f073956696f6c65748f0538477265798f063757686974658f06366d696c6c698f06356d6963726f8f05346e616e6f8f05337069636f",
{command: "D081FC" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"850A4C617267654D656E7531" + // Alpha identifier
"8F05505A65726F" + // Item
"8F044F4F6E65" + // Item
"8F044E54776F" + // Item
"8F064D5468726565" + // Item
"8F054C466F7572" + // Item
"8F054B46697665" + // Item
"8F044A536978" + // Item
"8F0649536576656E" + // Item
"8F06484569676874" + // Item
"8F05474E696E65" + // Item
"8F0646416C706861" + // Item
"8F0645427261766F" + // Item
"8F0844436861726C6965" + // Item
"8F064344656C7461" + // Item
"8F05424563686F" + // Item
"8F0941466F782D74726F74" + // Item
"8F0640426C61636B" + // Item
"8F063F42726F776E" + // Item
"8F043E526564" + // Item
"8F073D4F72616E6765" + // Item
"8F073C59656C6C6F77" + // Item
"8F063B477265656E" + // Item
"8F053A426C7565" + // Item
"8F073956696F6C6574" + // Item
"8F053847726579" + // Item
"8F06375768697465" + // Item
"8F06366D696C6C69" + // Item
"8F06356D6963726F" + // Item
"8F05346E616E6F" + // Item
"8F05337069636F", // Item
expect: {commandQualifier: 0x00,
title: "LargeMenu1",
items: [{identifier: 80, text: "Zero"}, {identifier: 79, text: "One"}, {identifier: 78, text: "Two"}, {identifier: 77, text: "Three"}, {identifier: 76, text: "Four"}, {identifier: 75, text: "Five"}, {identifier: 74, text: "Six"}, {identifier: 73, text: "Seven"}, {identifier: 72, text: "Eight"}, {identifier: 71, text: "Nine"}, {identifier: 70, text: "Alpha"}, {identifier: 69, text: "Bravo"}, {identifier: 68, text: "Charlie"}, {identifier: 67, text: "Delta"}, {identifier: 66, text: "Echo"}, {identifier: 65, text: "Fox-trot"}, {identifier: 64, text: "Black"}, {identifier: 63, text: "Brown"}, {identifier: 62, text: "Red"}, {identifier: 61, text: "Orange"}, {identifier: 60, text: "Yellow"}, {identifier: 59, text: "Green"}, {identifier: 58, text: "Blue"}, {identifier: 57, text: "Violet"}, {identifier: 56, text: "Grey"}, {identifier: 55, text: "White"}, {identifier: 54, text: "milli"}, {identifier: 53, text: "micro"}, {identifier: 52, text: "nano"}, {identifier: 51, text: "pico"}]}},
{command: "d081f3810301250082028182850a4c617267654d656e75328f1dff312043616c6c20466f727761726420556e636f6e646974696f6e616c8f1cfe322043616c6c20466f7277617264204f6e205573657220427573798f1bfd332043616c6c20466f7277617264204f6e204e6f205265706c798f25fc342043616c6c20466f7277617264204f6e2055736572204e6f7420526561636861626c658f20fb352042617272696e67204f6620416c6c204f7574676f696e672043616c6c738f24fa362042617272696e67204f6620416c6c204f7574676f696e6720496e742043616c6c738f13f93720434c492050726573656e746174696f6e",
items: [{identifier: 80, text: "Zero"},
{identifier: 79, text: "One"},
{identifier: 78, text: "Two"},
{identifier: 77, text: "Three"},
{identifier: 76, text: "Four"},
{identifier: 75, text: "Five"},
{identifier: 74, text: "Six"},
{identifier: 73, text: "Seven"},
{identifier: 72, text: "Eight"},
{identifier: 71, text: "Nine"},
{identifier: 70, text: "Alpha"},
{identifier: 69, text: "Bravo"},
{identifier: 68, text: "Charlie"},
{identifier: 67, text: "Delta"},
{identifier: 66, text: "Echo"},
{identifier: 65, text: "Fox-trot"},
{identifier: 64, text: "Black"},
{identifier: 63, text: "Brown"},
{identifier: 62, text: "Red"},
{identifier: 61, text: "Orange"},
{identifier: 60, text: "Yellow"},
{identifier: 59, text: "Green"},
{identifier: 58, text: "Blue"},
{identifier: 57, text: "Violet"},
{identifier: 56, text: "Grey"},
{identifier: 55, text: "White"},
{identifier: 54, text: "milli"},
{identifier: 53, text: "micro"},
{identifier: 52, text: "nano"},
{identifier: 51, text: "pico"}]}},
{command: "D081F3" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"850A4C617267654D656E7532" + // Alpha identifier
"8F1DFF312043616C6C20466F727761726420556E636F6E646974" + // Item
"696F6E616C" +
"8F1CFE322043616C6C20466F7277617264204F6E205573657220" + // Item
"42757379" +
"8F1BFD332043616C6C20466F7277617264204F6E204E6F205265" + // Item
"706C79" +
"8F25FC342043616C6C20466F7277617264204F6E205573657220" + // Item
"4E6F7420526561636861626C65" +
"8F20FB352042617272696E67204F6620416C6C204F7574676F69" + // Item
"6E672043616C6C73" +
"8F24FA362042617272696E67204F6620416C6C204F7574676F69" + // Item
"6E6720496E742043616C6C73" +
"8F13F93720434C492050726573656E746174696F6E", // Item
expect: {commandQualifier: 0x00,
title: "LargeMenu2",
items: [{identifier: 255, text: "1 Call Forward Unconditional"}, {identifier: 254, text: "2 Call Forward On User Busy"}, {identifier: 253, text: "3 Call Forward On No Reply"}, {identifier: 252, text: "4 Call Forward On User Not Reachable"}, {identifier: 251, text: "5 Barring Of All Outgoing Calls"}, {identifier: 250, text: "6 Barring Of All Outgoing Int Calls"}, {identifier: 249, text: "7 CLI Presentation"}]}},
{command: "d081fc8103012500820281828581ec5468652053494d207368616c6c20737570706c79206120736574206f66206d656e75206974656d732c207768696368207368616c6c20626520696e7465677261746564207769746820746865206d656e752073797374656d20286f72206f74686572204d4d4920666163696c6974792920696e206f7264657220746f206769766520746865207573657220746865206f70706f7274756e69747920746f2063686f6f7365206f6e65206f66207468657365206d656e75206974656d7320617420686973206f776e2064697363726574696f6e2e2045616368206974656d20636f6d70726973657320612073688f020159",
items: [{identifier: 255, text: "1 Call Forward Unconditional"},
{identifier: 254, text: "2 Call Forward On User Busy"},
{identifier: 253, text: "3 Call Forward On No Reply"},
{identifier: 252, text: "4 Call Forward On User Not Reachable"},
{identifier: 251, text: "5 Barring Of All Outgoing Calls"},
{identifier: 250, text: "6 Barring Of All Outgoing Int Calls"},
{identifier: 249, text: "7 CLI Presentation"}]}},
{command: "D081FC" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"8581EC5468652053494D207368616C6C20737570" + // Alpha identifier
"706C79206120736574206F66206D656E75206974" +
"656D732C207768696368207368616C6C20626520" +
"696E746567726174656420776974682074686520" +
"6D656E752073797374656D20286F72206F746865" +
"72204D4D4920666163696C6974792920696E206F" +
"7264657220746F20676976652074686520757365" +
"7220746865206F70706F7274756E69747920746F" +
"2063686F6F7365206F6E65206F66207468657365" +
"206D656E75206974656D7320617420686973206F" +
"776E2064697363726574696F6E2E204561636820" +
"6974656D20636F6D7072697365732061207368" +
"8F020159", // Item
expect: {commandQualifier: 0x00,
title: "The SIM shall supply a set of menu items, which shall be integrated with the menu system (or other MMI facility) in order to give the user the opportunity to choose one of these menu items at his own discretion. Each item comprises a sh",
title: "The SIM shall supply a set of menu items, which shall " +
"be integrated with the menu system (or other MMI " +
"facility) in order to give the user the opportunity to " +
"choose one of these menu items at his own discretion. " +
"Each item comprises a sh",
items: [{identifier: 1, text: "Y"}]}},
{command: "d03b810301258082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034",
{command: "D03B" + // Length
"8103012580" + // Command details
"82028182" + // Device identities
"850C546F6F6C6B6974204D656E75" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033" + // Item
"8F07044974656D2034", // Item
expect: {commandQualifier: 0x80,
title: "Toolkit Menu",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}]}},
{command: "d041810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034180413101526",
items: [{identifier: 1, text: "Item 1"},
{identifier: 2, text: "Item 2"},
{identifier: 3, text: "Item 3"},
{identifier: 4, text: "Item 4"}]}},
{command: "D041" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"850C546F6F6C6B6974204D656E75" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033" + // Item
"8F07044974656D2034" + // Item
"180413101526", // Items next action indicator
expect: {commandQualifier: 0x00,
title: "Toolkit Menu",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}],
nextActionList: [MozIccManager.STK_CMD_SEND_SMS, MozIccManager.STK_CMD_SET_UP_CALL, MozIccManager.STK_CMD_LAUNCH_BROWSER, MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO]}},
{command: "d03c810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20339e0200019f0400050505",
items: [{identifier: 1, text: "Item 1"},
{identifier: 2, text: "Item 2"},
{identifier: 3, text: "Item 3"},
{identifier: 4, text: "Item 4"}],
nextActionList: [MozIccManager.STK_CMD_SEND_SMS,
MozIccManager.STK_CMD_SET_UP_CALL,
MozIccManager.STK_CMD_LAUNCH_BROWSER,
MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO]}},
{command: "D03C" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"850C546F6F6C6B6974204D656E75" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033" + // Item
"9E020001" + // Icon identifier
"9F0400050505", // Item icon identifier list
expect: {commandQualifier: 0x00,
title: "Toolkit Menu",
iconSelfExplanatory: true,
@ -34,28 +169,83 @@ const TEST_DATA = [
items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
{identifier: 2, text: "Item 2", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
{identifier: 3, text: "Item 3", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]}]}},
{command: "d0819c8103012500820281828519800417041404200410041204210422041204230419042204158f1c018004170414042004100412042104220412042304190422041500318f1c028004170414042004100412042104220412042304190422041500328f1c038004170414042004100412042104220412042304190422041500338f1c04800417041404200410041204210422041204230419042204150034",
{command: "D036" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"850C546F6F6C6B6974204D656E75" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033" + // Item
"9E020001", // Icon identifier
expect: {commandQualifier: 0x00,
title: "Toolkit Menu",
iconSelfExplanatory: true,
icons: [BASIC_ICON],
items: [{identifier: 1, text: "Item 1"},
{identifier: 2, text: "Item 2"},
{identifier: 3, text: "Item 3"}]}},
{command: "D038" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"850C546F6F6C6B6974204D656E75" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033" + // Item
"9F0400030303", // Item icon identifier list
expect: {commandQualifier: 0x00,
title: "Toolkit Menu",
items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: true, icons: [COLOR_ICON]},
{identifier: 2, text: "Item 2", iconSelfExplanatory: true, icons: [COLOR_ICON]},
{identifier: 3, text: "Item 3", iconSelfExplanatory: true, icons: [COLOR_ICON]}]}},
{command: "D0819C" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"851980041704140420041004120421042204120423041904220415" + // Alpha identifier
"8F1C01800417041404200410041204210422041204230419042204150031" + // Item
"8F1C02800417041404200410041204210422041204230419042204150032" + // Item
"8F1C03800417041404200410041204210422041204230419042204150033" + // Item
"8F1C04800417041404200410041204210422041204230419042204150034", // Item
expect: {commandQualifier: 0x00,
title: "ЗДРАВСТВУЙТЕ",
items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"}, {identifier: 2, text: "ЗДРАВСТВУЙТЕ2"}, {identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}, {identifier: 4, text: "ЗДРАВСТВУЙТЕ4"}]}},
{command: "d03c8103012500820281828509805de551777bb153558f080180987976ee4e008f080280987976ee4e8c8f080380987976ee4e098f080480987976ee56db",
items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"},
{identifier: 2, text: "ЗДРАВСТВУЙТЕ2"},
{identifier: 3, text: "ЗДРАВСТВУЙТЕ3"},
{identifier: 4, text: "ЗДРАВСТВУЙТЕ4"}]}},
{command: "D03C" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"8509805DE551777BB15355" + // Alpha identifier
"8F080180987976EE4E00" + // Item
"8F080280987976EE4E8C" + // Item
"8F080380987976EE4E09" + // Item
"8F080480987976EE56DB", // Item
expect: {commandQualifier: 0x00,
title: "工具箱单",
items: [{identifier: 1, text: "项目一"}, {identifier: 2, text: "项目二"}, {identifier: 3, text: "项目三"}, {identifier: 4, text: "项目四"}]}},
{command: "d0208103012500820281828509805de551777bb153558f0411804e008f0412804e8c",
items: [{identifier: 1, text: "项目一"},
{identifier: 2, text: "项目二"},
{identifier: 3, text: "项目三"},
{identifier: 4, text: "项目四"}]}},
// Test remove setup menu.
{command: "D00D81030125008202818285008F00",
{command: "D00D" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"8500" + // Alpha identifier
"8F00", // Item
expect: {commandQualifier: 0x00,
title: "",
items: [null]}},
];
function testSetupMenu(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SET_UP_MENU, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.title, aExpect.title, "options.title");
// To ensure that 'presentationType' will only be available in SELECT_ITEM.
is(aCommand.options.presentationType, undefined, "presentationType");
is(aCommand.options.isHelpAvailable, !!(aCommand.commandQualifier & 0x80),
"isHelpAvailable");
is(aCommand.options.title, aExpect.title, "options.title");
for (let index in aExpect.items) {
let item = aCommand.options.items[index];
@ -77,13 +267,15 @@ function testSetupMenu(aCommand, aExpect) {
}
}
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");
}
if (aExpect.nextActionList) {
// nextActionList is optional.
if ("nextActionList" in aExpect) {
for (let index in aExpect.nextActionList) {
is(aCommand.options.nextActionList[index], aExpect.nextActionList[index],
"options.nextActionList[" + index + "]");

Просмотреть файл

@ -6,34 +6,43 @@ MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
// Start
{command: "d011810301270082028182a40101a503102030",
expect: {commandNumber: 0x01,
commandQualifier: MozIccManager.STK_TIMER_START,
{command: "D011" + // Length
"8103012700" + // Command details
"82028182" + // Device identities
"A40101" + // Timer identifier
"A503102030", // Timer value
expect: {commandQualifier: MozIccManager.STK_TIMER_START,
timerAction: MozIccManager.STK_TIMER_START,
timerId: 0x01,
timerValue: (0x01 * 60 * 60) + (0x02 * 60) + 0x03}},
// Deactivate
{command: "d00c810301270182028182a40104",
expect: {commandNumber: 0x01,
commandQualifier: MozIccManager.STK_TIMER_DEACTIVATE,
{command: "D00C" + // Length
"8103012701" + // Command details
"82028182" + // Device identities
"A40104", // Timer identifier
expect: {commandQualifier: MozIccManager.STK_TIMER_DEACTIVATE,
timerAction: MozIccManager.STK_TIMER_DEACTIVATE,
timerId: 0x04}},
// Get current value
{command: "d00c810301270282028182a40108",
expect: {commandNumber: 0x01,
commandQualifier: MozIccManager.STK_TIMER_GET_CURRENT_VALUE,
{command: "D00C" + // Length
"8103012702" + // Command details
"82028182" + // Device identities
"A40108", // Timer identifier
expect: {commandQualifier: MozIccManager.STK_TIMER_GET_CURRENT_VALUE,
timerAction: MozIccManager.STK_TIMER_GET_CURRENT_VALUE,
timerId: 0x08}},
];
function testTimerManagement(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_TIMER_MANAGEMENT,
"typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.timerAction, aExpect.timerAction, "options.timerAction");
is(aCommand.options.timerId, aExpect.timerId, "options.timerId");
if (aExpect.timerValue) {
if ("timerValue" in aExpect) {
is(aCommand.options.timerValue, aExpect.timerValue, "options.timerValue");
}
}