dom/icc/tests/marionette/test_stk_setup_menu.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/icc/tests/marionette/test_stk_setup_menu.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,244 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +MARIONETTE_HEAD_JS = "stk_helper.js";
     1.8 +
     1.9 +function testSetupMenu(command, expect) {
    1.10 +  log("STK CMD " + JSON.stringify(command));
    1.11 +  is(command.typeOfCommand, iccManager.STK_CMD_SET_UP_MENU, expect.name);
    1.12 +  is(command.commandQualifier, expect.commandQualifier, expect.name);
    1.13 +  is(command.options.title, expect.title, expect.name);
    1.14 +  for (let index in command.options.items) {
    1.15 +    is(command.options.items[index].identifier, expect.items[index].identifier, expect.name);
    1.16 +    is(command.options.items[index].text, expect.items[index].text, expect.name);
    1.17 +  }
    1.18 +  let length = command.options.nextActionList ? command.options.nextActionList.length : 0;
    1.19 +  for (let i = 0; i < length; i++) {
    1.20 +    is(command.options.nextActionList[i], expect.nextActionList[i], expect.name);
    1.21 +  }
    1.22 +
    1.23 +  runNextTest();
    1.24 +}
    1.25 +
    1.26 +function isFirstMenuItemNull(command) {
    1.27 +  return (command.options.items.length == 1 && !(command.options.items[0]));
    1.28 +}
    1.29 +
    1.30 +function testInitialSetupMenu(command) {
    1.31 +  log("STK CMD " + JSON.stringify(command));
    1.32 +  is(command.typeOfCommand, iccManager.STK_CMD_SET_UP_MENU);
    1.33 +  is(isFirstMenuItemNull(command), false);
    1.34 +
    1.35 +  runNextTest();
    1.36 +}
    1.37 +function testRemoveSetupMenu(command) {
    1.38 +  log("STK CMD " + JSON.stringify(command));
    1.39 +  is(command.typeOfCommand, iccManager.STK_CMD_SET_UP_MENU);
    1.40 +  is(isFirstMenuItemNull(command), true);
    1.41 +
    1.42 +  runNextTest();
    1.43 +}
    1.44 +
    1.45 +let tests = [
    1.46 +  {command: "d03b810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034",
    1.47 +   func: testSetupMenu,
    1.48 +   expect: {name: "setup_menu_cmd_1",
    1.49 +            commandQualifier: 0x00,
    1.50 +            title: "Toolkit Menu",
    1.51 +            items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}]}},
    1.52 +  {command: "d023810301250082028182850c546f6f6c6b6974204d656e758f04114f6e658f041254776f",
    1.53 +   func: testSetupMenu,
    1.54 +   expect: {name: "setup_menu_cmd_2",
    1.55 +            commandQualifier: 0x00,
    1.56 +            title: "Toolkit Menu",
    1.57 +            items: [{identifier: 17, text: "One"}, {identifier: 18, text: "Two"}]}},
    1.58 +  {command: "d081fc810301250082028182850a4c617267654d656e75318f05505a65726f8f044f4f6e658f044e54776f8f064d54687265658f054c466f75728f054b466976658f044a5369788f0649536576656e8f064845696768748f05474e696e658f0646416c7068618f0645427261766f8f0844436861726c69658f064344656c74618f05424563686f8f0941466f782d74726f748f0640426c61636b8f063f42726f776e8f043e5265648f073d4f72616e67658f073c59656c6c6f778f063b477265656e8f053a426c75658f073956696f6c65748f0538477265798f063757686974658f06366d696c6c698f06356d6963726f8f05346e616e6f8f05337069636f",
    1.59 +   func: testSetupMenu,
    1.60 +   expect: {name: "setup_menu_cmd_3",
    1.61 +            commandQualifier: 0x00,
    1.62 +            title: "LargeMenu1",
    1.63 +            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"}]}},
    1.64 +  {command: "d081f3810301250082028182850a4c617267654d656e75328f1dff312043616c6c20466f727761726420556e636f6e646974696f6e616c8f1cfe322043616c6c20466f7277617264204f6e205573657220427573798f1bfd332043616c6c20466f7277617264204f6e204e6f205265706c798f25fc342043616c6c20466f7277617264204f6e2055736572204e6f7420526561636861626c658f20fb352042617272696e67204f6620416c6c204f7574676f696e672043616c6c738f24fa362042617272696e67204f6620416c6c204f7574676f696e6720496e742043616c6c738f13f93720434c492050726573656e746174696f6e",
    1.65 +   func: testSetupMenu,
    1.66 +   expect: {name: "setup_menu_cmd_4",
    1.67 +            commandQualifier: 0x00,
    1.68 +            title: "LargeMenu2",
    1.69 +            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"}]}},
    1.70 +  {command: "d081fc8103012500820281828581ec5468652053494d207368616c6c20737570706c79206120736574206f66206d656e75206974656d732c207768696368207368616c6c20626520696e7465677261746564207769746820746865206d656e752073797374656d20286f72206f74686572204d4d4920666163696c6974792920696e206f7264657220746f206769766520746865207573657220746865206f70706f7274756e69747920746f2063686f6f7365206f6e65206f66207468657365206d656e75206974656d7320617420686973206f776e2064697363726574696f6e2e2045616368206974656d20636f6d70726973657320612073688f020159",
    1.71 +   func: testSetupMenu,
    1.72 +   expect: {name: "setup_menu_cmd_5",
    1.73 +            commandQualifier: 0x00,
    1.74 +            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",
    1.75 +            items: [{identifier: 1, text: "Y"}]}},
    1.76 +  {command: "d03b810301258082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034",
    1.77 +   func: testSetupMenu,
    1.78 +   expect: {name: "setup_menu_cmd_6",
    1.79 +            commandQualifier: 0x80,
    1.80 +            title: "Toolkit Menu",
    1.81 +            items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}]}},
    1.82 +  {command: "d041810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034180413101526",
    1.83 +   func: testSetupMenu,
    1.84 +   expect: {name: "setup_menu_cmd_7",
    1.85 +            commandQualifier: 0x00,
    1.86 +            title: "Toolkit Menu",
    1.87 +            items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}],
    1.88 +            nextActionList: [iccManager.STK_CMD_SEND_SMS, iccManager.STK_CMD_SET_UP_CALL, iccManager.STK_CMD_LAUNCH_BROWSER, iccManager.STK_CMD_PROVIDE_LOCAL_INFO]}},
    1.89 +  {command: "d03c810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20339e0201019f0401050505",
    1.90 +   func: testSetupMenu,
    1.91 +   expect: {name: "setup_menu_cmd_8",
    1.92 +            commandQualifier: 0x00,
    1.93 +            title: "Toolkit Menu",
    1.94 +            items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
    1.95 +  {command: "d03c810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20339e0200019f0400050505",
    1.96 +   func: testSetupMenu,
    1.97 +   expect: {name: "setup_menu_cmd_9",
    1.98 +            commandQualifier: 0x00,
    1.99 +            title: "Toolkit Menu",
   1.100 +            items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
   1.101 +  {command: "d029810301250182028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d2032",
   1.102 +   func: testSetupMenu,
   1.103 +   expect: {name: "setup_menu_cmd_10",
   1.104 +            commandQualifier: 0x01,
   1.105 +            title: "Toolkit Menu",
   1.106 +            items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
   1.107 +  {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e00b4d10c000600b4000600b4000600b4",
   1.108 +   func: testSetupMenu,
   1.109 +   expect: {name: "setup_menu_cmd_11",
   1.110 +            commandQualifier: 0x00,
   1.111 +            title: "Toolkit Menu 1",
   1.112 +            items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
   1.113 +  {command: "d034810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036",
   1.114 +   func: testSetupMenu,
   1.115 +   expect: {name: "setup_menu_cmd_12",
   1.116 +            commandQualifier: 0x00,
   1.117 +            title: "Toolkit Menu 2",
   1.118 +            items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
   1.119 +  {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e01b4d10c000601b4000601b4000601b4",
   1.120 +   func: testSetupMenu,
   1.121 +   expect: {name: "setup_menu_cmd_13",
   1.122 +            commandQualifier: 0x00,
   1.123 +            title: "Toolkit Menu 1",
   1.124 +            items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
   1.125 +  {command: "d034810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036",
   1.126 +   func: testSetupMenu,
   1.127 +   expect: {name: "setup_menu_cmd_14",
   1.128 +            commandQualifier: 0x00,
   1.129 +            title: "Toolkit Menu 2",
   1.130 +            items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
   1.131 +  {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e02b4d10c000602b4000602b4000602b4",
   1.132 +   func: testSetupMenu,
   1.133 +   expect: {name: "setup_menu_cmd_15",
   1.134 +            commandQualifier: 0x00,
   1.135 +            title: "Toolkit Menu 1",
   1.136 +            items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
   1.137 +  {command: "d034810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036",
   1.138 +   func: testSetupMenu,
   1.139 +   expect: {name: "setup_menu_cmd_16",
   1.140 +            commandQualifier: 0x00,
   1.141 +            title: "Toolkit Menu 2",
   1.142 +            items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
   1.143 +  {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e04b4d10c000604b4000604b4000604b4",
   1.144 +   func: testSetupMenu,
   1.145 +   expect: {name: "setup_menu_cmd_17",
   1.146 +            commandQualifier: 0x00,
   1.147 +            title: "Toolkit Menu 1",
   1.148 +            items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
   1.149 +  {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036d004000e00b4d10c000600b4000600b4000600b4",
   1.150 +   func: testSetupMenu,
   1.151 +   expect: {name: "setup_menu_cmd_18",
   1.152 +            commandQualifier: 0x00,
   1.153 +            title: "Toolkit Menu 2",
   1.154 +            items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
   1.155 +  {command: "d034810301250082028182850e546f6f6c6b6974204d656e7520338f07074974656d20378f07084974656d20388f07094974656d2039",
   1.156 +   func: testSetupMenu,
   1.157 +   expect: {name: "setup_menu_cmd_19",
   1.158 +            commandQualifier: 0x00,
   1.159 +            title: "Toolkit Menu 3",
   1.160 +            items: [{identifier: 7, text: "Item 7"}, {identifier: 8, text: "Item 8"}, {identifier: 9, text: "Item 9"}]}},
   1.161 +  {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e08b4d10c000608b4000608b4000608b4",
   1.162 +   func: testSetupMenu,
   1.163 +   expect: {name: "setup_menu_cmd_20",
   1.164 +            commandQualifier: 0x00,
   1.165 +            title: "Toolkit Menu 1",
   1.166 +            items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
   1.167 +  {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e10b4d10c000610b4000610b4000610b4",
   1.168 +   func: testSetupMenu,
   1.169 +   expect: {name: "setup_menu_cmd_21",
   1.170 +            commandQualifier: 0x00,
   1.171 +            title: "Toolkit Menu 1",
   1.172 +            items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
   1.173 +  {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e20b4d10c000620b4000620b4000620b4",
   1.174 +   func: testSetupMenu,
   1.175 +   expect: {name: "setup_menu_cmd_22",
   1.176 +            commandQualifier: 0x00,
   1.177 +            title: "Toolkit Menu 1",
   1.178 +            items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
   1.179 +  {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e40b4d10c000640b4000640b4000640b4",
   1.180 +   func: testSetupMenu,
   1.181 +   expect: {name: "setup_menu_cmd_23",
   1.182 +            commandQualifier: 0x00,
   1.183 +            title: "Toolkit Menu 1",
   1.184 +            items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
   1.185 +  {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e80b4d10c000680b4000680b4000680b4",
   1.186 +   func: testSetupMenu,
   1.187 +   expect: {name: "setup_menu_cmd_24",
   1.188 +            commandQualifier: 0x00,
   1.189 +            title: "Toolkit Menu 1",
   1.190 +            items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
   1.191 +  {command: "d046810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d2033d004000c00b4d10c000600b4000600b4000600b4",
   1.192 +   func: testSetupMenu,
   1.193 +   expect: {name: "setup_menu_cmd_25",
   1.194 +            commandQualifier: 0x00,
   1.195 +            title: "Toolkit Menu",
   1.196 +            items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
   1.197 +  {command: "d0819c8103012500820281828519800417041404200410041204210422041204230419042204158f1c018004170414042004100412042104220412042304190422041500318f1c028004170414042004100412042104220412042304190422041500328f1c038004170414042004100412042104220412042304190422041500338f1c04800417041404200410041204210422041204230419042204150034",
   1.198 +   func: testSetupMenu,
   1.199 +   expect: {name: "setup_menu_cmd_26",
   1.200 +            commandQualifier: 0x00,
   1.201 +            title: "ЗДРАВСТВУЙТЕ",
   1.202 +            items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"}, {identifier: 2, text: "ЗДРАВСТВУЙТЕ2"}, {identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}, {identifier: 4, text: "ЗДРАВСТВУЙТЕ4"}]}},
   1.203 +  {command: "d0608103012500820281828519800417041404200410041204210422041204230419042204158f1c118004170414042004100412042104220412042304190422041500358f1c12800417041404200410041204210422041204230419042204150036",
   1.204 +   func: testSetupMenu,
   1.205 +   expect: {name: "setup_menu_cmd_27",
   1.206 +            commandQualifier: 0x00,
   1.207 +            title: "ЗДРАВСТВУЙТЕ",
   1.208 +            items: [{identifier: 17, text: "ЗДРАВСТВУЙТЕ5"}, {identifier: 18, text: "ЗДРАВСТВУЙТЕ6"}]}},
   1.209 +  {command: "d03c8103012500820281828509805de551777bb153558f080180987976ee4e008f080280987976ee4e8c8f080380987976ee4e098f080480987976ee56db",
   1.210 +   func: testSetupMenu,
   1.211 +   expect: {name: "setup_menu_cmd_28",
   1.212 +            commandQualifier: 0x00,
   1.213 +            title: "工具箱单",
   1.214 +            items: [{identifier: 1, text: "项目一"}, {identifier: 2, text: "项目二"}, {identifier: 3, text: "项目三"}, {identifier: 4, text: "项目四"}]}},
   1.215 +  {command: "d0208103012500820281828509805de551777bb153558f0411804e008f0412804e8c",
   1.216 +   func: testSetupMenu,
   1.217 +   expect: {name: "setup_menu_cmd_29",
   1.218 +            commandQualifier: 0x00,
   1.219 +            title: "工具箱单",
   1.220 +            items: [{identifier: 17, text: "一"}, {identifier: 18, text: "二"}]}},
   1.221 +  {command: "d0448103012500820281828509800038003030eb00308f0a01800038003030eb00318f0a02800038003030eb00328f0a03800038003030eb00338f0a04800038003030eb0034",
   1.222 +   func: testSetupMenu,
   1.223 +   expect: {name: "setup_menu_cmd_30",
   1.224 +            commandQualifier: 0x00,
   1.225 +            title: "80ル0",
   1.226 +            items: [{identifier: 1, text: "80ル1"}, {identifier: 2, text: "80ル2"}, {identifier: 3, text: "80ル3"}, {identifier: 4, text: "80ル4"}]}},
   1.227 +  {command: "d02c8103012500820281828509800038003030eb00308f0a11800038003030eb00358f0a12800038003030eb0036",
   1.228 +   func: testSetupMenu,
   1.229 +   expect: {name: "setup_menu_cmd_31",
   1.230 +            commandQualifier: 0x00,
   1.231 +            title: "80ル0",
   1.232 +            items: [{identifier: 17, text: "80ル5"}, {identifier: 18, text: "80ル6"}]}},
   1.233 +  {command: "d041810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034180481000000",
   1.234 +   func: testSetupMenu,
   1.235 +   expect: {name: "setup_menu_cmd_32",
   1.236 +            commandQualifier: 0x00,
   1.237 +            title: "Toolkit Menu",
   1.238 +            items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}],
   1.239 +            nextActionList: [iccManager.STK_NEXT_ACTION_END_PROACTIVE_SESSION, iccManager.STK_NEXT_ACTION_NULL, iccManager.STK_NEXT_ACTION_NULL, iccManager.STK_NEXT_ACTION_NULL]}},
   1.240 +  {command: "D00D81030125008202818285008F00",
   1.241 +   func: testRemoveSetupMenu},
   1.242 +  {command:"D03B810301250082028182850C546F6F6C6B6974204D656E758F07014974656D20318F07024974656D20328F07034974656D20338F07044974656D2034",
   1.243 +   func: testInitialSetupMenu},
   1.244 +
   1.245 +];
   1.246 +
   1.247 +runNextTest();

mercurial