B2G/gecko/dom/telephony/test/marionette/test_swap_held_and_active.js
// With one call on hold, simulate an incoming call
With one call on hold, simulate an incoming call
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.state, "incoming");
    is(telephony.calls.length, 2);
    is(telephony.calls[0], outgoingCall);
    is(telephony.calls[1], incomingCall);
    runEmulatorCmd("gsm list", function(result) {
      log("Call list is now: " + result);
      is(result[0], "outbound to  " + outNumber + " : held");
      is(result[1], "inbound from " + inNumber + " : incoming");
      is(result[2], "OK");
      answerIncoming();
    });
  };
  runEmulatorCmd("gsm call " + inNumber);
}
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 . state , "incoming" ) ; is ( telephony . calls . length , 2 ) ; is ( telephony . calls [ 0 ] , outgoingCall ) ; is ( telephony . calls [ 1 ] , incomingCall ) ; runEmulatorCmd ( "gsm list" , function ( result ) { log ( "Call list is now: " + result ) ; is ( result [ 0 ] , "outbound to  " + outNumber + " : held" ) ; is ( result [ 1 ] , "inbound from " + inNumber + " : incoming" ) ; is ( result [ 2 ] , "OK" ) ; answerIncoming ( ) ; } ) ; } ; runEmulatorCmd ( "gsm call " + inNumber ) ; }
With one call on hold, simulate an incoming call
With one call on hold simulate an incoming call
// Should be two calls now