1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/icc/tests/marionette/test_stk_proactive_command.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,107 @@ 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 testLocalInfoLocation(cmd) { 1.10 + log("STK CMD " + JSON.stringify(cmd)); 1.11 + is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO); 1.12 + is(cmd.commandNumber, 0x01); 1.13 + is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_LOCATION_INFO); 1.14 + is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_LOCATION_INFO); 1.15 + 1.16 + runNextTest(); 1.17 +} 1.18 + 1.19 +function testLocalInfoImei(cmd) { 1.20 + log("STK CMD " + JSON.stringify(cmd)); 1.21 + is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO); 1.22 + is(cmd.commandNumber, 0x01); 1.23 + is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_IMEI); 1.24 + is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_IMEI); 1.25 + 1.26 + runNextTest(); 1.27 +} 1.28 + 1.29 +function testLocalInfoDate(cmd) { 1.30 + log("STK CMD " + JSON.stringify(cmd)); 1.31 + is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO); 1.32 + is(cmd.commandNumber, 0x01); 1.33 + is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_DATE_TIME_ZONE); 1.34 + is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_DATE_TIME_ZONE); 1.35 + 1.36 + runNextTest(); 1.37 +} 1.38 + 1.39 +function testLocalInfoLanguage(cmd) { 1.40 + log("STK CMD " + JSON.stringify(cmd)); 1.41 + is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO); 1.42 + is(cmd.commandNumber, 0x01); 1.43 + is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_LANGUAGE); 1.44 + is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_LANGUAGE); 1.45 + 1.46 + runNextTest(); 1.47 +} 1.48 + 1.49 +function testRefresh(cmd) { 1.50 + log("STK CMD " + JSON.stringify(cmd)); 1.51 + is(cmd.typeOfCommand, iccManager.STK_CMD_REFRESH); 1.52 + is(cmd.commandNumber, 0x01); 1.53 + is(cmd.commandQualifier, 0x01); 1.54 + is(cmd.options, null); 1.55 + 1.56 + runNextTest(); 1.57 +} 1.58 + 1.59 +function testTimerManagementStart(cmd) { 1.60 + log("STK CMD " + JSON.stringify(cmd)); 1.61 + is(cmd.typeOfCommand, iccManager.STK_CMD_TIMER_MANAGEMENT); 1.62 + is(cmd.commandNumber, 0x01); 1.63 + is(cmd.commandQualifier, iccManager.STK_TIMER_START); 1.64 + is(cmd.options.timerAction, iccManager.STK_TIMER_START); 1.65 + is(cmd.options.timerId, 0x01); 1.66 + is(cmd.options.timerValue, (0x01 * 60 * 60) + (0x02 * 60) + 0x03); 1.67 + 1.68 + runNextTest(); 1.69 +} 1.70 + 1.71 +function testTimerManagementDeactivate(cmd) { 1.72 + log("STK CMD " + JSON.stringify(cmd)); 1.73 + is(cmd.typeOfCommand, iccManager.STK_CMD_TIMER_MANAGEMENT); 1.74 + is(cmd.commandNumber, 0x01); 1.75 + is(cmd.commandQualifier, iccManager.STK_TIMER_DEACTIVATE); 1.76 + is(cmd.options.timerAction, iccManager.STK_TIMER_DEACTIVATE); 1.77 + is(cmd.options.timerId, 0x04); 1.78 + 1.79 + runNextTest(); 1.80 +} 1.81 + 1.82 +function testTimerManagementGetCurrentValue(cmd) { 1.83 + log("STK CMD " + JSON.stringify(cmd)); 1.84 + is(cmd.typeOfCommand, iccManager.STK_CMD_TIMER_MANAGEMENT); 1.85 + is(cmd.commandNumber, 0x01); 1.86 + is(cmd.commandQualifier, iccManager.STK_TIMER_GET_CURRENT_VALUE); 1.87 + is(cmd.options.timerAction, iccManager.STK_TIMER_GET_CURRENT_VALUE); 1.88 + is(cmd.options.timerId, 0x08); 1.89 + 1.90 + runNextTest(); 1.91 +} 1.92 + 1.93 +let tests = [ 1.94 + {command: "d009810301260082028182", 1.95 + func: testLocalInfoLocation}, 1.96 + {command: "d009810301260182028182", 1.97 + func: testLocalInfoImei}, 1.98 + {command: "d009810301260382028182", 1.99 + func: testLocalInfoDate}, 1.100 + {command: "d009810301260482028182", 1.101 + func: testLocalInfoLanguage}, 1.102 + {command: "d011810301270082028182a40101a503102030", 1.103 + func: testTimerManagementStart}, 1.104 + {command: "d00c810301270182028182a40104", 1.105 + func: testTimerManagementDeactivate}, 1.106 + {command: "d00c810301270282028182a40108", 1.107 + func: testTimerManagementGetCurrentValue}, 1.108 + ]; 1.109 + 1.110 +runNextTest();