Bug 831183 - Part 2: xpcshell tests for SET_UP_CALL. r=allstars.chh, a=overholt
authorEdgar Chen <echen@mozilla.com>
Wed, 16 Jan 2013 12:27:38 +0800
changeset 118308 4facc2ed0e1b3ef86dbdad3e023db944152f3999
parent 118307 718fe51bc8f7032e187630fb2812f67fe4a3ae54
child 118309 096b4f3a085de8e08ae9dd6f3c3ec09198f05823
push id343
push userryanvm@gmail.com
push dateThu, 24 Jan 2013 18:55:32 +0000
reviewersallstars, overholt
bugs831183
milestone18.0
Bug 831183 - Part 2: xpcshell tests for SET_UP_CALL. r=allstars.chh, a=overholt
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
@@ -566,16 +566,53 @@ add_test(function test_spn_display_condi
 
   testDisplayConditions(testDisplayCondition, [
     [1, 123, 456, 123, 456, true, true],
     [0, 123, 456, 123, 456, false, true],
     [2, 123, 456, 123, 457, false, false],
     [0, 123, 456, 123, 457, false, true],
   ], run_next_test);
 
+/**
+ * Verify Proactive Command : Set Up Call
+ */
+add_test(function test_stk_proactive_command_set_up_call() {
+  let worker = newUint8Worker();
+  let pduHelper = worker.GsmPDUHelper;
+  let berHelper = worker.BerTlvHelper;
+  let stkHelper = worker.StkProactiveCmdHelper;
+  let cmdFactory = worker.StkCommandParamsFactory;
+
+  let set_up_call_1 = [
+    0xD0,
+    0x29,
+    0x81, 0x03, 0x01, 0x10, 0x04,
+    0x82, 0x02, 0x81, 0x82,
+    0x05, 0x0A, 0x44, 0x69, 0x73, 0x63, 0x6F, 0x6E, 0x6E, 0x65, 0x63, 0x74,
+    0x86, 0x09, 0x81, 0x10, 0x32, 0x04, 0x21, 0x43, 0x65, 0x1C, 0x2C,
+    0x05, 0x07, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65];
+
+  for (let i = 0 ; i < set_up_call_1.length; i++) {
+    pduHelper.writeHexOctet(set_up_call_1[i]);
+  }
+
+  let berTlv = berHelper.decode(set_up_call_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_SET_UP_CALL);
+
+  let setupCall = cmdFactory.createParam(tlv.value, ctlvs);
+  do_check_eq(setupCall.address, "012340123456,1,2");
+  do_check_eq(setupCall.confirmMessage, "Disconnect");
+  do_check_eq(setupCall.callMessage, "Message");
+
+  run_next_test();
+});
+
 add_test(function read_network_name() {
   let worker = newUint8Worker();
   let helper = worker.GsmPDUHelper;
   let buf = worker.Buf;
 
   // Returning length of byte.
   function writeNetworkName(isUCS2, requireCi, name) {
     let codingOctet = 0x80;