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.
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 let number = "5555552368";
8 let outgoing;
10 function dial() {
11 log("Make an outgoing call.");
13 telephony.dial(number).then(call => {
14 outgoing = call;
15 ok(outgoing);
16 is(outgoing.number, number);
17 is(outgoing.state, "dialing");
19 is(outgoing, telephony.active);
20 is(telephony.calls.length, 1);
21 is(telephony.calls[0], outgoing);
23 outgoing.onalerting = function onalerting(event) {
24 log("Received 'onalerting' call event.");
25 is(outgoing, event.call);
26 is(outgoing.state, "alerting");
28 emulator.run("gsm list", function(result) {
29 log("Call list is now: " + result);
30 is(result[0], "outbound to " + number + " : ringing");
31 is(result[1], "OK");
32 reject();
33 });
34 };
35 });
36 }
38 function reject() {
39 log("Reject the outgoing call on the other end.");
40 // We get no "disconnecting" event when the remote party rejects the call.
42 outgoing.ondisconnected = function ondisconnected(event) {
43 log("Received 'disconnected' call event.");
44 is(outgoing, event.call);
45 is(outgoing.state, "disconnected");
47 is(telephony.active, null);
48 is(telephony.calls.length, 0);
50 // Wait for emulator to catch up before continuing
51 waitFor(verifyCallList,function() {
52 return(rcvdEmulatorCallback);
53 });
54 };
56 let rcvdEmulatorCallback = false;
57 emulator.run("gsm cancel " + number, function(result) {
58 is(result[0], "OK", "emulator callback");
59 rcvdEmulatorCallback = true;
60 });
61 }
63 function verifyCallList(){
64 emulator.run("gsm list", function(result) {
65 log("Call list is now: " + result);
66 is(result[0], "OK");
67 cleanUp();
68 });
69 }
71 function cleanUp() {
72 finish();
73 }
75 startTest(function() {
76 dial();
77 });