Thu, 22 Jan 2015 13:21:57 +0100
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 let number = "5555552368";
8 let incoming;
9 let calls;
11 function simulateIncoming() {
12 log("Simulating an incoming call.");
14 telephony.onincoming = function onincoming(event) {
15 log("Received 'incoming' call event.");
16 incoming = event.call;
17 ok(incoming);
18 is(incoming.number, number);
19 is(incoming.state, "incoming");
21 //ok(telephony.calls === calls); // bug 717414
22 is(telephony.calls.length, 1);
23 is(telephony.calls[0], incoming);
25 emulator.run("gsm list", function(result) {
26 log("Call list is now: " + result);
27 is(result[0], "inbound from " + number + " : incoming");
28 is(result[1], "OK");
29 reject();
30 });
31 };
32 emulator.run("gsm call " + number);
33 }
35 function reject() {
36 log("Reject the incoming call.");
38 let gotDisconnecting = false;
39 incoming.ondisconnecting = function ondisconnecting(event) {
40 log("Received 'disconnecting' call event.");
41 is(incoming, event.call);
42 is(incoming.state, "disconnecting");
43 gotDisconnecting = true;
44 };
46 incoming.ondisconnected = function ondisconnected(event) {
47 log("Received 'disconnected' call event.");
48 is(incoming, event.call);
49 is(incoming.state, "disconnected");
50 ok(gotDisconnecting);
52 is(telephony.active, null);
53 is(telephony.calls.length, 0);
55 emulator.run("gsm list", function(result) {
56 log("Call list is now: " + result);
57 is(result[0], "OK");
58 cleanUp();
59 });
60 };
61 incoming.hangUp();
62 }
64 function cleanUp() {
65 telephony.onincoming = null;
66 finish();
67 }
69 startTest(function() {
70 simulateIncoming();
71 });