Bug 981519 - Number and name presentation - part 6 - test_call_presentation.js. r=vicamo, a=lmandel
authorHsin-Yi Tsai <htsai@mozilla.com>
Thu, 15 May 2014 14:37:19 +0800
changeset 207980 ded8f0cbc05f68d351768e100a1071dfad8443f8
parent 207979 78de1ef8227512642ccea70cfa604e241d5267e7
child 207981 9664c3ee820578f19474d6de187121dce547582a
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvicamo, lmandel
bugs981519
milestone32.0a2
Bug 981519 - Number and name presentation - part 6 - test_call_presentation.js. r=vicamo, a=lmandel
dom/telephony/test/marionette/head.js
dom/telephony/test/marionette/manifest.ini
dom/telephony/test/marionette/test_call_presentation.js
dom/telephony/test/marionette/test_emergency.js
dom/telephony/test/marionette/test_incoming_already_connected.js
dom/telephony/test/marionette/test_incoming_already_held.js
dom/telephony/test/marionette/test_incoming_answer_hangup.js
dom/telephony/test/marionette/test_incoming_answer_hangup_oncallschanged.js
dom/telephony/test/marionette/test_incoming_answer_remote_hangup.js
dom/telephony/test/marionette/test_incoming_connecting_hangup.js
dom/telephony/test/marionette/test_incoming_connecting_remote_hangup.js
dom/telephony/test/marionette/test_incoming_hangup_held.js
dom/telephony/test/marionette/test_incoming_hold_resume.js
dom/telephony/test/marionette/test_incoming_onstatechange.js
dom/telephony/test/marionette/test_incoming_reject.js
dom/telephony/test/marionette/test_incoming_remote_cancel.js
dom/telephony/test/marionette/test_incoming_remote_hangup_held.js
dom/telephony/test/marionette/test_multiple_hold.js
dom/telephony/test/marionette/test_outgoing_already_held.js
dom/telephony/test/marionette/test_outgoing_answer_hangup.js
dom/telephony/test/marionette/test_outgoing_answer_hangup_oncallschanged.js
dom/telephony/test/marionette/test_outgoing_answer_local_hangup.js
dom/telephony/test/marionette/test_outgoing_answer_radio_off.js
dom/telephony/test/marionette/test_outgoing_badNumber.js
dom/telephony/test/marionette/test_outgoing_busy.js
dom/telephony/test/marionette/test_outgoing_hangup_alerting.js
dom/telephony/test/marionette/test_outgoing_hangup_held.js
dom/telephony/test/marionette/test_outgoing_hold_resume.js
dom/telephony/test/marionette/test_outgoing_onstatechange.js
dom/telephony/test/marionette/test_outgoing_reject.js
dom/telephony/test/marionette/test_outgoing_remote_hangup_held.js
dom/telephony/test/marionette/test_redundant_operations.js
dom/telephony/test/marionette/test_swap_held_and_active.js
--- a/dom/telephony/test/marionette/head.js
+++ b/dom/telephony/test/marionette/head.js
@@ -284,16 +284,48 @@ let emulator = (function() {
         }
         is(call.state, state);
         callback();
       };
     };
   }
 
   /**
+   * Convenient helper to check the expected call number and name.
+   *
+   * @param number
+   *        A string sent to modem.
+   * @param numberPresentation
+   *        An unsigned short integer sent to modem.
+   * @param name
+   *        A string sent to modem.
+   * @param namePresentation
+   *        An unsigned short integer sent to modem.
+   * @param receivedNumber
+   *        A string exposed by Telephony API.
+   * @param receivedName
+   *        A string exposed by Telephony API.
+   */
+  function checkCallId(number, numberPresentation, name, namePresentation,
+                       receivedNumber, receivedName) {
+    let expectedNum = !numberPresentation ? number : "";
+    is(receivedNumber, expectedNum, "check number per numberPresentation");
+
+    let expectedName;
+    if (numberPresentation) {
+      expectedName = "";
+    } else if (!namePresentation) {
+      expectedName = name ? name : "";
+    } else {
+      expectedName = "";
+    }
+    is(receivedName, expectedName, "check name per number/namePresentation");
+  }
+
+  /**
    * Convenient helper to check the call list existing in the emulator.
    *
    * @param expectedCallList
    *        An array of call info with the format of "callStrPool()[state]".
    * @return A deferred promise.
    */
   function checkEmulatorCallList(expectedCallList) {
     let deferred = Promise.defer();
@@ -389,17 +421,17 @@ let emulator = (function() {
   function dial(number, serviceId) {
     serviceId = typeof serviceId !== "undefined" ? serviceId : 0;
     log("Make an outgoing call: " + number + ", serviceId: " + serviceId);
 
     let deferred = Promise.defer();
 
     telephony.dial(number, serviceId).then(call => {
       ok(call);
-      is(call.number, number);
+      is(call.id.number, number);
       is(call.state, "dialing");
       is(call.serviceId, serviceId);
 
       call.onalerting = function onalerting(event) {
         call.onalerting = null;
         log("Received 'onalerting' call event.");
         checkEventCallState(event, call, "alerting");
         deferred.resolve(call);
@@ -493,41 +525,72 @@ let emulator = (function() {
       deferred.resolve(call);
     };
     call.hold();
 
     return deferred.promise;
   }
 
   /**
+   * Locally hang up a call.
+   *
+   * @param call
+   *        A TelephonyCall object.
+   * @return A deferred promise.
+   */
+  function hangUp(call) {
+    let deferred = Promise.defer();
+
+    call.ondisconnected = function(event) {
+      log("Received 'disconnected' call event");
+      call.ondisconnected = null;
+      checkEventCallState(event, call, "disconnected");
+      deferred.resolve(call);
+    };
+    call.hangUp();
+
+    return deferred.promise;
+  }
+
+  /**
    * Simulate an incoming call.
    *
    * @param number
    *        A string.
+   * @param numberPresentation [optional]
+   *        An unsigned short integer.
+   * @param name [optional]
+   *        A string.
+   * @param namePresentation [optional]
+   *        An unsigned short integer.
    * @return A deferred promise.
    */
-  function remoteDial(number) {
+  function remoteDial(number, numberPresentation, name, namePresentation) {
     log("Simulating an incoming call.");
 
     let deferred = Promise.defer();
 
     telephony.onincoming = function onincoming(event) {
       log("Received 'incoming' call event.");
       telephony.onincoming = null;
 
       let call = event.call;
 
       ok(call);
-      is(call.number, number);
       is(call.state, "incoming");
-
+      checkCallId(number, numberPresentation, name, namePresentation,
+                  call.id.number, call.id.name);
       deferred.resolve(call);
     };
-    emulator.run("gsm call " + number);
 
+    numberPresentation = numberPresentation || "";
+    name = name || "";
+    namePresentation = namePresentation || "";
+    emulator.run("gsm call " + number + "," + numberPresentation + "," + name +
+                 "," + namePresentation);
     return deferred.promise;
   }
 
   /**
    * Remote party answers the call.
    *
    * @param call
    *        A TelephonyCall object.
@@ -539,17 +602,17 @@ let emulator = (function() {
     let deferred = Promise.defer();
 
     call.onconnected = function onconnected(event) {
       log("Received 'connected' call event.");
       call.onconnected = null;
       checkEventCallState(event, call, "connected");
       deferred.resolve(call);
     };
-    emulator.run("gsm accept " + call.number);
+    emulator.run("gsm accept " + call.id.number);
 
     return deferred.promise;
   }
 
   /**
    * Remote party hangs up the call.
    *
    * @param call
@@ -562,17 +625,17 @@ let emulator = (function() {
     let deferred = Promise.defer();
 
     call.ondisconnected = function ondisconnected(event) {
       log("Received 'disconnected' call event.");
       call.ondisconnected = null;
       checkEventCallState(event, call, "disconnected");
       deferred.resolve(call);
     };
-    emulator.run("gsm cancel " + call.number);
+    emulator.run("gsm cancel " + call.id.number);
 
     return deferred.promise;
   }
 
   /**
    * Remote party hangs up all the calls.
    *
    * @param calls
@@ -613,17 +676,17 @@ let emulator = (function() {
     let pending = ["conference.oncallschanged", "conference.onconnected"];
     let receive = function(name) {
       receivedPending(name, pending, done);
     };
 
     let check_onconnected  = StateEventChecker('connected', 'onresuming');
 
     for (let call of callsToAdd) {
-      let callName = "callToAdd (" + call.number + ')';
+      let callName = "callToAdd (" + call.id.number + ')';
 
       let ongroupchange = callName + ".ongroupchange";
       pending.push(ongroupchange);
       check_ongroupchange(call, callName, conference,
                           receive.bind(null, ongroupchange));
 
       let onstatechange = callName + ".onstatechange";
       pending.push(onstatechange);
@@ -677,17 +740,17 @@ let emulator = (function() {
     let receive = function(name) {
       receivedPending(name, pending, done);
     };
 
     let check_onholding = StateEventChecker('holding', null);
     let check_onheld = StateEventChecker('held', 'onholding');
 
     for (let call of calls) {
-      let callName = "call (" + call.number + ')';
+      let callName = "call (" + call.id.number + ')';
 
       let onholding = callName + ".onholding";
       pending.push(onholding);
       check_onholding(call, callName, receive.bind(null, onholding));
 
       let onheld = callName + ".onheld";
       pending.push(onheld);
       check_onheld(call, callName, receive.bind(null, onheld));
@@ -730,17 +793,17 @@ let emulator = (function() {
     let receive = function(name) {
       receivedPending(name, pending, done);
     };
 
     let check_onresuming   = StateEventChecker('resuming', null);
     let check_onconnected  = StateEventChecker('connected', 'onresuming');
 
     for (let call of calls) {
-      let callName = "call (" + call.number + ')';
+      let callName = "call (" + call.id.number + ')';
 
       let onresuming = callName + ".onresuming";
       pending.push(onresuming);
       check_onresuming(call, callName, receive.bind(null, onresuming));
 
       let onconnected = callName + ".onconnected";
       pending.push(onconnected);
       check_onconnected(call, callName, receive.bind(null, onconnected));
@@ -789,28 +852,28 @@ let emulator = (function() {
     let pending = ["callToRemove.ongroupchange", "telephony.oncallschanged",
                    "conference.oncallschanged", "conference.onstatechange"];
     let receive = function(name) {
       receivedPending(name, pending, done);
     };
 
     // Remained call in conference will be held.
     for (let call of remainedCalls) {
-      let callName = "remainedCall (" + call.number + ')';
+      let callName = "remainedCall (" + call.id.number + ')';
 
       let onstatechange = callName + ".onstatechange";
       pending.push(onstatechange);
       check_onstatechange(call, callName, 'held',
                           receive.bind(null, onstatechange));
     }
 
     // When a call is removed from conference with 2 calls, another one will be
     // automatically removed from group and be put on hold.
     for (let call of autoRemovedCalls) {
-      let callName = "autoRemovedCall (" + call.number + ')';
+      let callName = "autoRemovedCall (" + call.id.number + ')';
 
       let ongroupchange = callName + ".ongroupchange";
       pending.push(ongroupchange);
       check_ongroupchange(call, callName, null,
                           receive.bind(null, ongroupchange));
 
       let onstatechange = callName + ".onstatechange";
       pending.push(onstatechange);
@@ -873,17 +936,17 @@ let emulator = (function() {
     let pending = ["conference.oncallschanged", "remoteHangUp"];
     let receive = function(name) {
       receivedPending(name, pending, done);
     };
 
     // When a call is hang up from conference with 2 calls, another one will be
     // automatically removed from group.
     for (let call of autoRemovedCalls) {
-      let callName = "autoRemovedCall (" + call.number + ')';
+      let callName = "autoRemovedCall (" + call.id.number + ')';
 
       let ongroupchange = callName + ".ongroupchange";
       pending.push(ongroupchange);
       check_ongroupchange(call, callName, null,
                           receive.bind(null, ongroupchange));
     }
 
     if (autoRemovedCalls.length) {
@@ -962,18 +1025,18 @@ let emulator = (function() {
    *        Number of an incoming call.
    * @param conferenceCalls
    *        Calls already in conference.
    * @return Promise<[calls in the conference]>
    */
   function createCallAndAddToConference(inNumber, conferenceCalls) {
     // Create an info array. allInfo = [info1, info2, ...].
     let allInfo = conferenceCalls.map(function(call, i) {
-      return (i === 0) ? outCallStrPool(call.number)
-                       : inCallStrPool(call.number);
+      return (i === 0) ? outCallStrPool(call.id.number)
+                       : inCallStrPool(call.id.number);
     });
 
     // Define state property of the info array.
     // Ex: allInfo.active = [info1.active, info2.active, ...].
     function addInfoState(allInfo, state) {
       Object.defineProperty(allInfo, state, {
         get: function() {
           return allInfo.map(function(info) { return info[state]; });
@@ -1042,16 +1105,17 @@ let emulator = (function() {
   this.gCheckInitialState = checkInitialState;
   this.gClearCalls = clearCalls;
   this.gOutCallStrPool = outCallStrPool;
   this.gInCallStrPool = inCallStrPool;
   this.gCheckState = checkState;
   this.gCheckAll = checkAll;
   this.gDial = dial;
   this.gAnswer = answer;
+  this.gHangUp = hangUp;
   this.gHold = hold;
   this.gRemoteDial = remoteDial;
   this.gRemoteAnswer = remoteAnswer;
   this.gRemoteHangUp = remoteHangUp;
   this.gRemoteHangUpCalls = remoteHangUpCalls;
   this.gAddCallsToConference = addCallsToConference;
   this.gHoldConference = holdConference;
   this.gResumeConference = resumeConference;
--- a/dom/telephony/test/marionette/manifest.ini
+++ b/dom/telephony/test/marionette/manifest.ini
@@ -54,8 +54,9 @@ disabled = Bug 821958
 [test_conference_two_hangup_one.js]
 [test_conference_two_hold_resume.js]
 [test_conference_two_remove_one.js]
 [test_conference_three_hangup_one.js]
 [test_conference_three_remove_one.js]
 [test_conference_add_twice_error.js]
 [test_outgoing_when_two_calls_on_line.js]
 [test_incomingcall_phonestate_speaker.js]
+[test_call_presentation.js]
new file mode 100644
--- /dev/null
+++ b/dom/telephony/test/marionette/test_call_presentation.js
@@ -0,0 +1,71 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+MARIONETTE_TIMEOUT = 60000;
+MARIONETTE_HEAD_JS = 'head.js';
+
+const ALLOWED = 0;
+const RESTRICTED = 1;
+const UNKNOWN = 2;
+const PAYPHONE =3;
+
+function getPresentationStr(presentation) {
+  let str;
+  switch (presentation) {
+    case ALLOWED:
+      str = "allowed";
+      break;
+    case RESTRICTED:
+      str = "restricted";
+      break;
+    case UNKNOWN:
+      str = "unknown";
+      break;
+    case PAYPHONE:
+      str = "payphone";
+      break;
+  }
+  return str;
+}
+
+function getNamePresentation(numberPresentation, namePresentation) {
+  // See TS 23.096 Figure 3a and Annex A Note 1.
+  if (!numberPresentation) {
+    if (namePresentation == undefined) {
+      namePresentation = ALLOWED;
+    }
+  } else {
+    namePresentation = ALLOWED;
+  }
+  return getPresentationStr(namePresentation);
+}
+
+function test(number, numberPresentation, name, namePresentation) {
+  return gRemoteDial(number, numberPresentation, name, namePresentation)
+    .then(call => {
+      is(call.id.numberPresentation, getPresentationStr(numberPresentation),
+         "check numberPresentation");
+      is(call.id.namePresentation,
+         getNamePresentation(numberPresentation, namePresentation),
+         "check namePresentation");
+      return call;
+    })
+    .then(gHangUp);
+}
+
+startTest(function() {
+  let inNumber = "5555550201";
+  Promise.resolve()
+    .then(() => test(inNumber, ALLOWED))
+    .then(() => test(inNumber, RESTRICTED))
+    .then(() => test(inNumber, UNKNOWN))
+    .then(() => test(inNumber, PAYPHONE))
+    .then(() => test(inNumber, ALLOWED, "TestName"))
+    .then(() => test(inNumber, ALLOWED, "TestName", ALLOWED))
+    .then(() => test(inNumber, ALLOWED, "TestName", RESTRICTED))
+    .then(() => test(inNumber, ALLOWED, "TestName", UNKNOWN))
+    .then(() => test(inNumber, RESTRICTED, "TestName", ALLOWED))
+    .then(() => test(inNumber, RESTRICTED, "TestName", RESTRICTED))
+    .then(() => test(inNumber, RESTRICTED, "TestName", UNKNOWN))
+    .then(finish);
+});
--- a/dom/telephony/test/marionette/test_emergency.js
+++ b/dom/telephony/test/marionette/test_emergency.js
@@ -9,17 +9,17 @@ let outgoing;
 let calls;
 
 function dial() {
   log("Make an emergency call.");
 
   telephony.dialEmergency(number).then(call => {
     outgoing = call;
     ok(outgoing);
-    is(outgoing.number, number);
+    is(outgoing.id.number, number);
     is(outgoing.state, "dialing");
 
     is(outgoing, telephony.active);
     //ok(telephony.calls === calls); // bug 717414
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoing);
 
     outgoing.onalerting = function onalerting(event) {
--- a/dom/telephony/test/marionette/test_incoming_already_connected.js
+++ b/dom/telephony/test/marionette/test_incoming_already_connected.js
@@ -10,17 +10,17 @@ let outgoingCall;
 let incomingCall;
 let gotOriginalConnected = false;
 
 function dial() {
   log("Make an outgoing call.");
   telephony.dial(outNumber).then(call => {
     outgoingCall = call;
     ok(outgoingCall);
-    is(outgoingCall.number, outNumber);
+    is(outgoingCall.id.number, outNumber);
     is(outgoingCall.state, "dialing");
 
     is(outgoingCall, telephony.active);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoingCall);
 
     outgoingCall.onalerting = function onalerting(event) {
       log("Received 'onalerting' call event.");
@@ -69,17 +69,17 @@ function answer() {
 // With one connected call already, simulate an incoming call
 function simulateIncoming() {
   log("Simulating an incoming call (with one call already connected).");
 
   telephony.onincoming = function onincoming(event) {
     log("Received 'incoming' call event.");
     incomingCall = event.call;
     ok(incomingCall);
-    is(incomingCall.number, inNumber);
+    is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     // Should be two calls now
     is(telephony.calls.length, 2);
     is(telephony.calls[0], outgoingCall);
     is(telephony.calls[1], incomingCall);
 
     emulator.run("gsm list", function(result) {
--- a/dom/telephony/test/marionette/test_incoming_already_held.js
+++ b/dom/telephony/test/marionette/test_incoming_already_held.js
@@ -10,17 +10,17 @@ let outgoingCall;
 let incomingCall;
 let gotOriginalConnected = false;
 
 function dial() {
   log("Make an outgoing call.");
   telephony.dial(outNumber).then(call => {
     outgoingCall = call;
     ok(outgoingCall);
-    is(outgoingCall.number, outNumber);
+    is(outgoingCall.id.number, outNumber);
     is(outgoingCall.state, "dialing");
 
     is(outgoingCall, telephony.active);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoingCall);
 
     outgoingCall.onalerting = function onalerting(event) {
       log("Received 'onalerting' call event.");
@@ -100,17 +100,17 @@ function holdCall() {
 // With one call on hold, simulate an incoming call
 function simulateIncoming() {
   log("Simulating an incoming call (with one call already held).");
 
   telephony.onincoming = function onincoming(event) {
     log("Received 'incoming' call event.");
     incomingCall = event.call;
     ok(incomingCall);
-    is(incomingCall.number, inNumber);
+    is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     // Should be two calls now
     is(telephony.calls.length, 2);
     is(telephony.calls[0], outgoingCall);
     is(telephony.calls[1], incomingCall);
 
     emulator.run("gsm list", function(result) {
--- a/dom/telephony/test/marionette/test_incoming_answer_hangup.js
+++ b/dom/telephony/test/marionette/test_incoming_answer_hangup.js
@@ -10,17 +10,17 @@ let calls;
 
 function simulateIncoming() {
   log("Simulating an incoming call.");
 
   telephony.onincoming = function onincoming(event) {
     log("Received 'incoming' call event.");
     incoming = event.call;
     ok(incoming);
-    is(incoming.number, number);
+    is(incoming.id.number, number);
     is(incoming.state, "incoming");
 
     //ok(telephony.calls === calls); // bug 717414
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incoming);
 
     emulator.run("gsm list", function(result) {
       log("Call list is now: " + result);
--- a/dom/telephony/test/marionette/test_incoming_answer_hangup_oncallschanged.js
+++ b/dom/telephony/test/marionette/test_incoming_answer_hangup_oncallschanged.js
@@ -17,17 +17,17 @@ function simulateIncoming() {
       log("Notifying calls array is loaded. No call information accompanies.");
       return;
     }
 
     telephony.oncallschanged = null;
 
     incoming = event.call;
     ok(incoming);
-    is(incoming.number, number);
+    is(incoming.id.number, number);
     is(incoming.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incoming);
 
     emulator.run("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + number + " : incoming");
--- a/dom/telephony/test/marionette/test_incoming_answer_remote_hangup.js
+++ b/dom/telephony/test/marionette/test_incoming_answer_remote_hangup.js
@@ -9,17 +9,17 @@ let incomingCall;
 
 function simulateIncoming() {
   log("Simulating an incoming call.");
 
   telephony.onincoming = function onincoming(event) {
     log("Received 'incoming' call event.");
     incomingCall = event.call;
     ok(incomingCall);
-    is(incomingCall.number, inNumber);
+    is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
     emulator.run("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : incoming");
--- a/dom/telephony/test/marionette/test_incoming_connecting_hangup.js
+++ b/dom/telephony/test/marionette/test_incoming_connecting_hangup.js
@@ -9,17 +9,17 @@ let incomingCall;
 
 function simulateIncoming() {
   log("Simulating an incoming call.");
 
   telephony.onincoming = function onincoming(event) {
     log("Received 'incoming' call event.");
     incomingCall = event.call;
     ok(incomingCall);
-    is(incomingCall.number, inNumber);
+    is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
     emulator.run("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : incoming");
--- a/dom/telephony/test/marionette/test_incoming_connecting_remote_hangup.js
+++ b/dom/telephony/test/marionette/test_incoming_connecting_remote_hangup.js
@@ -9,17 +9,17 @@ let incomingCall;
 
 function simulateIncoming() {
   log("Simulating an incoming call.");
 
   telephony.onincoming = function onincoming(event) {
     log("Received 'incoming' call event.");
     incomingCall = event.call;
     ok(incomingCall);
-    is(incomingCall.number, inNumber);
+    is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
     emulator.run("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : incoming");
--- a/dom/telephony/test/marionette/test_incoming_hangup_held.js
+++ b/dom/telephony/test/marionette/test_incoming_hangup_held.js
@@ -9,17 +9,17 @@ let incomingCall;
 
 function simulateIncoming() {
   log("Simulating an incoming call.");
 
   telephony.onincoming = function onincoming(event) {
     log("Received 'incoming' call event.");
     incomingCall = event.call;
     ok(incomingCall);
-    is(incomingCall.number, inNumber);
+    is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
     emulator.run("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : incoming");
--- a/dom/telephony/test/marionette/test_incoming_hold_resume.js
+++ b/dom/telephony/test/marionette/test_incoming_hold_resume.js
@@ -10,17 +10,17 @@ let incomingCall;
 
 function simulateIncoming() {
   log("Simulating an incoming call.");
 
   telephony.onincoming = function onincoming(event) {
     log("Received 'incoming' call event.");
     incomingCall = event.call;
     ok(incomingCall);
-    is(incomingCall.number, number);
+    is(incomingCall.id.number, number);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
     emulator.run("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + number + " : incoming");
--- a/dom/telephony/test/marionette/test_incoming_onstatechange.js
+++ b/dom/telephony/test/marionette/test_incoming_onstatechange.js
@@ -9,17 +9,17 @@ let inNumber = "5555551111";
 
 function simulateIncoming() {
   log("Simulating an incoming call.");
 
   telephony.onincoming = function onincoming(event) {
     log("Received 'incoming' call event.");
     incomingCall = event.call;
     ok(incomingCall);
-    is(incomingCall.number, inNumber);
+    is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
     emulator.run("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : incoming");
--- a/dom/telephony/test/marionette/test_incoming_reject.js
+++ b/dom/telephony/test/marionette/test_incoming_reject.js
@@ -10,17 +10,17 @@ let calls;
 
 function simulateIncoming() {
   log("Simulating an incoming call.");
 
   telephony.onincoming = function onincoming(event) {
     log("Received 'incoming' call event.");
     incoming = event.call;
     ok(incoming);
-    is(incoming.number, number);
+    is(incoming.id.number, number);
     is(incoming.state, "incoming");
 
     //ok(telephony.calls === calls); // bug 717414
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incoming);
 
     emulator.run("gsm list", function(result) {
       log("Call list is now: " + result);
--- a/dom/telephony/test/marionette/test_incoming_remote_cancel.js
+++ b/dom/telephony/test/marionette/test_incoming_remote_cancel.js
@@ -9,17 +9,17 @@ let incomingCall;
 
 function simulateIncoming() {
   log("Simulating an incoming call.");
 
   telephony.onincoming = function onincoming(event) {
     log("Received 'incoming' call event.");
     incomingCall = event.call;
     ok(incomingCall);
-    is(incomingCall.number, inNumber);
+    is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
     emulator.run("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : incoming");
--- a/dom/telephony/test/marionette/test_incoming_remote_hangup_held.js
+++ b/dom/telephony/test/marionette/test_incoming_remote_hangup_held.js
@@ -9,17 +9,17 @@ let incomingCall;
 
 function simulateIncoming() {
   log("Simulating an incoming call.");
 
   telephony.onincoming = function onincoming(event) {
     log("Received 'incoming' call event.");
     incomingCall = event.call;
     ok(incomingCall);
-    is(incomingCall.number, inNumber);
+    is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
     emulator.run("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : incoming");
--- a/dom/telephony/test/marionette/test_multiple_hold.js
+++ b/dom/telephony/test/marionette/test_multiple_hold.js
@@ -11,17 +11,17 @@ let outgoingCall;
 
 function simulateIncoming() {
   log("Simulating an incoming call.");
 
   telephony.onincoming = function onincoming(event) {
     log("Received 'incoming' call event.");
     incomingCall = event.call;
     ok(incomingCall);
-    is(incomingCall.number, inNumber);
+    is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
     emulator.run("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : incoming");
@@ -94,17 +94,17 @@ function holdCall() {
 
 // With one call on hold, make outgoing call
 function dial() {
   log("Making an outgoing call (while have one call already held).");
 
   telephony.dial(outNumber).then(call => {
     outgoingCall = call;
     ok(outgoingCall);
-    is(outgoingCall.number, outNumber);
+    is(outgoingCall.id.number, outNumber);
     is(outgoingCall.state, "dialing");
     is(outgoingCall, telephony.active);
     is(telephony.calls.length, 2);
     is(telephony.calls[0], incomingCall);
     is(telephony.calls[1], outgoingCall);
 
     outgoingCall.onalerting = function onalerting(event) {
       log("Received 'onalerting' call event.");
--- a/dom/telephony/test/marionette/test_outgoing_already_held.js
+++ b/dom/telephony/test/marionette/test_outgoing_already_held.js
@@ -11,17 +11,17 @@ let outgoingCall;
 
 function simulateIncoming() {
   log("Simulating an incoming call.");
 
   telephony.onincoming = function onincoming(event) {
     log("Received 'incoming' call event.");
     incomingCall = event.call;
     ok(incomingCall);
-    is(incomingCall.number, inNumber);
+    is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
     // Wait for emulator to catch up before continuing
     waitFor(verifyCallList,function() {
       return(rcvdEmulatorCallback);
@@ -107,17 +107,17 @@ function holdCall(){
 
 // With one call on hold, make outgoing call
 function dial() {
   log("Making an outgoing call (while have one call already held).");
 
   telephony.dial(outNumber).then(call => {
     outgoingCall = call;
     ok(outgoingCall);
-    is(outgoingCall.number, outNumber);
+    is(outgoingCall.id.number, outNumber);
     is(outgoingCall.state, "dialing");
 
     is(outgoingCall, telephony.active);
     is(telephony.calls.length, 2);
     is(telephony.calls[0], incomingCall);
     is(telephony.calls[1], outgoingCall);
 
     outgoingCall.onalerting = function onalerting(event) {
--- a/dom/telephony/test/marionette/test_outgoing_answer_hangup.js
+++ b/dom/telephony/test/marionette/test_outgoing_answer_hangup.js
@@ -9,17 +9,17 @@ let outgoing;
 let calls;
 
 function dial() {
   log("Make an outgoing call.");
 
   telephony.dial(number).then(call => {
     outgoing = call;
     ok(outgoing);
-    is(outgoing.number, number);
+    is(outgoing.id.number, number);
     is(outgoing.state, "dialing");
 
     is(outgoing, telephony.active);
     //ok(telephony.calls === calls); // bug 717414
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoing);
 
     outgoing.onalerting = function onalerting(event) {
--- a/dom/telephony/test/marionette/test_outgoing_answer_hangup_oncallschanged.js
+++ b/dom/telephony/test/marionette/test_outgoing_answer_hangup_oncallschanged.js
@@ -20,17 +20,17 @@ function dial() {
 
     let expected_states = ["dialing", "disconnected"];
     ok(expected_states.indexOf(event.call.state) != -1,
       "Unexpected call state: " + event.call.state);
 
     if (event.call.state == "dialing") {
       outgoing = event.call;
       ok(outgoing);
-      is(outgoing.number, number);
+      is(outgoing.id.number, number);
 
       is(outgoing, telephony.active);
       is(telephony.calls.length, 1);
       is(telephony.calls[0], outgoing);
 
       checkCallList();
     }
 
--- a/dom/telephony/test/marionette/test_outgoing_answer_local_hangup.js
+++ b/dom/telephony/test/marionette/test_outgoing_answer_local_hangup.js
@@ -8,17 +8,17 @@ let outgoingCall;
 let outNumber = "5555551111";
 
 function dial() {
   log("Make an outgoing call.");
 
   telephony.dial(outNumber).then(call => {
     outgoingCall = call;
     ok(outgoingCall);
-    is(outgoingCall.number, outNumber);
+    is(outgoingCall.id.number, outNumber);
     is(outgoingCall.state, "dialing");
 
     is(outgoingCall, telephony.active);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoingCall);
 
     outgoingCall.onalerting = function onalerting(event) {
       log("Received 'alerting' call event.");
--- a/dom/telephony/test/marionette/test_outgoing_answer_radio_off.js
+++ b/dom/telephony/test/marionette/test_outgoing_answer_radio_off.js
@@ -27,17 +27,17 @@ function setRadioEnabled(enabled) {
 }
 
 function dial(number) {
   log("Make an outgoing call.");
 
   let deferred = Promise.defer();
   telephony.dial(number).then(call => {
     ok(call);
-    is(call.number, number);
+    is(call.id.number, number);
     is(call.state, "dialing");
 
     call.onalerting = function(event) {
       log("Received 'onalerting' call event.");
       call.onalerting = null;
       is(call, event.call);
       is(call.state, "alerting");
       deferred.resolve(call);
@@ -54,17 +54,17 @@ function remoteAnswer(call) {
 
   call.onconnected = function(event) {
     log("Received 'connected' call event.");
     call.onconnected = null;
     is(call, event.call);
     is(call.state, "connected");
     deferred.resolve(call);
   };
-  emulator.run("gsm accept " + call.number);
+  emulator.run("gsm accept " + call.id.number);
 
   return deferred.promise;
 }
 
 function disableRadioAndWaitForCallEvent(call) {
   log("Disable radio and wait for call event.");
 
   let deferred = Promise.defer();
--- a/dom/telephony/test/marionette/test_outgoing_badNumber.js
+++ b/dom/telephony/test/marionette/test_outgoing_badNumber.js
@@ -12,17 +12,17 @@ function dial() {
   log("Make an outgoing call to an invalid number.");
 
   // Note: The number is valid from the view of phone and the call could be
   // dialed out successfully. However, it will later receive the BadNumberError
   // from network side.
   telephony.dial(number).then(call => {
     outgoing = call;
     ok(outgoing);
-    is(outgoing.number, number);
+    is(outgoing.id.number, number);
     is(outgoing.state, "dialing");
 
     is(outgoing, telephony.active);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoing);
 
     outgoing.onerror = function onerror(event) {
       log("Received 'error' event.");
--- a/dom/telephony/test/marionette/test_outgoing_busy.js
+++ b/dom/telephony/test/marionette/test_outgoing_busy.js
@@ -8,17 +8,17 @@ let number = "5555552368";
 let outgoing;
 
 function dial() {
   log("Make an outgoing call.");
 
   telephony.dial(number).then(call => {
     outgoing = call;
     ok(outgoing);
-    is(outgoing.number, number);
+    is(outgoing.id.number, number);
     is(outgoing.state, "dialing");
 
     is(outgoing, telephony.active);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoing);
 
     outgoing.onalerting = function onalerting(event) {
       log("Received 'onalerting' call event.");
--- a/dom/telephony/test/marionette/test_outgoing_hangup_alerting.js
+++ b/dom/telephony/test/marionette/test_outgoing_hangup_alerting.js
@@ -9,17 +9,17 @@ let outgoing;
 let calls;
 
 function dial() {
   log("Make an outgoing call.");
 
   telephony.dial(number).then(call => {
     outgoing = call;
     ok(outgoing);
-    is(outgoing.number, number);
+    is(outgoing.id.number, number);
     is(outgoing.state, "dialing");
 
     is(outgoing, telephony.active);
     //ok(telephony.calls === calls); // bug 717414
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoing);
 
     outgoing.onalerting = function onalerting(event) {
--- a/dom/telephony/test/marionette/test_outgoing_hangup_held.js
+++ b/dom/telephony/test/marionette/test_outgoing_hangup_held.js
@@ -9,17 +9,17 @@ let outgoing;
 let calls;
 
 function dial() {
   log("Make an outgoing call.");
 
   telephony.dial(number).then(call => {
     outgoing = call;
     ok(outgoing);
-    is(outgoing.number, number);
+    is(outgoing.id.number, number);
     is(outgoing.state, "dialing");
     is(outgoing, telephony.active);
     //ok(telephony.calls === calls); // bug 717414
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoing);
 
     outgoing.onalerting = function onalerting(event) {
       log("Received 'onalerting' call event.");
--- a/dom/telephony/test/marionette/test_outgoing_hold_resume.js
+++ b/dom/telephony/test/marionette/test_outgoing_hold_resume.js
@@ -9,17 +9,17 @@ let connectedCalls;
 let outgoingCall;
 
 function dial() {
   log("Make an outgoing call.");
 
   telephony.dial(number).then(call => {
     outgoingCall = call;
     ok(outgoingCall);
-    is(outgoingCall.number, number);
+    is(outgoingCall.id.number, number);
     is(outgoingCall.state, "dialing");
 
     is(outgoingCall, telephony.active);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoingCall);
 
     outgoingCall.onalerting = function onalerting(event) {
       log("Received 'onalerting' call event.");
--- a/dom/telephony/test/marionette/test_outgoing_onstatechange.js
+++ b/dom/telephony/test/marionette/test_outgoing_onstatechange.js
@@ -8,17 +8,17 @@ let outgoingCall;
 let outNumber = "5555551111";
 
 function dial() {
   log("Make an outgoing call.");
 
   telephony.dial(outNumber).then(call => {
     outgoingCall = call;
     ok(outgoingCall);
-    is(outgoingCall.number, outNumber);
+    is(outgoingCall.id.number, outNumber);
     is(outgoingCall.state, "dialing");
 
     is(outgoingCall, telephony.active);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoingCall);
 
     outgoingCall.onstatechange = function statechangering(event) {
       log("Received 'onstatechange' call event.");
--- a/dom/telephony/test/marionette/test_outgoing_reject.js
+++ b/dom/telephony/test/marionette/test_outgoing_reject.js
@@ -8,17 +8,17 @@ let number = "5555552368";
 let outgoing;
 
 function dial() {
   log("Make an outgoing call.");
 
   telephony.dial(number).then(call => {
     outgoing = call;
     ok(outgoing);
-    is(outgoing.number, number);
+    is(outgoing.id.number, number);
     is(outgoing.state, "dialing");
 
     is(outgoing, telephony.active);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoing);
 
     outgoing.onalerting = function onalerting(event) {
       log("Received 'onalerting' call event.");
--- a/dom/telephony/test/marionette/test_outgoing_remote_hangup_held.js
+++ b/dom/telephony/test/marionette/test_outgoing_remote_hangup_held.js
@@ -7,17 +7,17 @@ let outNumber = "5555551111";
 let outgoingCall;
 
 function dial() {
   log("Make an outgoing call.");
 
   telephony.dial(outNumber).then(call => {
     outgoingCall = call;
     ok(outgoingCall);
-    is(outgoingCall.number, outNumber);
+    is(outgoingCall.id.number, outNumber);
     is(outgoingCall.state, "dialing");
 
     is(outgoingCall, telephony.active);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoingCall);
 
     outgoingCall.onalerting = function onalerting(event) {
       log("Received 'alerting' call event.");
--- a/dom/telephony/test/marionette/test_redundant_operations.js
+++ b/dom/telephony/test/marionette/test_redundant_operations.js
@@ -9,17 +9,17 @@ let incomingCall;
 
 function simulateIncoming() {
   log("Simulating an incoming call.");
 
   telephony.onincoming = function onincoming(event) {
     log("Received 'incoming' call event.");
     incomingCall = event.call;
     ok(incomingCall);
-    is(incomingCall.number, inNumber);
+    is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
     emulator.run("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : incoming");
--- a/dom/telephony/test/marionette/test_swap_held_and_active.js
+++ b/dom/telephony/test/marionette/test_swap_held_and_active.js
@@ -12,17 +12,17 @@ let gotOriginalConnected = false;
 let gotHeld = false;
 let gotConnected = false;
 
 function dial() {
   log("Make an outgoing call.");
   telephony.dial(outNumber).then(call => {
     outgoingCall = call;
     ok(outgoingCall);
-    is(outgoingCall.number, outNumber);
+    is(outgoingCall.id.number, outNumber);
     is(outgoingCall.state, "dialing");
 
     outgoingCall.onalerting = function onalerting(event) {
       log("Received 'alerting' call event.");
 
       is(outgoingCall, event.call);
       is(outgoingCall.state, "alerting");
       is(outgoingCall, telephony.active);
@@ -102,17 +102,17 @@ function holdCall() {
 // With one call on hold, simulate an incoming call
 function simulateIncoming() {
   log("Simulating an incoming call (with one call already held).");
 
   telephony.onincoming = function onincoming(event) {
     log("Received 'incoming' call event.");
     incomingCall = event.call;
     ok(incomingCall);
-    is(incomingCall.number, inNumber);
+    is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     // Should be two calls now
     is(telephony.calls.length, 2);
     is(telephony.calls[0], outgoingCall);
     is(telephony.calls[1], incomingCall);
 
     emulator.run("gsm list", function(result) {