Bug 1077075 - Part 7: Update the related testcases. r=aknow

--HG--
extra : histedit_source : 2c3bb8557f1c127c0c55986296490013245a8110
This commit is contained in:
Ben Hsu 2014-12-24 02:32:00 -05:00
Родитель 24229edf18
Коммит 57787a71e8
3 изменённых файлов: 31 добавлений и 15 удалений

Просмотреть файл

@ -520,7 +520,8 @@ let emulator = (function() {
promises.push(promise);
}
call.answer();
promise = call.answer();
promises.push(promise);
return Promise.all(promises).then(() => call);
}
@ -535,12 +536,16 @@ let emulator = (function() {
function hold(call) {
log("Putting the call on hold.");
let promises = [];
let promise = waitForNamedStateEvent(call, "holding")
.then(() => waitForNamedStateEvent(call, "held"));
promises.push(promise);
call.hold();
promise = call.hold();
promises.push(promise);
return promise;
return Promise.all(promises).then(() => call);
}
/**
@ -553,12 +558,16 @@ let emulator = (function() {
function resume(call) {
log("Resuming the held call.");
let promises = [];
let promise = waitForNamedStateEvent(call, "resuming")
.then(() => waitForNamedStateEvent(call, "connected"));
promises.push(promise);
call.resume();
promise = call.resume();
promises.push(promise);
return promise;
return Promise.all(promises).then(() => call);
}
/**
@ -571,12 +580,16 @@ let emulator = (function() {
function hangUp(call) {
log("Local hanging up the call: " + call.id.number);
let promises = [];
let promise = waitForNamedStateEvent(call, "disconnecting")
.then(() => waitForNamedStateEvent(call, "disconnected"));
promises.push(promise);
call.hangUp();
promise = call.hangUp();
promises.push(promise);
return promise;
return Promise.all(promises).then(() => call);
}
/**

Просмотреть файл

@ -15,9 +15,11 @@ function incoming() {
}
function connecting() {
let promise = gWaitForNamedStateEvent(inCall, "connecting");
inCall.answer();
return promise;
let promises = [
gWaitForNamedStateEvent(inCall, "connecting"),
inCall.answer()
];
return Promise.all(promises).then(() => inCall);
}
function hangUp() {

Просмотреть файл

@ -18,12 +18,13 @@ function checkUnexpected(msg, call, event1, event2, actionCallback) {
call.addEventListener(event1, error1);
call.addEventListener(event2, error2);
actionCallback();
return gDelay(2000).then(() => {
call.removeEventListener(event1, error1);
call.removeEventListener(event2, error2);
});
return actionCallback().then(
() => ok(false, msg + "should be rejected."),
() => gDelay(2000).then(() => {
call.removeEventListener(event1, error1);
call.removeEventListener(event2, error2);
}));
}
startTest(function() {