dom/icc/tests/marionette/test_stk_get_input.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:79815cf4f3eb
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 MARIONETTE_HEAD_JS = "stk_helper.js";
5
6 function testGetInput(command, expect) {
7 log("STK CMD " + JSON.stringify(command));
8 is(command.typeOfCommand, iccManager.STK_CMD_GET_INPUT, expect.name);
9 is(command.commandQualifier, expect.commandQualifier, expect.name);
10 is(command.options.text, expect.text, expect.name);
11 is(command.options.minLength, expect.minLength, expect.name);
12 is(command.options.maxLength, expect.maxLength, expect.name);
13 if (command.options.defaultText) {
14 is(command.options.defaultText, expect.defaultText, expect.name);
15 }
16 if (command.options.isAlphabet) {
17 is(command.options.isAlphabet, expect.isAlphabet, expect.name);
18 }
19 if (command.options.isUCS2) {
20 is(command.options.isUCS2, expect.isUCS2, expect.name);
21 }
22 if (command.options.isPacked) {
23 is(command.options.isPacked, expect.isPacked, expect.name);
24 }
25 if (command.options.hideInput) {
26 is(command.options.hideInput, expect.hideInput, expect.name);
27 }
28
29 runNextTest();
30 }
31
32 let tests = [
33 {command: "d01b8103012300820281828d0c04456e74657220313233343591020505",
34 func: testGetInput,
35 expect: {name: "get_input_cmd_1",
36 commandQualifier: 0x00,
37 text: "Enter 12345",
38 minLength: 5,
39 maxLength: 5}},
40 {command: "d01a8103012308820281828d0b004537bd2c07d96eaad10a91020505",
41 func: testGetInput,
42 expect: {name: "get_input_cmd_2",
43 commandQualifier: 0x08,
44 text: "Enter 67*#+",
45 minLength: 5,
46 maxLength: 5,
47 isPacked: true}},
48 {command: "d01b8103012301820281828d0c04456e74657220416243644591020505",
49 func: testGetInput,
50 expect: {name: "get_input_cmd_3",
51 commandQualifier: 0x01,
52 text: "Enter AbCdE",
53 minLength: 5,
54 maxLength: 5,
55 isAlphabet: true}},
56 {command: "d0278103012304820281828d180450617373776f726420313c53454e443e3233343536373891020408",
57 func: testGetInput,
58 expect: {name: "get_input_cmd_4",
59 commandQualifier: 0x04,
60 text: "Password 1<SEND>2345678",
61 minLength: 4,
62 maxLength: 8,
63 hideInput: true}},
64 {command: "d0248103012300820281828d1504456e74657220312e2e392c302e2e392c3028312991020114",
65 func: testGetInput,
66 expect: {name: "get_input_cmd_5",
67 commandQualifier: 0x00,
68 text: "Enter 1..9,0..9,0(1)",
69 minLength: 1,
70 maxLength: 20}},
71 {command: "d01e8103012300820281828d0f043c474f2d4241434b57415244533e91020008",
72 func: testGetInput,
73 expect: {name: "get_input_cmd_6",
74 commandQualifier: 0x00,
75 text: "<GO-BACKWARDS>",
76 minLength: 0,
77 maxLength: 8}},
78 {command: "d0178103012300820281828d08043c41424f52543e91020008",
79 func: testGetInput,
80 expect: {name: "get_input_cmd_7",
81 commandQualifier: 0x00,
82 text: "<ABORT>",
83 minLength: 0,
84 maxLength: 8}},
85 {command: "d081b18103012300820281828d81a1042a2a2a313131313131313131312323232a2a2a323232323232323232322323232a2a2a333333333333333333332323232a2a2a343434343434343434342323232a2a2a353535353535353535352323232a2a2a363636363636363636362323232a2a2a373737373737373737372323232a2a2a383838383838383838382323232a2a2a393939393939393939392323232a2a2a303030303030303030302323239102a0a0",
86 func: testGetInput,
87 expect: {name: "get_input_cmd_8",
88 commandQualifier: 0x00,
89 text: "***1111111111###***2222222222###***3333333333###***4444444444###***5555555555###***6666666666###***7777777777###***8888888888###***9999999999###***0000000000###",
90 minLength: 160,
91 maxLength: 160}},
92 {command: "d0168103012300820281828d07043c53454e443e91020001",
93 func: testGetInput,
94 expect: {name: "get_input_cmd_9",
95 commandQualifier: 0x00,
96 text: "<SEND>",
97 minLength: 0,
98 maxLength: 1}},
99 {command: "d01a8103012300820281828d0b043c54494d452d4f55543e9102000a",
100 func: testGetInput,
101 expect: {name: "get_input_cmd_10",
102 commandQualifier: 0x00,
103 text: "<TIME-OUT>",
104 minLength: 0,
105 maxLength: 10}},
106 {command: "d0288103012301820281828d190804170414042004100412042104220412042304190422041591020505",
107 func: testGetInput,
108 expect: {name: "get_input_cmd_11",
109 commandQualifier: 0x01,
110 text: "ЗДРАВСТВУЙТЕ",
111 minLength: 5,
112 maxLength: 5,
113 isAlphabet: true}},
114 {command: "d0819d8103012301820281828d818d08041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041991020505",
115 func: testGetInput,
116 expect: {name: "get_input_cmd_12",
117 commandQualifier: 0x01,
118 text: "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙ",
119 minLength: 5,
120 maxLength: 5,
121 isAlphabet: true}},
122 {command: "d01b8103012303820281828d0c04456e7465722048656c6c6f91020c0c",
123 func: testGetInput,
124 expect: {name: "get_input_cmd_13",
125 commandQualifier: 0x03,
126 text: "Enter Hello",
127 minLength: 12,
128 maxLength: 12,
129 isAlphabet: true,
130 isUCS2: true}},
131 {command: "d01b8103012303820281828d0c04456e7465722048656c6c6f910205ff",
132 func: testGetInput,
133 expect: {name: "get_input_cmd_14",
134 commandQualifier: 0x03,
135 text: "Enter Hello",
136 minLength: 5,
137 maxLength: 0xFF,
138 isAlphabet: true,
139 isUCS2: true}},
140 {command: "d0238103012300820281828d0c04456e746572203132333435910205051706043132333435",
141 func: testGetInput,
142 expect: {name: "get_input_cmd_15",
143 commandQualifier: 0x00,
144 text: "Enter 12345",
145 minLength: 5,
146 maxLength: 5,
147 defaultText: "12345"}},
148 {command: "d081ba8103012300820281828d0704456e7465723a9102a0a01781a1042a2a2a313131313131313131312323232a2a2a323232323232323232322323232a2a2a333333333333333333332323232a2a2a343434343434343434342323232a2a2a353535353535353535352323232a2a2a363636363636363636362323232a2a2a373737373737373737372323232a2a2a383838383838383838382323232a2a2a393939393939393939392323232a2a2a30303030303030303030232323",
149 func: testGetInput,
150 expect: {name: "get_input_cmd_16",
151 commandQualifier: 0x00,
152 text: "Enter:",
153 minLength: 160,
154 maxLength: 160,
155 defaultText: "***1111111111###***2222222222###***3333333333###***4444444444###***5555555555###***6666666666###***7777777777###***8888888888###***9999999999###***0000000000###"}},
156 {command: "d01d8103012300820281828d0a043c4e4f2d49434f4e3e9102000a1e020001",
157 func: testGetInput,
158 expect: {name: "get_input_cmd_17",
159 commandQualifier: 0x00,
160 text: "<NO-ICON>",
161 minLength: 0,
162 maxLength: 10}},
163 {command: "d0208103012300820281828d0d043c42415349432d49434f4e3e9102000a1e020101",
164 func: testGetInput,
165 expect: {name: "get_input_cmd_18",
166 commandQualifier: 0x00,
167 text: "<BASIC-ICON>",
168 minLength: 0,
169 maxLength: 10}},
170 ];
171
172 runNextTest();

mercurial