dom/telephony/test/marionette/test_dsds_connection_conflict.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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 muxModem(id) {
     8   let deferred = Promise.defer();
    10   emulator.run("mux modem " + id, function() {
    11     deferred.resolve();
    12   });
    14   return deferred.promise;
    15 }
    17 function testNewCallWhenOtherConnectionInUse(firstServiceId, secondServiceId) {
    18   log("= testNewCallWhenOtherConnectionInUse =");
    19   log("1st call on " + firstServiceId + ", 2nd call on " + secondServiceId);
    21   let outCall;
    23   return Promise.resolve()
    24     .then(() => muxModem(firstServiceId))
    25     .then(() => {
    26       return telephony.dial("0912345000", firstServiceId);
    27     })
    28     .then(call => {
    29       outCall = call;
    30       is(outCall.serviceId, firstServiceId);
    31     })
    32     .then(() => gRemoteAnswer(outCall))
    33     .then(() => {
    34       return telephony.dial("0912345001", secondServiceId);
    35     })
    36     .then(() => {
    37       log("The promise should not be resolved");
    38       ok(false);
    39     }, cause => {
    40       is(cause, "OtherConnectionInUse");
    41     })
    42     .then(() => gRemoteHangUp(outCall));
    43 }
    45 startDSDSTest(function() {
    46   testNewCallWhenOtherConnectionInUse(0, 1)
    47     .then(() => testNewCallWhenOtherConnectionInUse(1, 0))
    48     .then(() => muxModem(0))
    49     .then(null, () => {
    50       ok(false, "promise rejects during test.");
    51     })
    52     .then(finish);
    53 });

mercurial