dom/telephony/test/marionette/test_crash_emulator.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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 outNumber = "5555551111";
michael@0 8 let outgoingCall;
michael@0 9
michael@0 10 function dial() {
michael@0 11 log("Make an outgoing call.");
michael@0 12 telephony.dial(outNumber).then(call => {
michael@0 13 outgoingCall = call;
michael@0 14 outgoingCall.onalerting = function onalerting(event) {
michael@0 15 log("Received 'alerting' call event.");
michael@0 16 answer();
michael@0 17 };
michael@0 18 });
michael@0 19 }
michael@0 20
michael@0 21 function answer() {
michael@0 22 log("Answering the outgoing call.");
michael@0 23
michael@0 24 outgoingCall.onconnected = function onconnectedOut(event) {
michael@0 25 log("Received 'connected' call event for the original outgoing call.");
michael@0 26 // just some code to keep call active for awhile
michael@0 27 callStartTime = Date.now();
michael@0 28 waitFor(cleanUp,function() {
michael@0 29 callDuration = Date.now() - callStartTime;
michael@0 30 log("Waiting while call is active, call duration (ms): " + callDuration);
michael@0 31 return(callDuration >= 2000);
michael@0 32 });
michael@0 33 };
michael@0 34 emulator.run("gsm accept " + outNumber);
michael@0 35 }
michael@0 36
michael@0 37 function cleanUp(){
michael@0 38 outgoingCall.hangUp();
michael@0 39 ok("passed");
michael@0 40 finish();
michael@0 41 }
michael@0 42
michael@0 43 startTest(function() {
michael@0 44 dial();
michael@0 45 });

mercurial