Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 testLocalInfoLocation(cmd) { |
michael@0 | 7 | log("STK CMD " + JSON.stringify(cmd)); |
michael@0 | 8 | is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO); |
michael@0 | 9 | is(cmd.commandNumber, 0x01); |
michael@0 | 10 | is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_LOCATION_INFO); |
michael@0 | 11 | is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_LOCATION_INFO); |
michael@0 | 12 | |
michael@0 | 13 | runNextTest(); |
michael@0 | 14 | } |
michael@0 | 15 | |
michael@0 | 16 | function testLocalInfoImei(cmd) { |
michael@0 | 17 | log("STK CMD " + JSON.stringify(cmd)); |
michael@0 | 18 | is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO); |
michael@0 | 19 | is(cmd.commandNumber, 0x01); |
michael@0 | 20 | is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_IMEI); |
michael@0 | 21 | is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_IMEI); |
michael@0 | 22 | |
michael@0 | 23 | runNextTest(); |
michael@0 | 24 | } |
michael@0 | 25 | |
michael@0 | 26 | function testLocalInfoDate(cmd) { |
michael@0 | 27 | log("STK CMD " + JSON.stringify(cmd)); |
michael@0 | 28 | is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO); |
michael@0 | 29 | is(cmd.commandNumber, 0x01); |
michael@0 | 30 | is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_DATE_TIME_ZONE); |
michael@0 | 31 | is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_DATE_TIME_ZONE); |
michael@0 | 32 | |
michael@0 | 33 | runNextTest(); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | function testLocalInfoLanguage(cmd) { |
michael@0 | 37 | log("STK CMD " + JSON.stringify(cmd)); |
michael@0 | 38 | is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO); |
michael@0 | 39 | is(cmd.commandNumber, 0x01); |
michael@0 | 40 | is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_LANGUAGE); |
michael@0 | 41 | is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_LANGUAGE); |
michael@0 | 42 | |
michael@0 | 43 | runNextTest(); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | function testRefresh(cmd) { |
michael@0 | 47 | log("STK CMD " + JSON.stringify(cmd)); |
michael@0 | 48 | is(cmd.typeOfCommand, iccManager.STK_CMD_REFRESH); |
michael@0 | 49 | is(cmd.commandNumber, 0x01); |
michael@0 | 50 | is(cmd.commandQualifier, 0x01); |
michael@0 | 51 | is(cmd.options, null); |
michael@0 | 52 | |
michael@0 | 53 | runNextTest(); |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | function testTimerManagementStart(cmd) { |
michael@0 | 57 | log("STK CMD " + JSON.stringify(cmd)); |
michael@0 | 58 | is(cmd.typeOfCommand, iccManager.STK_CMD_TIMER_MANAGEMENT); |
michael@0 | 59 | is(cmd.commandNumber, 0x01); |
michael@0 | 60 | is(cmd.commandQualifier, iccManager.STK_TIMER_START); |
michael@0 | 61 | is(cmd.options.timerAction, iccManager.STK_TIMER_START); |
michael@0 | 62 | is(cmd.options.timerId, 0x01); |
michael@0 | 63 | is(cmd.options.timerValue, (0x01 * 60 * 60) + (0x02 * 60) + 0x03); |
michael@0 | 64 | |
michael@0 | 65 | runNextTest(); |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | function testTimerManagementDeactivate(cmd) { |
michael@0 | 69 | log("STK CMD " + JSON.stringify(cmd)); |
michael@0 | 70 | is(cmd.typeOfCommand, iccManager.STK_CMD_TIMER_MANAGEMENT); |
michael@0 | 71 | is(cmd.commandNumber, 0x01); |
michael@0 | 72 | is(cmd.commandQualifier, iccManager.STK_TIMER_DEACTIVATE); |
michael@0 | 73 | is(cmd.options.timerAction, iccManager.STK_TIMER_DEACTIVATE); |
michael@0 | 74 | is(cmd.options.timerId, 0x04); |
michael@0 | 75 | |
michael@0 | 76 | runNextTest(); |
michael@0 | 77 | } |
michael@0 | 78 | |
michael@0 | 79 | function testTimerManagementGetCurrentValue(cmd) { |
michael@0 | 80 | log("STK CMD " + JSON.stringify(cmd)); |
michael@0 | 81 | is(cmd.typeOfCommand, iccManager.STK_CMD_TIMER_MANAGEMENT); |
michael@0 | 82 | is(cmd.commandNumber, 0x01); |
michael@0 | 83 | is(cmd.commandQualifier, iccManager.STK_TIMER_GET_CURRENT_VALUE); |
michael@0 | 84 | is(cmd.options.timerAction, iccManager.STK_TIMER_GET_CURRENT_VALUE); |
michael@0 | 85 | is(cmd.options.timerId, 0x08); |
michael@0 | 86 | |
michael@0 | 87 | runNextTest(); |
michael@0 | 88 | } |
michael@0 | 89 | |
michael@0 | 90 | let tests = [ |
michael@0 | 91 | {command: "d009810301260082028182", |
michael@0 | 92 | func: testLocalInfoLocation}, |
michael@0 | 93 | {command: "d009810301260182028182", |
michael@0 | 94 | func: testLocalInfoImei}, |
michael@0 | 95 | {command: "d009810301260382028182", |
michael@0 | 96 | func: testLocalInfoDate}, |
michael@0 | 97 | {command: "d009810301260482028182", |
michael@0 | 98 | func: testLocalInfoLanguage}, |
michael@0 | 99 | {command: "d011810301270082028182a40101a503102030", |
michael@0 | 100 | func: testTimerManagementStart}, |
michael@0 | 101 | {command: "d00c810301270182028182a40104", |
michael@0 | 102 | func: testTimerManagementDeactivate}, |
michael@0 | 103 | {command: "d00c810301270282028182a40108", |
michael@0 | 104 | func: testTimerManagementGetCurrentValue}, |
michael@0 | 105 | ]; |
michael@0 | 106 | |
michael@0 | 107 | runNextTest(); |