dom/icc/tests/marionette/test_stk_setup_menu.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 MARIONETTE_HEAD_JS = "stk_helper.js";
michael@0 5
michael@0 6 function testSetupMenu(command, expect) {
michael@0 7 log("STK CMD " + JSON.stringify(command));
michael@0 8 is(command.typeOfCommand, iccManager.STK_CMD_SET_UP_MENU, expect.name);
michael@0 9 is(command.commandQualifier, expect.commandQualifier, expect.name);
michael@0 10 is(command.options.title, expect.title, expect.name);
michael@0 11 for (let index in command.options.items) {
michael@0 12 is(command.options.items[index].identifier, expect.items[index].identifier, expect.name);
michael@0 13 is(command.options.items[index].text, expect.items[index].text, expect.name);
michael@0 14 }
michael@0 15 let length = command.options.nextActionList ? command.options.nextActionList.length : 0;
michael@0 16 for (let i = 0; i < length; i++) {
michael@0 17 is(command.options.nextActionList[i], expect.nextActionList[i], expect.name);
michael@0 18 }
michael@0 19
michael@0 20 runNextTest();
michael@0 21 }
michael@0 22
michael@0 23 function isFirstMenuItemNull(command) {
michael@0 24 return (command.options.items.length == 1 && !(command.options.items[0]));
michael@0 25 }
michael@0 26
michael@0 27 function testInitialSetupMenu(command) {
michael@0 28 log("STK CMD " + JSON.stringify(command));
michael@0 29 is(command.typeOfCommand, iccManager.STK_CMD_SET_UP_MENU);
michael@0 30 is(isFirstMenuItemNull(command), false);
michael@0 31
michael@0 32 runNextTest();
michael@0 33 }
michael@0 34 function testRemoveSetupMenu(command) {
michael@0 35 log("STK CMD " + JSON.stringify(command));
michael@0 36 is(command.typeOfCommand, iccManager.STK_CMD_SET_UP_MENU);
michael@0 37 is(isFirstMenuItemNull(command), true);
michael@0 38
michael@0 39 runNextTest();
michael@0 40 }
michael@0 41
michael@0 42 let tests = [
michael@0 43 {command: "d03b810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034",
michael@0 44 func: testSetupMenu,
michael@0 45 expect: {name: "setup_menu_cmd_1",
michael@0 46 commandQualifier: 0x00,
michael@0 47 title: "Toolkit Menu",
michael@0 48 items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}]}},
michael@0 49 {command: "d023810301250082028182850c546f6f6c6b6974204d656e758f04114f6e658f041254776f",
michael@0 50 func: testSetupMenu,
michael@0 51 expect: {name: "setup_menu_cmd_2",
michael@0 52 commandQualifier: 0x00,
michael@0 53 title: "Toolkit Menu",
michael@0 54 items: [{identifier: 17, text: "One"}, {identifier: 18, text: "Two"}]}},
michael@0 55 {command: "d081fc810301250082028182850a4c617267654d656e75318f05505a65726f8f044f4f6e658f044e54776f8f064d54687265658f054c466f75728f054b466976658f044a5369788f0649536576656e8f064845696768748f05474e696e658f0646416c7068618f0645427261766f8f0844436861726c69658f064344656c74618f05424563686f8f0941466f782d74726f748f0640426c61636b8f063f42726f776e8f043e5265648f073d4f72616e67658f073c59656c6c6f778f063b477265656e8f053a426c75658f073956696f6c65748f0538477265798f063757686974658f06366d696c6c698f06356d6963726f8f05346e616e6f8f05337069636f",
michael@0 56 func: testSetupMenu,
michael@0 57 expect: {name: "setup_menu_cmd_3",
michael@0 58 commandQualifier: 0x00,
michael@0 59 title: "LargeMenu1",
michael@0 60 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"}]}},
michael@0 61 {command: "d081f3810301250082028182850a4c617267654d656e75328f1dff312043616c6c20466f727761726420556e636f6e646974696f6e616c8f1cfe322043616c6c20466f7277617264204f6e205573657220427573798f1bfd332043616c6c20466f7277617264204f6e204e6f205265706c798f25fc342043616c6c20466f7277617264204f6e2055736572204e6f7420526561636861626c658f20fb352042617272696e67204f6620416c6c204f7574676f696e672043616c6c738f24fa362042617272696e67204f6620416c6c204f7574676f696e6720496e742043616c6c738f13f93720434c492050726573656e746174696f6e",
michael@0 62 func: testSetupMenu,
michael@0 63 expect: {name: "setup_menu_cmd_4",
michael@0 64 commandQualifier: 0x00,
michael@0 65 title: "LargeMenu2",
michael@0 66 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"}]}},
michael@0 67 {command: "d081fc8103012500820281828581ec5468652053494d207368616c6c20737570706c79206120736574206f66206d656e75206974656d732c207768696368207368616c6c20626520696e7465677261746564207769746820746865206d656e752073797374656d20286f72206f74686572204d4d4920666163696c6974792920696e206f7264657220746f206769766520746865207573657220746865206f70706f7274756e69747920746f2063686f6f7365206f6e65206f66207468657365206d656e75206974656d7320617420686973206f776e2064697363726574696f6e2e2045616368206974656d20636f6d70726973657320612073688f020159",
michael@0 68 func: testSetupMenu,
michael@0 69 expect: {name: "setup_menu_cmd_5",
michael@0 70 commandQualifier: 0x00,
michael@0 71 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",
michael@0 72 items: [{identifier: 1, text: "Y"}]}},
michael@0 73 {command: "d03b810301258082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034",
michael@0 74 func: testSetupMenu,
michael@0 75 expect: {name: "setup_menu_cmd_6",
michael@0 76 commandQualifier: 0x80,
michael@0 77 title: "Toolkit Menu",
michael@0 78 items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}]}},
michael@0 79 {command: "d041810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034180413101526",
michael@0 80 func: testSetupMenu,
michael@0 81 expect: {name: "setup_menu_cmd_7",
michael@0 82 commandQualifier: 0x00,
michael@0 83 title: "Toolkit Menu",
michael@0 84 items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}],
michael@0 85 nextActionList: [iccManager.STK_CMD_SEND_SMS, iccManager.STK_CMD_SET_UP_CALL, iccManager.STK_CMD_LAUNCH_BROWSER, iccManager.STK_CMD_PROVIDE_LOCAL_INFO]}},
michael@0 86 {command: "d03c810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20339e0201019f0401050505",
michael@0 87 func: testSetupMenu,
michael@0 88 expect: {name: "setup_menu_cmd_8",
michael@0 89 commandQualifier: 0x00,
michael@0 90 title: "Toolkit Menu",
michael@0 91 items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
michael@0 92 {command: "d03c810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20339e0200019f0400050505",
michael@0 93 func: testSetupMenu,
michael@0 94 expect: {name: "setup_menu_cmd_9",
michael@0 95 commandQualifier: 0x00,
michael@0 96 title: "Toolkit Menu",
michael@0 97 items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
michael@0 98 {command: "d029810301250182028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d2032",
michael@0 99 func: testSetupMenu,
michael@0 100 expect: {name: "setup_menu_cmd_10",
michael@0 101 commandQualifier: 0x01,
michael@0 102 title: "Toolkit Menu",
michael@0 103 items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
michael@0 104 {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e00b4d10c000600b4000600b4000600b4",
michael@0 105 func: testSetupMenu,
michael@0 106 expect: {name: "setup_menu_cmd_11",
michael@0 107 commandQualifier: 0x00,
michael@0 108 title: "Toolkit Menu 1",
michael@0 109 items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
michael@0 110 {command: "d034810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036",
michael@0 111 func: testSetupMenu,
michael@0 112 expect: {name: "setup_menu_cmd_12",
michael@0 113 commandQualifier: 0x00,
michael@0 114 title: "Toolkit Menu 2",
michael@0 115 items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
michael@0 116 {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e01b4d10c000601b4000601b4000601b4",
michael@0 117 func: testSetupMenu,
michael@0 118 expect: {name: "setup_menu_cmd_13",
michael@0 119 commandQualifier: 0x00,
michael@0 120 title: "Toolkit Menu 1",
michael@0 121 items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
michael@0 122 {command: "d034810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036",
michael@0 123 func: testSetupMenu,
michael@0 124 expect: {name: "setup_menu_cmd_14",
michael@0 125 commandQualifier: 0x00,
michael@0 126 title: "Toolkit Menu 2",
michael@0 127 items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
michael@0 128 {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e02b4d10c000602b4000602b4000602b4",
michael@0 129 func: testSetupMenu,
michael@0 130 expect: {name: "setup_menu_cmd_15",
michael@0 131 commandQualifier: 0x00,
michael@0 132 title: "Toolkit Menu 1",
michael@0 133 items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
michael@0 134 {command: "d034810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036",
michael@0 135 func: testSetupMenu,
michael@0 136 expect: {name: "setup_menu_cmd_16",
michael@0 137 commandQualifier: 0x00,
michael@0 138 title: "Toolkit Menu 2",
michael@0 139 items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
michael@0 140 {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e04b4d10c000604b4000604b4000604b4",
michael@0 141 func: testSetupMenu,
michael@0 142 expect: {name: "setup_menu_cmd_17",
michael@0 143 commandQualifier: 0x00,
michael@0 144 title: "Toolkit Menu 1",
michael@0 145 items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
michael@0 146 {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036d004000e00b4d10c000600b4000600b4000600b4",
michael@0 147 func: testSetupMenu,
michael@0 148 expect: {name: "setup_menu_cmd_18",
michael@0 149 commandQualifier: 0x00,
michael@0 150 title: "Toolkit Menu 2",
michael@0 151 items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
michael@0 152 {command: "d034810301250082028182850e546f6f6c6b6974204d656e7520338f07074974656d20378f07084974656d20388f07094974656d2039",
michael@0 153 func: testSetupMenu,
michael@0 154 expect: {name: "setup_menu_cmd_19",
michael@0 155 commandQualifier: 0x00,
michael@0 156 title: "Toolkit Menu 3",
michael@0 157 items: [{identifier: 7, text: "Item 7"}, {identifier: 8, text: "Item 8"}, {identifier: 9, text: "Item 9"}]}},
michael@0 158 {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e08b4d10c000608b4000608b4000608b4",
michael@0 159 func: testSetupMenu,
michael@0 160 expect: {name: "setup_menu_cmd_20",
michael@0 161 commandQualifier: 0x00,
michael@0 162 title: "Toolkit Menu 1",
michael@0 163 items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
michael@0 164 {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e10b4d10c000610b4000610b4000610b4",
michael@0 165 func: testSetupMenu,
michael@0 166 expect: {name: "setup_menu_cmd_21",
michael@0 167 commandQualifier: 0x00,
michael@0 168 title: "Toolkit Menu 1",
michael@0 169 items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
michael@0 170 {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e20b4d10c000620b4000620b4000620b4",
michael@0 171 func: testSetupMenu,
michael@0 172 expect: {name: "setup_menu_cmd_22",
michael@0 173 commandQualifier: 0x00,
michael@0 174 title: "Toolkit Menu 1",
michael@0 175 items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
michael@0 176 {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e40b4d10c000640b4000640b4000640b4",
michael@0 177 func: testSetupMenu,
michael@0 178 expect: {name: "setup_menu_cmd_23",
michael@0 179 commandQualifier: 0x00,
michael@0 180 title: "Toolkit Menu 1",
michael@0 181 items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
michael@0 182 {command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e80b4d10c000680b4000680b4000680b4",
michael@0 183 func: testSetupMenu,
michael@0 184 expect: {name: "setup_menu_cmd_24",
michael@0 185 commandQualifier: 0x00,
michael@0 186 title: "Toolkit Menu 1",
michael@0 187 items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
michael@0 188 {command: "d046810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d2033d004000c00b4d10c000600b4000600b4000600b4",
michael@0 189 func: testSetupMenu,
michael@0 190 expect: {name: "setup_menu_cmd_25",
michael@0 191 commandQualifier: 0x00,
michael@0 192 title: "Toolkit Menu",
michael@0 193 items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
michael@0 194 {command: "d0819c8103012500820281828519800417041404200410041204210422041204230419042204158f1c018004170414042004100412042104220412042304190422041500318f1c028004170414042004100412042104220412042304190422041500328f1c038004170414042004100412042104220412042304190422041500338f1c04800417041404200410041204210422041204230419042204150034",
michael@0 195 func: testSetupMenu,
michael@0 196 expect: {name: "setup_menu_cmd_26",
michael@0 197 commandQualifier: 0x00,
michael@0 198 title: "ЗДРАВСТВУЙТЕ",
michael@0 199 items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"}, {identifier: 2, text: "ЗДРАВСТВУЙТЕ2"}, {identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}, {identifier: 4, text: "ЗДРАВСТВУЙТЕ4"}]}},
michael@0 200 {command: "d0608103012500820281828519800417041404200410041204210422041204230419042204158f1c118004170414042004100412042104220412042304190422041500358f1c12800417041404200410041204210422041204230419042204150036",
michael@0 201 func: testSetupMenu,
michael@0 202 expect: {name: "setup_menu_cmd_27",
michael@0 203 commandQualifier: 0x00,
michael@0 204 title: "ЗДРАВСТВУЙТЕ",
michael@0 205 items: [{identifier: 17, text: "ЗДРАВСТВУЙТЕ5"}, {identifier: 18, text: "ЗДРАВСТВУЙТЕ6"}]}},
michael@0 206 {command: "d03c8103012500820281828509805de551777bb153558f080180987976ee4e008f080280987976ee4e8c8f080380987976ee4e098f080480987976ee56db",
michael@0 207 func: testSetupMenu,
michael@0 208 expect: {name: "setup_menu_cmd_28",
michael@0 209 commandQualifier: 0x00,
michael@0 210 title: "工具箱单",
michael@0 211 items: [{identifier: 1, text: "项目一"}, {identifier: 2, text: "项目二"}, {identifier: 3, text: "项目三"}, {identifier: 4, text: "项目四"}]}},
michael@0 212 {command: "d0208103012500820281828509805de551777bb153558f0411804e008f0412804e8c",
michael@0 213 func: testSetupMenu,
michael@0 214 expect: {name: "setup_menu_cmd_29",
michael@0 215 commandQualifier: 0x00,
michael@0 216 title: "工具箱单",
michael@0 217 items: [{identifier: 17, text: "一"}, {identifier: 18, text: "二"}]}},
michael@0 218 {command: "d0448103012500820281828509800038003030eb00308f0a01800038003030eb00318f0a02800038003030eb00328f0a03800038003030eb00338f0a04800038003030eb0034",
michael@0 219 func: testSetupMenu,
michael@0 220 expect: {name: "setup_menu_cmd_30",
michael@0 221 commandQualifier: 0x00,
michael@0 222 title: "80ル0",
michael@0 223 items: [{identifier: 1, text: "80ル1"}, {identifier: 2, text: "80ル2"}, {identifier: 3, text: "80ル3"}, {identifier: 4, text: "80ル4"}]}},
michael@0 224 {command: "d02c8103012500820281828509800038003030eb00308f0a11800038003030eb00358f0a12800038003030eb0036",
michael@0 225 func: testSetupMenu,
michael@0 226 expect: {name: "setup_menu_cmd_31",
michael@0 227 commandQualifier: 0x00,
michael@0 228 title: "80ル0",
michael@0 229 items: [{identifier: 17, text: "80ル5"}, {identifier: 18, text: "80ル6"}]}},
michael@0 230 {command: "d041810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034180481000000",
michael@0 231 func: testSetupMenu,
michael@0 232 expect: {name: "setup_menu_cmd_32",
michael@0 233 commandQualifier: 0x00,
michael@0 234 title: "Toolkit Menu",
michael@0 235 items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}],
michael@0 236 nextActionList: [iccManager.STK_NEXT_ACTION_END_PROACTIVE_SESSION, iccManager.STK_NEXT_ACTION_NULL, iccManager.STK_NEXT_ACTION_NULL, iccManager.STK_NEXT_ACTION_NULL]}},
michael@0 237 {command: "D00D81030125008202818285008F00",
michael@0 238 func: testRemoveSetupMenu},
michael@0 239 {command:"D03B810301250082028182850C546F6F6C6B6974204D656E758F07014974656D20318F07024974656D20328F07034974656D20338F07044974656D2034",
michael@0 240 func: testInitialSetupMenu},
michael@0 241
michael@0 242 ];
michael@0 243
michael@0 244 runNextTest();

mercurial