dom/icc/tests/marionette/test_stk_proactive_command.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 MARIONETTE_HEAD_JS = "stk_helper.js";
     6 function testLocalInfoLocation(cmd) {
     7   log("STK CMD " + JSON.stringify(cmd));
     8   is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO);
     9   is(cmd.commandNumber, 0x01);
    10   is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_LOCATION_INFO);
    11   is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_LOCATION_INFO);
    13   runNextTest();
    14 }
    16 function testLocalInfoImei(cmd) {
    17   log("STK CMD " + JSON.stringify(cmd));
    18   is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO);
    19   is(cmd.commandNumber, 0x01);
    20   is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_IMEI);
    21   is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_IMEI);
    23   runNextTest();
    24 }
    26 function testLocalInfoDate(cmd) {
    27   log("STK CMD " + JSON.stringify(cmd));
    28   is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO);
    29   is(cmd.commandNumber, 0x01);
    30   is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_DATE_TIME_ZONE);
    31   is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_DATE_TIME_ZONE);
    33   runNextTest();
    34 }
    36 function testLocalInfoLanguage(cmd) {
    37   log("STK CMD " + JSON.stringify(cmd));
    38   is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO);
    39   is(cmd.commandNumber, 0x01);
    40   is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_LANGUAGE);
    41   is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_LANGUAGE);
    43   runNextTest();
    44 }
    46 function testRefresh(cmd) {
    47   log("STK CMD " + JSON.stringify(cmd));
    48   is(cmd.typeOfCommand, iccManager.STK_CMD_REFRESH);
    49   is(cmd.commandNumber, 0x01);
    50   is(cmd.commandQualifier, 0x01);
    51   is(cmd.options, null);
    53   runNextTest();
    54 }
    56 function testTimerManagementStart(cmd) {
    57   log("STK CMD " + JSON.stringify(cmd));
    58   is(cmd.typeOfCommand, iccManager.STK_CMD_TIMER_MANAGEMENT);
    59   is(cmd.commandNumber, 0x01);
    60   is(cmd.commandQualifier, iccManager.STK_TIMER_START);
    61   is(cmd.options.timerAction, iccManager.STK_TIMER_START);
    62   is(cmd.options.timerId, 0x01);
    63   is(cmd.options.timerValue, (0x01 * 60 * 60) + (0x02 * 60) + 0x03);
    65   runNextTest();
    66 }
    68 function testTimerManagementDeactivate(cmd) {
    69   log("STK CMD " + JSON.stringify(cmd));
    70   is(cmd.typeOfCommand, iccManager.STK_CMD_TIMER_MANAGEMENT);
    71   is(cmd.commandNumber, 0x01);
    72   is(cmd.commandQualifier, iccManager.STK_TIMER_DEACTIVATE);
    73   is(cmd.options.timerAction, iccManager.STK_TIMER_DEACTIVATE);
    74   is(cmd.options.timerId, 0x04);
    76   runNextTest();
    77 }
    79 function testTimerManagementGetCurrentValue(cmd) {
    80   log("STK CMD " + JSON.stringify(cmd));
    81   is(cmd.typeOfCommand, iccManager.STK_CMD_TIMER_MANAGEMENT);
    82   is(cmd.commandNumber, 0x01);
    83   is(cmd.commandQualifier, iccManager.STK_TIMER_GET_CURRENT_VALUE);
    84   is(cmd.options.timerAction, iccManager.STK_TIMER_GET_CURRENT_VALUE);
    85   is(cmd.options.timerId, 0x08);
    87   runNextTest();
    88 }
    90 let tests = [
    91   {command: "d009810301260082028182",
    92    func: testLocalInfoLocation},
    93   {command: "d009810301260182028182",
    94    func: testLocalInfoImei},
    95   {command: "d009810301260382028182",
    96    func: testLocalInfoDate},
    97   {command: "d009810301260482028182",
    98    func: testLocalInfoLanguage},
    99   {command: "d011810301270082028182a40101a503102030",
   100    func: testTimerManagementStart},
   101   {command: "d00c810301270182028182a40104",
   102    func: testTimerManagementDeactivate},
   103   {command: "d00c810301270282028182a40108",
   104    func: testTimerManagementGetCurrentValue},
   105  ];
   107 runNextTest();

mercurial