B2G/gecko/dom/telephony/test/marionette/test_swap_held_and_active.js
// Now swap the held and active calls
Now swap the held and active calls
Now swap the held and active calls
function swapCalls() {
  log("Swapping the held and active calls.");
  incomingCall.onheld = function onheldIn(event) {
    log("Received 'held' call event for incoming call.");
    gotHeld = true;
    if (gotHeld && gotConnected) { verifySwap(); }
  };
  let gotResuming = false;
  outgoingCall.onresuming = function onresuming(event) {
    log("Received 'resuming' call event for outbound call.");
    is(outgoingCall, event.call);
    is(outgoingCall.state, "resuming");
    gotResuming = true;
  };
  outgoingCall.onconnected = function onconnected(event) {
    log("Received 'connected' call event for outbound call.");
    is(outgoingCall, event.call);
    ok(gotResuming);
    is(outgoingCall, telephony.active);
    is(telephony.calls.length, 2);
    is(telephony.calls[0], outgoingCall);
    is(telephony.calls[1], incomingCall);
    gotConnected = true;
    if (gotHeld && gotConnected) { verifySwap(); }
  };
  outgoingCall.resume();     
}
function swapCalls ( ) { log ( "Swapping the held and active calls." ) ; incomingCall . onheld = function onheldIn ( event ) { log ( "Received 'held' call event for incoming call." ) ; gotHeld = true ; if ( gotHeld && gotConnected ) { verifySwap ( ) ; } } ; let gotResuming = false ; outgoingCall . onresuming = function onresuming ( event ) { log ( "Received 'resuming' call event for outbound call." ) ; is ( outgoingCall , event . call ) ; is ( outgoingCall . state , "resuming" ) ; gotResuming = true ; } ; outgoingCall . onconnected = function onconnected ( event ) { log ( "Received 'connected' call event for outbound call." ) ; is ( outgoingCall , event . call ) ; ok ( gotResuming ) ; is ( outgoingCall , telephony . active ) ; is ( telephony . calls . length , 2 ) ; is ( telephony . calls [ 0 ] , outgoingCall ) ; is ( telephony . calls [ 1 ] , incomingCall ) ; gotConnected = true ; if ( gotHeld && gotConnected ) { verifySwap ( ) ; } } ; outgoingCall . resume ( ) ; }
Now swap the held and active calls
Now swap the held and active calls
// Swap calls by resuming the held (outgoing) call. Will force active // (incoming) call to hold.