dom/telephony/test/marionette/test_conference_remove_error.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/ */
     4 MARIONETTE_TIMEOUT = 60000;
     5 MARIONETTE_HEAD_JS = 'head.js';
     7 function handleConferenceRemoveError(callToRemove) {
     8   log('Handle conference remove error.');
    10   let deferred = Promise.defer();
    12   conference.onerror = function(evt) {
    13     log('Receiving a conference error event.');
    14     conference.onerror = null;
    16     is(evt.name, 'removeError', 'conference removeError');
    18     deferred.resolve();
    19   }
    20   conference.remove(callToRemove);
    22   return deferred.promise;
    23 }
    25 function testConferenceRemoveError() {
    26   log('= testConferenceRemoveError =');
    28   let outCall;
    29   let inCall;
    30   let inCall2;
    31   let outNumber = "5555550101";
    32   let inNumber  = "5555550201";
    33   let inNumber2 = "5555550202";
    34   let outInfo = gOutCallStrPool(outNumber);
    35   let inInfo = gInCallStrPool(inNumber);
    36   let inInfo2 = gInCallStrPool(inNumber2);
    38   return Promise.resolve()
    39     .then(() => gSetupConferenceTwoCalls(outNumber, inNumber))
    40     .then(calls => {
    41       [outCall, inCall] = calls;
    42     })
    43     .then(() => gRemoteDial(inNumber2))
    44     .then(call => {inCall2 = call;})
    45     .then(() => gCheckAll(conference, [inCall2], 'connected', [outCall, inCall],
    46                           [outInfo.active, inInfo.active, inInfo2.incoming]))
    47     .then(() => gAnswer(inCall2, function() {
    48       gCheckState(inCall2, [inCall2], 'held', [outCall, inCall]);
    49     }))
    50     .then(() => gCheckAll(inCall2, [inCall2], 'held', [outCall, inCall],
    51                           [outInfo.held, inInfo.held, inInfo2.active]))
    52     .then(() => gResumeConference([outCall, inCall], function() {
    53       gCheckState(conference, [inCall2], 'connected', [outCall, inCall]);
    54     }))
    55     // Not allowed to remove a call when there are one connected and one held
    56     // calls.
    57     .then(() => handleConferenceRemoveError(outCall))
    58     .then(() => gRemoteHangUpCalls([outCall, inCall, inCall2]));
    59 }
    61 // Start the test
    62 startTest(function() {
    63   testConferenceRemoveError()
    64     .then(null, error => {
    65       ok(false, 'promise rejects during test.');
    66     })
    67     .then(finish);
    68 });

mercurial