Bug 804667 - Part 4: xpcshell tests for TIMER_MANAGEMENT. r=allstars.chh
authorEdgar Chen <echen@mozilla.com>
Mon, 03 Dec 2012 17:50:14 +0800
changeset 125318 5c32d392d4f90f6643122bd1740fde6c104a9588
parent 125317 bcf02a9f81b1536e9b45c3b5080266ab19bfd6fa
child 125319 2992fbea1370d46bfd7415b2bf711ca2c073da38
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersallstars
bugs804667
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 804667 - Part 4: xpcshell tests for TIMER_MANAGEMENT. r=allstars.chh
dom/system/gonk/tests/test_ril_worker_icc.js
--- a/dom/system/gonk/tests/test_ril_worker_icc.js
+++ b/dom/system/gonk/tests/test_ril_worker_icc.js
@@ -786,16 +786,78 @@ add_test(function test_update_network_na
   // Current PLMN is not HPLMN, and according to LAC, we should get
   // the second PNN record.
   testNetworkName(123, 457, "PNN2Long", "PNN2Short");
 
   run_next_test();
 });
 
 /**
+ * Verify Proactive Command : Timer Management
+ */
+add_test(function test_stk_proactive_command_timer_management() {
+  let worker = newUint8Worker();
+  let pduHelper = worker.GsmPDUHelper;
+  let berHelper = worker.BerTlvHelper;
+  let stkHelper = worker.StkProactiveCmdHelper;
+
+  // Timer Management - Start
+  let timer_management_1 = [
+    0xD0,
+    0x11,
+    0x81, 0x03, 0x01, 0x27, 0x00,
+    0x82, 0x02, 0x81, 0x82,
+    0xA4, 0x01, 0x01,
+    0xA5, 0x03, 0x10, 0x20, 0x30
+  ];
+
+  for(let i = 0 ; i < timer_management_1.length; i++) {
+    pduHelper.writeHexOctet(timer_management_1[i]);
+  }
+
+  let berTlv = berHelper.decode(timer_management_1.length);
+  let ctlvs = berTlv.value;
+  let tlv = stkHelper.searchForTag(COMPREHENSIONTLV_TAG_COMMAND_DETAILS, ctlvs);
+  do_check_eq(tlv.value.commandNumber, 0x01);
+  do_check_eq(tlv.value.typeOfCommand, STK_CMD_TIMER_MANAGEMENT);
+  do_check_eq(tlv.value.commandQualifier, STK_TIMER_START);
+
+  tlv = stkHelper.searchForTag(COMPREHENSIONTLV_TAG_TIMER_IDENTIFIER, ctlvs);
+  do_check_eq(tlv.value.timerId, 0x01);
+
+  tlv = stkHelper.searchForTag(COMPREHENSIONTLV_TAG_TIMER_VALUE, ctlvs);
+  do_check_eq(tlv.value.timerValue, (0x01 * 60 * 60) + (0x02 * 60) + 0x03);
+
+  // Timer Management - Deactivate
+  let timer_management_2 = [
+    0xD0,
+    0x0C,
+    0x81, 0x03, 0x01, 0x27, 0x01,
+    0x82, 0x02, 0x81, 0x82,
+    0xA4, 0x01, 0x01
+  ];
+
+  for(let i = 0 ; i < timer_management_2.length; i++) {
+    pduHelper.writeHexOctet(timer_management_2[i]);
+  }
+
+  berTlv = berHelper.decode(timer_management_2.length);
+  ctlvs = berTlv.value;
+  tlv = stkHelper.searchForTag(COMPREHENSIONTLV_TAG_COMMAND_DETAILS, ctlvs);
+  do_check_eq(tlv.value.commandNumber, 0x01);
+  do_check_eq(tlv.value.typeOfCommand, STK_CMD_TIMER_MANAGEMENT);
+  do_check_eq(tlv.value.commandQualifier, STK_TIMER_DEACTIVATE);
+
+  tlv = stkHelper.searchForTag(COMPREHENSIONTLV_TAG_TIMER_IDENTIFIER, ctlvs);
+  do_check_eq(tlv.value.timerId, 0x01);
+
+  run_next_test();
+});
+
+/**
  * Verify Proactive Command : Provide Local Information
  */
 add_test(function test_stk_proactive_command_provide_local_information() {
   let worker = newUint8Worker();
   let pduHelper = worker.GsmPDUHelper;
   let berHelper = worker.BerTlvHelper;
   let stkHelper = worker.StkProactiveCmdHelper;