dom/telephony/test/marionette/test_crash_emulator.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:77ff9e9ebcaa
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 MARIONETTE_TIMEOUT = 60000;
5 MARIONETTE_HEAD_JS = 'head.js';
6
7 let outNumber = "5555551111";
8 let outgoingCall;
9
10 function dial() {
11 log("Make an outgoing call.");
12 telephony.dial(outNumber).then(call => {
13 outgoingCall = call;
14 outgoingCall.onalerting = function onalerting(event) {
15 log("Received 'alerting' call event.");
16 answer();
17 };
18 });
19 }
20
21 function answer() {
22 log("Answering the outgoing call.");
23
24 outgoingCall.onconnected = function onconnectedOut(event) {
25 log("Received 'connected' call event for the original outgoing call.");
26 // just some code to keep call active for awhile
27 callStartTime = Date.now();
28 waitFor(cleanUp,function() {
29 callDuration = Date.now() - callStartTime;
30 log("Waiting while call is active, call duration (ms): " + callDuration);
31 return(callDuration >= 2000);
32 });
33 };
34 emulator.run("gsm accept " + outNumber);
35 }
36
37 function cleanUp(){
38 outgoingCall.hangUp();
39 ok("passed");
40 finish();
41 }
42
43 startTest(function() {
44 dial();
45 });

mercurial