Bug 798569 - Part 2: xpcshell tests. r=vicamo
authorYoshi Huang <allstars.chh@mozilla.com>
Fri, 05 Oct 2012 16:56:54 -0300
changeset 110533 bf68f3cd1e66c1f27544d13acad5cf767348d1b9
parent 110532 67b12a268fbe9eef6187da47b7d8a6097ff9b8d5
child 110534 ea4e5cb4e240f13062ba60595ff0c003d224e6c1
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersvicamo
bugs798569
milestone19.0a1
Bug 798569 - Part 2: xpcshell tests. r=vicamo
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
@@ -358,16 +358,49 @@ add_test(function test_stk_proactive_com
 
   tlv = stkHelper.searchForTag(COMPREHENSIONTLV_TAG_DURATION, ctlvs);
   do_check_eq(tlv.value.timeUnit, STK_TIME_UNIT_SECOND);
   do_check_eq(tlv.value.timeInterval, 0x14);
 
   run_next_test();
 });
 
+add_test(function test_stk_proactive_command_event_list() {
+  let worker = newUint8Worker();
+  let pduHelper = worker.GsmPDUHelper;
+  let berHelper = worker.BerTlvHelper;
+  let stkHelper = worker.StkProactiveCmdHelper;
+
+  let event_1 = [
+    0xD0,
+    0x0F,
+    0x81, 0x03, 0x01, 0x05, 0x00,
+    0x82, 0x02, 0x81, 0x82,
+    0x99, 0x04, 0x00, 0x01, 0x02, 0x03];
+
+  for (let i = 0; i < event_1.length; i++) {
+    pduHelper.writeHexOctet(event_1[i]);
+  }
+
+  let berTlv = berHelper.decode(event_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, 0x05);
+  do_check_eq(tlv.value.commandQualifier, 0x00);
+
+  tlv = stkHelper.searchForTag(COMPREHENSIONTLV_TAG_EVENT_LIST, ctlvs);
+  do_check_eq(Array.isArray(tlv.value.eventList), true);
+  for (let i = 0; i < tlv.value.eventList.length; i++) {
+    do_check_eq(tlv.value.eventList[i], i);
+  }
+
+  run_next_test();
+});
+
 /**
  * Verify ComprehensionTlvHelper.getSizeOfLengthOctets
  */
 add_test(function test_get_size_of_length_octets() {
   let worker = newUint8Worker();
   let tlvHelper = worker.ComprehensionTlvHelper;
 
   let length = 0x70;
@@ -411,9 +444,10 @@ add_test(function test_write_length() {
   length = 0x18000;
   tlvHelper.writeLength(length);
   do_check_eq(pduHelper.readHexOctet(), 0x83);
   do_check_eq(pduHelper.readHexOctet(), (length >> 16) & 0xff);
   do_check_eq(pduHelper.readHexOctet(), (length >> 8) & 0xff);
   do_check_eq(pduHelper.readHexOctet(), length & 0xff);
 
   run_next_test();
-});
\ No newline at end of file
+});
+