зеркало из https://github.com/mozilla/gecko-dev.git
Bug 990472 - Part 3: Test case. r=hsinyi
This commit is contained in:
Родитель
b6b83efb6c
Коммит
a7f1b68392
|
@ -384,6 +384,8 @@ let emulator = (function() {
|
|||
checkEventCallState(event, call, "alerting");
|
||||
deferred.resolve(call);
|
||||
};
|
||||
}, cause => {
|
||||
deferred.reject(cause);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
|
@ -443,6 +445,38 @@ let emulator = (function() {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hold a call.
|
||||
*
|
||||
* @param call
|
||||
* A TelephonyCall object.
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function hold(call) {
|
||||
log("Putting the call on hold.");
|
||||
|
||||
let deferred = Promise.defer();
|
||||
|
||||
let gotHolding = false;
|
||||
call.onholding = function onholding(event) {
|
||||
log("Received 'holding' call event");
|
||||
call.onholding = null;
|
||||
checkEventCallState(event, call, "holding");
|
||||
gotHolding = true;
|
||||
};
|
||||
|
||||
call.onheld = function onheld(event) {
|
||||
log("Received 'held' call event");
|
||||
call.onheld = null;
|
||||
checkEventCallState(event, call, "held");
|
||||
ok(gotHolding);
|
||||
deferred.resolve(call);
|
||||
};
|
||||
call.hold();
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulate an incoming call.
|
||||
*
|
||||
|
@ -1038,6 +1072,7 @@ let emulator = (function() {
|
|||
this.gCheckAll = checkAll;
|
||||
this.gDial = dial;
|
||||
this.gAnswer = answer;
|
||||
this.gHold = hold;
|
||||
this.gRemoteDial = remoteDial;
|
||||
this.gRemoteAnswer = remoteAnswer;
|
||||
this.gRemoteHangUp = remoteHangUp;
|
||||
|
|
|
@ -56,3 +56,4 @@ disabled = Bug 821958
|
|||
[test_conference_two_remove_one.js]
|
||||
[test_conference_three_hangup_one.js]
|
||||
[test_conference_three_remove_one.js]
|
||||
[test_outgoing_when_two_calls_on_line.js]
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = 'head.js';
|
||||
|
||||
function testReject3rdCall() {
|
||||
let outCall1;
|
||||
let outCall2;
|
||||
|
||||
return gDial("0912345001")
|
||||
.then(call => { outCall1 = call; })
|
||||
.then(() => gRemoteAnswer(outCall1))
|
||||
.then(() => gHold(outCall1))
|
||||
.then(() => gDial("0912345002"))
|
||||
.then(call => { outCall2 = call; })
|
||||
.then(() => gRemoteAnswer(outCall2))
|
||||
.then(() => gDial("0912345003"))
|
||||
.then(call => {
|
||||
ok(false, "The dial request should be rejected");
|
||||
}, cause => {
|
||||
log("Reject 3rd call, cuase: " + cause);
|
||||
is(cause, "InvalidStateError");
|
||||
})
|
||||
.then(() => gRemoteHangUpCalls([outCall1, outCall2]));
|
||||
}
|
||||
|
||||
startTest(function() {
|
||||
testReject3rdCall()
|
||||
.then(null, () => {
|
||||
ok(false, 'promise rejects during test.');
|
||||
})
|
||||
.then(finish);
|
||||
});
|
Загрузка…
Ссылка в новой задаче