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 | let number = "5555552368"; |
michael@0 | 8 | let outgoing; |
michael@0 | 9 | |
michael@0 | 10 | function dial() { |
michael@0 | 11 | log("Make an outgoing call."); |
michael@0 | 12 | |
michael@0 | 13 | telephony.dial(number).then(call => { |
michael@0 | 14 | outgoing = call; |
michael@0 | 15 | ok(outgoing); |
michael@0 | 16 | is(outgoing.number, number); |
michael@0 | 17 | is(outgoing.state, "dialing"); |
michael@0 | 18 | |
michael@0 | 19 | is(outgoing, telephony.active); |
michael@0 | 20 | is(telephony.calls.length, 1); |
michael@0 | 21 | is(telephony.calls[0], outgoing); |
michael@0 | 22 | |
michael@0 | 23 | outgoing.onalerting = function onalerting(event) { |
michael@0 | 24 | log("Received 'onalerting' call event."); |
michael@0 | 25 | is(outgoing, event.call); |
michael@0 | 26 | is(outgoing.state, "alerting"); |
michael@0 | 27 | |
michael@0 | 28 | emulator.run("gsm list", function(result) { |
michael@0 | 29 | log("Call list is now: " + result); |
michael@0 | 30 | is(result[0], "outbound to " + number + " : ringing"); |
michael@0 | 31 | is(result[1], "OK"); |
michael@0 | 32 | busy(); |
michael@0 | 33 | }); |
michael@0 | 34 | }; |
michael@0 | 35 | }); |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | function busy() { |
michael@0 | 39 | log("The receiver is busy."); |
michael@0 | 40 | |
michael@0 | 41 | outgoing.onerror = function onerror(event) { |
michael@0 | 42 | log("Received 'error' call event."); |
michael@0 | 43 | is(outgoing, event.call); |
michael@0 | 44 | is(event.call.error.name, "BusyError"); |
michael@0 | 45 | |
michael@0 | 46 | emulator.run("gsm list", function(result) { |
michael@0 | 47 | log("Call list is now: " + result); |
michael@0 | 48 | is(result[0], "OK"); |
michael@0 | 49 | cleanUp(); |
michael@0 | 50 | }); |
michael@0 | 51 | }; |
michael@0 | 52 | |
michael@0 | 53 | emulator.run("gsm busy " + number); |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | function cleanUp() { |
michael@0 | 57 | finish(); |
michael@0 | 58 | } |
michael@0 | 59 | |
michael@0 | 60 | startTest(function() { |
michael@0 | 61 | dial(); |
michael@0 | 62 | }); |