Bug 1001343 - Part 2: A new testcase. r=aknow

This commit is contained in:
Ben Hsu 2015-03-02 00:08:00 -05:00
parent e1ea00b970
commit 0ce684afcd
2 changed files with 66 additions and 0 deletions

View File

@ -44,6 +44,7 @@ qemu = true
[test_outgoing_badNumber.js]
[test_outgoing_basic_operations.js]
[test_outgoing_busy.js]
[test_outgoing_from_stk.js]
[test_outgoing_onstatechange.js]
[test_outgoing_radio_off.js]
[test_outgoing_when_two_calls_on_line.js]

View File

@ -0,0 +1,65 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 90000;
MARIONETTE_HEAD_JS = 'head.js';
const outNumber = "5555552222";
const outInfo = gOutCallStrPool(outNumber);
let outCall;
// Basic functions
function outgoing() {
return gDialSTK(outNumber)
.then(call => outCall = call)
.then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.ringing]));
}
function localHangUp() {
return gHangUp(outCall)
.then(() => gCheckAll(null, [], "", [], []));
}
function remoteAnswer() {
return gRemoteAnswer(outCall)
.then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.active]));
}
function remoteHangUp() {
return gRemoteHangUp(outCall)
.then(() => gCheckAll(null, [], "", [], []));
}
// Sub tests
function testOutgoingLocalHangUp(){
log("= testOutgoingLocalHangUp =");
return outgoing()
.then(() => localHangUp());
}
function testOutgoingRemoteHangUp() {
log("= testOutgoingRemoteHangUp =");
return outgoing()
.then(() => remoteHangUp());
}
function testOutgoingRemoteAnswerRemoteHangUp() {
log("= testOutgoingRemoreAnswerRemoteHangUp =");
return outgoing()
.then(() => remoteAnswer())
.then(() => remoteHangUp());
}
// Main test
startTest(function() {
Promise.resolve()
.then(() => testOutgoingLocalHangUp())
.then(() => testOutgoingRemoteHangUp())
.then(() => testOutgoingRemoteAnswerRemoteHangUp())
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});