зеркало из https://github.com/mozilla/gecko-dev.git
Bug 943275 - correct test_conference.js. r=aknow
This commit is contained in:
Родитель
4fd1e475bc
Коммит
76d1b18d49
|
@ -122,10 +122,32 @@ function dial(number) {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
function answer(call) {
|
||||
// Answering an incoming call could trigger conference state change.
|
||||
function answer(call, conferenceStateChangeCallback) {
|
||||
log("Answering the incoming call.");
|
||||
|
||||
let deferred = Promise.defer();
|
||||
let done = function() {
|
||||
deferred.resolve(call);
|
||||
};
|
||||
|
||||
let pending = ["call.onconnected"];
|
||||
let receive = function(name) {
|
||||
receivedPending(name, pending, done);
|
||||
};
|
||||
|
||||
// When there's already a connected conference call, answering a new incoming
|
||||
// call triggers conference state change. We should wait for
|
||||
// |conference.onstatechange| before checking the state of the conference call.
|
||||
if (conference.state === "connected") {
|
||||
pending.push("conference.onstatechange");
|
||||
check_onstatechange(conference, "conference", "held", function() {
|
||||
if (typeof conferenceStateChangeCallback === "function") {
|
||||
conferenceStateChangeCallback();
|
||||
}
|
||||
receive("conference.onstatechange");
|
||||
});
|
||||
}
|
||||
|
||||
call.onconnecting = function onconnectingIn(event) {
|
||||
log("Received 'connecting' call event for incoming call.");
|
||||
|
@ -138,7 +160,7 @@ function answer(call) {
|
|||
call.onconnected = null;
|
||||
checkEventCallState(event, call, "connected");
|
||||
ok(!call.onconnecting);
|
||||
deferred.resolve(call);
|
||||
receive("call.onconnected");
|
||||
};
|
||||
call.answer();
|
||||
|
||||
|
@ -592,7 +614,9 @@ function setupConferenceThreeCalls(outNumber, inNumber, inNumber2) {
|
|||
.then(call => { inCall2 = call; })
|
||||
.then(() => checkAll(conference, [inCall2], 'connected', [outCall, inCall],
|
||||
[outInfo.active, inInfo.active, inInfo2.incoming]))
|
||||
.then(() => answer(inCall2))
|
||||
.then(() => answer(inCall2, function() {
|
||||
checkState(inCall2, [inCall2], 'held', [outCall, inCall]);
|
||||
}))
|
||||
.then(() => checkAll(inCall2, [inCall2], 'held', [outCall, inCall],
|
||||
[outInfo.held, inInfo.held, inInfo2.active]))
|
||||
.then(() => addCallsToConference([inCall2], function() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче