B2G/gecko/dom/telephony/test/marionette/test_swap_held_and_active.js
// Answer incoming call; original outgoing call should be held
Answer incoming call; original outgoing call should be held
Answer incoming call ; original outgoing call should be held
function answerIncoming() {
  log("Answering the incoming call.");
  let gotConnecting = false;
  incomingCall.onconnecting = function onconnectingIn(event) { 
    log("Received 'connecting' call event for incoming/2nd call.");
    is(incomingCall, event.call);
    is(incomingCall.state, "connecting");
    gotConnecting = true;
  };
  incomingCall.onconnected = function onconnectedIn(event) {
    log("Received 'connected' call event for incoming/2nd call.");
    is(incomingCall, event.call);
    ok(gotConnecting);
    is(incomingCall, telephony.active);
    is(outgoingCall.state, "held");
    is(incomingCall.state, "connected");
    runEmulatorCmd("gsm list", function(result) {
      log("Call list is now: " + result);
      is(result[0], "outbound to  " + outNumber + " : held");
      is(result[1], "inbound from " + inNumber + " : active");
      is(result[2], "OK");
      swapCalls();
    });
  };
  incomingCall.answer();
}
function answerIncoming ( ) { log ( "Answering the incoming call." ) ; let gotConnecting = false ; incomingCall . onconnecting = function onconnectingIn ( event ) { log ( "Received 'connecting' call event for incoming/2nd call." ) ; is ( incomingCall , event . call ) ; is ( incomingCall . state , "connecting" ) ; gotConnecting = true ; } ; incomingCall . onconnected = function onconnectedIn ( event ) { log ( "Received 'connected' call event for incoming/2nd call." ) ; is ( incomingCall , event . call ) ; ok ( gotConnecting ) ; is ( incomingCall , telephony . active ) ; is ( outgoingCall . state , "held" ) ; is ( incomingCall . state , "connected" ) ; runEmulatorCmd ( "gsm list" , function ( result ) { log ( "Call list is now: " + result ) ; is ( result [ 0 ] , "outbound to  " + outNumber + " : held" ) ; is ( result [ 1 ] , "inbound from " + inNumber + " : active" ) ; is ( result [ 2 ] , "OK" ) ; swapCalls ( ) ; } ) ; } ; incomingCall . answer ( ) ; }
Answer incoming call; original outgoing call should be held
Answer incoming call ; original outgoing call should be held
// Original outbound call now held, incoming call active