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

This commit is contained in:
Ben Hsu 2015-01-08 04:52:00 -05:00
Родитель 7fd3b4c5e1
Коммит 91f10c5c8b
4 изменённых файлов: 25 добавлений и 22 удалений

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

@ -678,11 +678,9 @@ let emulator = (function() {
* @param connectedCallback [optional]
* A callback function which is called when conference state becomes
* connected.
* @param twice [optional]
* To send conference request twice. It is only used for special test.
* @return Promise<[TelephonyCall ...]>
*/
function addCallsToConference(callsToAdd, connectedCallback, twice) {
function addCallsToConference(callsToAdd, connectedCallback) {
log("Add " + callsToAdd.length + " calls into conference.");
let promises = [];
@ -703,13 +701,12 @@ let emulator = (function() {
promises.push(promise);
// Cannot use apply() through webidl, so just separate the cases to handle.
let requestCount = twice ? 2 : 1;
for (let i = 0; i < requestCount; ++i) {
if (callsToAdd.length == 2) {
conference.add(callsToAdd[0], callsToAdd[1]);
} else {
conference.add(callsToAdd[0]);
}
if (callsToAdd.length == 2) {
promise = conference.add(callsToAdd[0], callsToAdd[1]);
promises.push(promise);
} else {
promise = conference.add(callsToAdd[0]);
promises.push(promise);
}
return Promise.all(promises).then(() => conference.calls);
@ -745,7 +742,7 @@ let emulator = (function() {
});
promises.push(promise);
conference.hold();
promises.push(conference.hold());
return Promise.all(promises).then(() => conference.calls);
}
@ -780,7 +777,7 @@ let emulator = (function() {
});
promises.push(promise);
conference.resume();
promises.push(conference.resume());
return Promise.all(promises).then(() => conference.calls);
}
@ -837,7 +834,7 @@ let emulator = (function() {
});
promises.push(promise);
conference.remove(callToRemove);
promises.push(conference.remove(callToRemove));
return Promise.all(promises)
.then(() => checkCalls(conference.calls, remainedCalls))

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

@ -17,9 +17,11 @@ function handleConferenceAddError(callToAdd) {
deferred.resolve();
};
conference.add(callToAdd);
return deferred.promise;
return conference.add(callToAdd)
.then(() => ok(false, "|conference.add| should be rejected"),
() => log("|conference.add| is rejected as expected"))
.then(() => deferred.promise);
}
function testConferenceAddError() {

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

@ -14,8 +14,6 @@ function testConferenceTwoCallsTwice() {
let outInfo = gOutCallStrPool(outNumber);
let inInfo = gInCallStrPool(inNumber);
let sendConferenceTwice = true;
return Promise.resolve()
.then(gCheckInitialState)
.then(() => gDial(outNumber))
@ -31,8 +29,12 @@ function testConferenceTwoCallsTwice() {
.then(() => gCheckAll(inCall, [outCall, inCall], '', [],
[outInfo.held, inInfo.active]))
.then(() => gAddCallsToConference([outCall, inCall], function() {
gCheckState(conference, [], 'connected', [outCall, inCall]);
}, sendConferenceTwice))
gCheckState(conference,
[], 'connected',
[outCall, inCall]); }))
.then(() => conference.add(outCall, inCall))
.then(() => ok(false, "The second |conference.add()| should be rejected"),
() => log("The second |conference.add()| is rejected as expected"))
.then(() => gCheckAll(conference, [], 'connected', [outCall, inCall],
[outInfo.active, inInfo.active]))
.then(() => gRemoteHangUpCalls([outCall, inCall]));

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

@ -16,10 +16,12 @@ function handleConferenceRemoveError(callToRemove) {
is(evt.name, 'removeError', 'conference removeError');
deferred.resolve();
}
conference.remove(callToRemove);
};
return deferred.promise;
return conference.remove(callToRemove)
.then(() => ok(false, "|conference.remove()| should be rejected"),
() => log("|conference.remove()| is rejected as expected"))
.then(() => deferred.promise);
}
function testConferenceRemoveError() {