1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/icc/tests/marionette/test_stk_get_input.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,172 @@ 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 testGetInput(command, expect) { 1.10 + log("STK CMD " + JSON.stringify(command)); 1.11 + is(command.typeOfCommand, iccManager.STK_CMD_GET_INPUT, expect.name); 1.12 + is(command.commandQualifier, expect.commandQualifier, expect.name); 1.13 + is(command.options.text, expect.text, expect.name); 1.14 + is(command.options.minLength, expect.minLength, expect.name); 1.15 + is(command.options.maxLength, expect.maxLength, expect.name); 1.16 + if (command.options.defaultText) { 1.17 + is(command.options.defaultText, expect.defaultText, expect.name); 1.18 + } 1.19 + if (command.options.isAlphabet) { 1.20 + is(command.options.isAlphabet, expect.isAlphabet, expect.name); 1.21 + } 1.22 + if (command.options.isUCS2) { 1.23 + is(command.options.isUCS2, expect.isUCS2, expect.name); 1.24 + } 1.25 + if (command.options.isPacked) { 1.26 + is(command.options.isPacked, expect.isPacked, expect.name); 1.27 + } 1.28 + if (command.options.hideInput) { 1.29 + is(command.options.hideInput, expect.hideInput, expect.name); 1.30 + } 1.31 + 1.32 + runNextTest(); 1.33 +} 1.34 + 1.35 +let tests = [ 1.36 + {command: "d01b8103012300820281828d0c04456e74657220313233343591020505", 1.37 + func: testGetInput, 1.38 + expect: {name: "get_input_cmd_1", 1.39 + commandQualifier: 0x00, 1.40 + text: "Enter 12345", 1.41 + minLength: 5, 1.42 + maxLength: 5}}, 1.43 + {command: "d01a8103012308820281828d0b004537bd2c07d96eaad10a91020505", 1.44 + func: testGetInput, 1.45 + expect: {name: "get_input_cmd_2", 1.46 + commandQualifier: 0x08, 1.47 + text: "Enter 67*#+", 1.48 + minLength: 5, 1.49 + maxLength: 5, 1.50 + isPacked: true}}, 1.51 + {command: "d01b8103012301820281828d0c04456e74657220416243644591020505", 1.52 + func: testGetInput, 1.53 + expect: {name: "get_input_cmd_3", 1.54 + commandQualifier: 0x01, 1.55 + text: "Enter AbCdE", 1.56 + minLength: 5, 1.57 + maxLength: 5, 1.58 + isAlphabet: true}}, 1.59 + {command: "d0278103012304820281828d180450617373776f726420313c53454e443e3233343536373891020408", 1.60 + func: testGetInput, 1.61 + expect: {name: "get_input_cmd_4", 1.62 + commandQualifier: 0x04, 1.63 + text: "Password 1<SEND>2345678", 1.64 + minLength: 4, 1.65 + maxLength: 8, 1.66 + hideInput: true}}, 1.67 + {command: "d0248103012300820281828d1504456e74657220312e2e392c302e2e392c3028312991020114", 1.68 + func: testGetInput, 1.69 + expect: {name: "get_input_cmd_5", 1.70 + commandQualifier: 0x00, 1.71 + text: "Enter 1..9,0..9,0(1)", 1.72 + minLength: 1, 1.73 + maxLength: 20}}, 1.74 + {command: "d01e8103012300820281828d0f043c474f2d4241434b57415244533e91020008", 1.75 + func: testGetInput, 1.76 + expect: {name: "get_input_cmd_6", 1.77 + commandQualifier: 0x00, 1.78 + text: "<GO-BACKWARDS>", 1.79 + minLength: 0, 1.80 + maxLength: 8}}, 1.81 + {command: "d0178103012300820281828d08043c41424f52543e91020008", 1.82 + func: testGetInput, 1.83 + expect: {name: "get_input_cmd_7", 1.84 + commandQualifier: 0x00, 1.85 + text: "<ABORT>", 1.86 + minLength: 0, 1.87 + maxLength: 8}}, 1.88 + {command: "d081b18103012300820281828d81a1042a2a2a313131313131313131312323232a2a2a323232323232323232322323232a2a2a333333333333333333332323232a2a2a343434343434343434342323232a2a2a353535353535353535352323232a2a2a363636363636363636362323232a2a2a373737373737373737372323232a2a2a383838383838383838382323232a2a2a393939393939393939392323232a2a2a303030303030303030302323239102a0a0", 1.89 + func: testGetInput, 1.90 + expect: {name: "get_input_cmd_8", 1.91 + commandQualifier: 0x00, 1.92 + text: "***1111111111###***2222222222###***3333333333###***4444444444###***5555555555###***6666666666###***7777777777###***8888888888###***9999999999###***0000000000###", 1.93 + minLength: 160, 1.94 + maxLength: 160}}, 1.95 + {command: "d0168103012300820281828d07043c53454e443e91020001", 1.96 + func: testGetInput, 1.97 + expect: {name: "get_input_cmd_9", 1.98 + commandQualifier: 0x00, 1.99 + text: "<SEND>", 1.100 + minLength: 0, 1.101 + maxLength: 1}}, 1.102 + {command: "d01a8103012300820281828d0b043c54494d452d4f55543e9102000a", 1.103 + func: testGetInput, 1.104 + expect: {name: "get_input_cmd_10", 1.105 + commandQualifier: 0x00, 1.106 + text: "<TIME-OUT>", 1.107 + minLength: 0, 1.108 + maxLength: 10}}, 1.109 + {command: "d0288103012301820281828d190804170414042004100412042104220412042304190422041591020505", 1.110 + func: testGetInput, 1.111 + expect: {name: "get_input_cmd_11", 1.112 + commandQualifier: 0x01, 1.113 + text: "ЗДРАВСТВУЙТЕ", 1.114 + minLength: 5, 1.115 + maxLength: 5, 1.116 + isAlphabet: true}}, 1.117 + {command: "d0819d8103012301820281828d818d08041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041991020505", 1.118 + func: testGetInput, 1.119 + expect: {name: "get_input_cmd_12", 1.120 + commandQualifier: 0x01, 1.121 + text: "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙ", 1.122 + minLength: 5, 1.123 + maxLength: 5, 1.124 + isAlphabet: true}}, 1.125 + {command: "d01b8103012303820281828d0c04456e7465722048656c6c6f91020c0c", 1.126 + func: testGetInput, 1.127 + expect: {name: "get_input_cmd_13", 1.128 + commandQualifier: 0x03, 1.129 + text: "Enter Hello", 1.130 + minLength: 12, 1.131 + maxLength: 12, 1.132 + isAlphabet: true, 1.133 + isUCS2: true}}, 1.134 + {command: "d01b8103012303820281828d0c04456e7465722048656c6c6f910205ff", 1.135 + func: testGetInput, 1.136 + expect: {name: "get_input_cmd_14", 1.137 + commandQualifier: 0x03, 1.138 + text: "Enter Hello", 1.139 + minLength: 5, 1.140 + maxLength: 0xFF, 1.141 + isAlphabet: true, 1.142 + isUCS2: true}}, 1.143 + {command: "d0238103012300820281828d0c04456e746572203132333435910205051706043132333435", 1.144 + func: testGetInput, 1.145 + expect: {name: "get_input_cmd_15", 1.146 + commandQualifier: 0x00, 1.147 + text: "Enter 12345", 1.148 + minLength: 5, 1.149 + maxLength: 5, 1.150 + defaultText: "12345"}}, 1.151 + {command: "d081ba8103012300820281828d0704456e7465723a9102a0a01781a1042a2a2a313131313131313131312323232a2a2a323232323232323232322323232a2a2a333333333333333333332323232a2a2a343434343434343434342323232a2a2a353535353535353535352323232a2a2a363636363636363636362323232a2a2a373737373737373737372323232a2a2a383838383838383838382323232a2a2a393939393939393939392323232a2a2a30303030303030303030232323", 1.152 + func: testGetInput, 1.153 + expect: {name: "get_input_cmd_16", 1.154 + commandQualifier: 0x00, 1.155 + text: "Enter:", 1.156 + minLength: 160, 1.157 + maxLength: 160, 1.158 + defaultText: "***1111111111###***2222222222###***3333333333###***4444444444###***5555555555###***6666666666###***7777777777###***8888888888###***9999999999###***0000000000###"}}, 1.159 + {command: "d01d8103012300820281828d0a043c4e4f2d49434f4e3e9102000a1e020001", 1.160 + func: testGetInput, 1.161 + expect: {name: "get_input_cmd_17", 1.162 + commandQualifier: 0x00, 1.163 + text: "<NO-ICON>", 1.164 + minLength: 0, 1.165 + maxLength: 10}}, 1.166 + {command: "d0208103012300820281828d0d043c42415349432d49434f4e3e9102000a1e020101", 1.167 + func: testGetInput, 1.168 + expect: {name: "get_input_cmd_18", 1.169 + commandQualifier: 0x00, 1.170 + text: "<BASIC-ICON>", 1.171 + minLength: 0, 1.172 + maxLength: 10}}, 1.173 +]; 1.174 + 1.175 +runNextTest();