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

mercurial