diff -r 000000000000 -r 6474c204b198 dom/telephony/test/marionette/test_dsds_connection_conflict.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dom/telephony/test/marionette/test_dsds_connection_conflict.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,53 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 60000; +MARIONETTE_HEAD_JS = 'head.js'; + +function muxModem(id) { + let deferred = Promise.defer(); + + emulator.run("mux modem " + id, function() { + deferred.resolve(); + }); + + return deferred.promise; +} + +function testNewCallWhenOtherConnectionInUse(firstServiceId, secondServiceId) { + log("= testNewCallWhenOtherConnectionInUse ="); + log("1st call on " + firstServiceId + ", 2nd call on " + secondServiceId); + + let outCall; + + return Promise.resolve() + .then(() => muxModem(firstServiceId)) + .then(() => { + return telephony.dial("0912345000", firstServiceId); + }) + .then(call => { + outCall = call; + is(outCall.serviceId, firstServiceId); + }) + .then(() => gRemoteAnswer(outCall)) + .then(() => { + return telephony.dial("0912345001", secondServiceId); + }) + .then(() => { + log("The promise should not be resolved"); + ok(false); + }, cause => { + is(cause, "OtherConnectionInUse"); + }) + .then(() => gRemoteHangUp(outCall)); +} + +startDSDSTest(function() { + testNewCallWhenOtherConnectionInUse(0, 1) + .then(() => testNewCallWhenOtherConnectionInUse(1, 0)) + .then(() => muxModem(0)) + .then(null, () => { + ok(false, "promise rejects during test."); + }) + .then(finish); +});