2012-11-21 18:39:42 -08:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
2013-04-09 09:02:51 -07:00
|
|
|
MARIONETTE_TIMEOUT = 60000;
|
2013-10-01 23:27:52 -07:00
|
|
|
MARIONETTE_HEAD_JS = 'head.js';
|
2012-11-21 18:39:42 -08:00
|
|
|
|
|
|
|
let outNumber = "5555551111";
|
|
|
|
let outgoingCall;
|
|
|
|
|
|
|
|
function dial() {
|
|
|
|
log("Make an outgoing call.");
|
|
|
|
outgoingCall = telephony.dial(outNumber);
|
|
|
|
|
|
|
|
outgoingCall.onalerting = function onalerting(event) {
|
|
|
|
log("Received 'alerting' call event.");
|
|
|
|
answer();
|
2013-09-18 00:44:08 -07:00
|
|
|
};
|
2012-11-21 18:39:42 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
function answer() {
|
|
|
|
log("Answering the outgoing call.");
|
|
|
|
|
|
|
|
outgoingCall.onconnected = function onconnectedOut(event) {
|
|
|
|
log("Received 'connected' call event for the original outgoing call.");
|
|
|
|
// just some code to keep call active for awhile
|
|
|
|
callStartTime = Date.now();
|
|
|
|
waitFor(cleanUp,function() {
|
|
|
|
callDuration = Date.now() - callStartTime;
|
|
|
|
log("Waiting while call is active, call duration (ms): " + callDuration);
|
|
|
|
return(callDuration >= 2000);
|
|
|
|
});
|
|
|
|
};
|
2013-10-01 23:27:52 -07:00
|
|
|
emulator.run("gsm accept " + outNumber);
|
2012-11-21 18:39:42 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
function cleanUp(){
|
|
|
|
outgoingCall.hangUp();
|
|
|
|
ok("passed");
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
|
2013-10-01 23:27:52 -07:00
|
|
|
startTest(function() {
|
2013-10-28 02:22:44 -07:00
|
|
|
dial();
|
2013-10-01 23:27:52 -07:00
|
|
|
});
|