Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | * http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | MARIONETTE_TIMEOUT = 60000; |
michael@0 | 5 | MARIONETTE_HEAD_JS = 'head.js'; |
michael@0 | 6 | |
michael@0 | 7 | function muxModem(id) { |
michael@0 | 8 | let deferred = Promise.defer(); |
michael@0 | 9 | |
michael@0 | 10 | emulator.run("mux modem " + id, function() { |
michael@0 | 11 | deferred.resolve(); |
michael@0 | 12 | }); |
michael@0 | 13 | |
michael@0 | 14 | return deferred.promise; |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | function testNewCallWhenOtherConnectionInUse(firstServiceId, secondServiceId) { |
michael@0 | 18 | log("= testNewCallWhenOtherConnectionInUse ="); |
michael@0 | 19 | log("1st call on " + firstServiceId + ", 2nd call on " + secondServiceId); |
michael@0 | 20 | |
michael@0 | 21 | let outCall; |
michael@0 | 22 | |
michael@0 | 23 | return Promise.resolve() |
michael@0 | 24 | .then(() => muxModem(firstServiceId)) |
michael@0 | 25 | .then(() => { |
michael@0 | 26 | return telephony.dial("0912345000", firstServiceId); |
michael@0 | 27 | }) |
michael@0 | 28 | .then(call => { |
michael@0 | 29 | outCall = call; |
michael@0 | 30 | is(outCall.serviceId, firstServiceId); |
michael@0 | 31 | }) |
michael@0 | 32 | .then(() => gRemoteAnswer(outCall)) |
michael@0 | 33 | .then(() => { |
michael@0 | 34 | return telephony.dial("0912345001", secondServiceId); |
michael@0 | 35 | }) |
michael@0 | 36 | .then(() => { |
michael@0 | 37 | log("The promise should not be resolved"); |
michael@0 | 38 | ok(false); |
michael@0 | 39 | }, cause => { |
michael@0 | 40 | is(cause, "OtherConnectionInUse"); |
michael@0 | 41 | }) |
michael@0 | 42 | .then(() => gRemoteHangUp(outCall)); |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | startDSDSTest(function() { |
michael@0 | 46 | testNewCallWhenOtherConnectionInUse(0, 1) |
michael@0 | 47 | .then(() => testNewCallWhenOtherConnectionInUse(1, 0)) |
michael@0 | 48 | .then(() => muxModem(0)) |
michael@0 | 49 | .then(null, () => { |
michael@0 | 50 | ok(false, "promise rejects during test."); |
michael@0 | 51 | }) |
michael@0 | 52 | .then(finish); |
michael@0 | 53 | }); |