Backed out changeset db71d2354a77 (bug 981519) for causing regression bug 1026081

This commit is contained in:
Hsin-Yi Tsai 2014-06-17 15:37:31 +08:00
Родитель 226e74fe40
Коммит d9545eeb3d
33 изменённых файлов: 51 добавлений и 187 удалений

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

@ -288,38 +288,6 @@ let emulator = (function() {
};
}
/**
* Convenient helper to check the expected call number and name.
*
* @param number
* A string sent to modem.
* @param numberPresentation
* An unsigned short integer sent to modem.
* @param name
* A string sent to modem.
* @param namePresentation
* An unsigned short integer sent to modem.
* @param receivedNumber
* A string exposed by Telephony API.
* @param receivedName
* A string exposed by Telephony API.
*/
function checkCallId(number, numberPresentation, name, namePresentation,
receivedNumber, receivedName) {
let expectedNum = !numberPresentation ? number : "";
is(receivedNumber, expectedNum, "check number per numberPresentation");
let expectedName;
if (numberPresentation) {
expectedName = "";
} else if (!namePresentation) {
expectedName = name ? name : "";
} else {
expectedName = "";
}
is(receivedName, expectedName, "check name per number/namePresentation");
}
/**
* Convenient helper to check the call list existing in the emulator.
*
@ -426,7 +394,7 @@ let emulator = (function() {
telephony.dial(number, serviceId).then(call => {
ok(call);
is(call.id.number, number);
is(call.number, number);
is(call.state, "dialing");
is(call.serviceId, serviceId);
@ -529,41 +497,14 @@ let emulator = (function() {
return deferred.promise;
}
/**
* Locally hang up a call.
*
* @param call
* A TelephonyCall object.
* @return A deferred promise.
*/
function hangUp(call) {
let deferred = Promise.defer();
call.ondisconnected = function(event) {
log("Received 'disconnected' call event");
call.ondisconnected = null;
checkEventCallState(event, call, "disconnected");
deferred.resolve(call);
};
call.hangUp();
return deferred.promise;
}
/**
* Simulate an incoming call.
*
* @param number
* A string.
* @param numberPresentation [optional]
* An unsigned short integer.
* @param name [optional]
* A string.
* @param namePresentation [optional]
* An unsigned short integer.
* @return A deferred promise.
*/
function remoteDial(number, numberPresentation, name, namePresentation) {
function remoteDial(number) {
log("Simulating an incoming call.");
let deferred = Promise.defer();
@ -575,17 +516,13 @@ let emulator = (function() {
let call = event.call;
ok(call);
is(call.number, number);
is(call.state, "incoming");
checkCallId(number, numberPresentation, name, namePresentation,
call.id.number, call.id.name);
deferred.resolve(call);
};
emulator.run("gsm call " + number);
numberPresentation = numberPresentation || "";
name = name || "";
namePresentation = namePresentation || "";
emulator.run("gsm call " + number + "," + numberPresentation + "," + name +
"," + namePresentation);
return deferred.promise;
}
@ -607,7 +544,7 @@ let emulator = (function() {
checkEventCallState(event, call, "connected");
deferred.resolve(call);
};
emulator.run("gsm accept " + call.id.number);
emulator.run("gsm accept " + call.number);
return deferred.promise;
}
@ -630,7 +567,7 @@ let emulator = (function() {
checkEventCallState(event, call, "disconnected");
deferred.resolve(call);
};
emulator.run("gsm cancel " + call.id.number);
emulator.run("gsm cancel " + call.number);
return deferred.promise;
}
@ -679,7 +616,7 @@ let emulator = (function() {
let check_onconnected = StateEventChecker('connected', 'onresuming');
for (let call of callsToAdd) {
let callName = "callToAdd (" + call.id.number + ')';
let callName = "callToAdd (" + call.number + ')';
let ongroupchange = callName + ".ongroupchange";
pending.push(ongroupchange);
@ -740,7 +677,7 @@ let emulator = (function() {
let check_onheld = StateEventChecker('held', 'onholding');
for (let call of calls) {
let callName = "call (" + call.id.number + ')';
let callName = "call (" + call.number + ')';
let onholding = callName + ".onholding";
pending.push(onholding);
@ -793,7 +730,7 @@ let emulator = (function() {
let check_onconnected = StateEventChecker('connected', 'onresuming');
for (let call of calls) {
let callName = "call (" + call.id.number + ')';
let callName = "call (" + call.number + ')';
let onresuming = callName + ".onresuming";
pending.push(onresuming);
@ -852,7 +789,7 @@ let emulator = (function() {
// Remained call in conference will be held.
for (let call of remainedCalls) {
let callName = "remainedCall (" + call.id.number + ')';
let callName = "remainedCall (" + call.number + ')';
let onstatechange = callName + ".onstatechange";
pending.push(onstatechange);
@ -863,7 +800,7 @@ let emulator = (function() {
// When a call is removed from conference with 2 calls, another one will be
// automatically removed from group and be put on hold.
for (let call of autoRemovedCalls) {
let callName = "autoRemovedCall (" + call.id.number + ')';
let callName = "autoRemovedCall (" + call.number + ')';
let ongroupchange = callName + ".ongroupchange";
pending.push(ongroupchange);
@ -936,7 +873,7 @@ let emulator = (function() {
// When a call is hang up from conference with 2 calls, another one will be
// automatically removed from group.
for (let call of autoRemovedCalls) {
let callName = "autoRemovedCall (" + call.id.number + ')';
let callName = "autoRemovedCall (" + call.number + ')';
let ongroupchange = callName + ".ongroupchange";
pending.push(ongroupchange);
@ -1025,8 +962,8 @@ let emulator = (function() {
function createCallAndAddToConference(inNumber, conferenceCalls) {
// Create an info array. allInfo = [info1, info2, ...].
let allInfo = conferenceCalls.map(function(call, i) {
return (i === 0) ? outCallStrPool(call.id.number)
: inCallStrPool(call.id.number);
return (i === 0) ? outCallStrPool(call.number)
: inCallStrPool(call.number);
});
// Define state property of the info array.
@ -1105,7 +1042,6 @@ let emulator = (function() {
this.gCheckAll = checkAll;
this.gDial = dial;
this.gAnswer = answer;
this.gHangUp = hangUp;
this.gHold = hold;
this.gRemoteDial = remoteDial;
this.gRemoteAnswer = remoteAnswer;

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

@ -57,4 +57,3 @@ disabled = Bug 821958
[test_conference_three_hangup_one.js]
[test_conference_three_remove_one.js]
[test_outgoing_when_two_calls_on_line.js]
[test_call_presentation.js]

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

@ -1,71 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = 'head.js';
const ALLOWED = 0;
const RESTRICTED = 1;
const UNKNOWN = 2;
const PAYPHONE =3;
function getPresentationStr(presentation) {
let str;
switch (presentation) {
case ALLOWED:
str = "allowed";
break;
case RESTRICTED:
str = "restricted";
break;
case UNKNOWN:
str = "unknown";
break;
case PAYPHONE:
str = "payphone";
break;
}
return str;
}
function getNamePresentation(numberPresentation, namePresentation) {
// See TS 23.096 Figure 3a and Annex A Note 1.
if (!numberPresentation) {
if (namePresentation == undefined) {
namePresentation = ALLOWED;
}
} else {
namePresentation = ALLOWED;
}
return getPresentationStr(namePresentation);
}
function test(number, numberPresentation, name, namePresentation) {
return gRemoteDial(number, numberPresentation, name, namePresentation)
.then(call => {
is(call.id.numberPresentation, getPresentationStr(numberPresentation),
"check numberPresentation");
is(call.id.namePresentation,
getNamePresentation(numberPresentation, namePresentation),
"check namePresentation");
return call;
})
.then(gHangUp);
}
startTest(function() {
let inNumber = "5555550201";
Promise.resolve()
.then(() => test(inNumber, ALLOWED))
.then(() => test(inNumber, RESTRICTED))
.then(() => test(inNumber, UNKNOWN))
.then(() => test(inNumber, PAYPHONE))
.then(() => test(inNumber, ALLOWED, "TestName"))
.then(() => test(inNumber, ALLOWED, "TestName", ALLOWED))
.then(() => test(inNumber, ALLOWED, "TestName", RESTRICTED))
.then(() => test(inNumber, ALLOWED, "TestName", UNKNOWN))
.then(() => test(inNumber, RESTRICTED, "TestName", ALLOWED))
.then(() => test(inNumber, RESTRICTED, "TestName", RESTRICTED))
.then(() => test(inNumber, RESTRICTED, "TestName", UNKNOWN))
.then(finish);
});

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

@ -14,7 +14,7 @@ function dial() {
telephony.dialEmergency(number).then(call => {
outgoing = call;
ok(outgoing);
is(outgoing.id.number, number);
is(outgoing.number, number);
is(outgoing.state, "dialing");
is(outgoing, telephony.active);

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

@ -15,7 +15,7 @@ function dial() {
telephony.dial(outNumber).then(call => {
outgoingCall = call;
ok(outgoingCall);
is(outgoingCall.id.number, outNumber);
is(outgoingCall.number, outNumber);
is(outgoingCall.state, "dialing");
is(outgoingCall, telephony.active);
@ -74,7 +74,7 @@ function simulateIncoming() {
log("Received 'incoming' call event.");
incomingCall = event.call;
ok(incomingCall);
is(incomingCall.id.number, inNumber);
is(incomingCall.number, inNumber);
is(incomingCall.state, "incoming");
// Should be two calls now

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

@ -15,7 +15,7 @@ function dial() {
telephony.dial(outNumber).then(call => {
outgoingCall = call;
ok(outgoingCall);
is(outgoingCall.id.number, outNumber);
is(outgoingCall.number, outNumber);
is(outgoingCall.state, "dialing");
is(outgoingCall, telephony.active);
@ -105,7 +105,7 @@ function simulateIncoming() {
log("Received 'incoming' call event.");
incomingCall = event.call;
ok(incomingCall);
is(incomingCall.id.number, inNumber);
is(incomingCall.number, inNumber);
is(incomingCall.state, "incoming");
// Should be two calls now

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

@ -15,7 +15,7 @@ function simulateIncoming() {
log("Received 'incoming' call event.");
incoming = event.call;
ok(incoming);
is(incoming.id.number, number);
is(incoming.number, number);
is(incoming.state, "incoming");
//ok(telephony.calls === calls); // bug 717414

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

@ -22,7 +22,7 @@ function simulateIncoming() {
incoming = event.call;
ok(incoming);
is(incoming.id.number, number);
is(incoming.number, number);
is(incoming.state, "incoming");
is(telephony.calls.length, 1);

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

@ -14,7 +14,7 @@ function simulateIncoming() {
log("Received 'incoming' call event.");
incomingCall = event.call;
ok(incomingCall);
is(incomingCall.id.number, inNumber);
is(incomingCall.number, inNumber);
is(incomingCall.state, "incoming");
is(telephony.calls.length, 1);

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

@ -14,7 +14,7 @@ function simulateIncoming() {
log("Received 'incoming' call event.");
incomingCall = event.call;
ok(incomingCall);
is(incomingCall.id.number, inNumber);
is(incomingCall.number, inNumber);
is(incomingCall.state, "incoming");
is(telephony.calls.length, 1);

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

@ -14,7 +14,7 @@ function simulateIncoming() {
log("Received 'incoming' call event.");
incomingCall = event.call;
ok(incomingCall);
is(incomingCall.id.number, inNumber);
is(incomingCall.number, inNumber);
is(incomingCall.state, "incoming");
is(telephony.calls.length, 1);

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

@ -14,7 +14,7 @@ function simulateIncoming() {
log("Received 'incoming' call event.");
incomingCall = event.call;
ok(incomingCall);
is(incomingCall.id.number, inNumber);
is(incomingCall.number, inNumber);
is(incomingCall.state, "incoming");
is(telephony.calls.length, 1);

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

@ -15,7 +15,7 @@ function simulateIncoming() {
log("Received 'incoming' call event.");
incomingCall = event.call;
ok(incomingCall);
is(incomingCall.id.number, number);
is(incomingCall.number, number);
is(incomingCall.state, "incoming");
is(telephony.calls.length, 1);

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

@ -14,7 +14,7 @@ function simulateIncoming() {
log("Received 'incoming' call event.");
incomingCall = event.call;
ok(incomingCall);
is(incomingCall.id.number, inNumber);
is(incomingCall.number, inNumber);
is(incomingCall.state, "incoming");
is(telephony.calls.length, 1);

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

@ -15,7 +15,7 @@ function simulateIncoming() {
log("Received 'incoming' call event.");
incoming = event.call;
ok(incoming);
is(incoming.id.number, number);
is(incoming.number, number);
is(incoming.state, "incoming");
//ok(telephony.calls === calls); // bug 717414

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

@ -14,7 +14,7 @@ function simulateIncoming() {
log("Received 'incoming' call event.");
incomingCall = event.call;
ok(incomingCall);
is(incomingCall.id.number, inNumber);
is(incomingCall.number, inNumber);
is(incomingCall.state, "incoming");
is(telephony.calls.length, 1);

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

@ -14,7 +14,7 @@ function simulateIncoming() {
log("Received 'incoming' call event.");
incomingCall = event.call;
ok(incomingCall);
is(incomingCall.id.number, inNumber);
is(incomingCall.number, inNumber);
is(incomingCall.state, "incoming");
is(telephony.calls.length, 1);

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

@ -16,7 +16,7 @@ function simulateIncoming() {
log("Received 'incoming' call event.");
incomingCall = event.call;
ok(incomingCall);
is(incomingCall.id.number, inNumber);
is(incomingCall.number, inNumber);
is(incomingCall.state, "incoming");
is(telephony.calls.length, 1);
@ -99,7 +99,7 @@ function dial() {
telephony.dial(outNumber).then(call => {
outgoingCall = call;
ok(outgoingCall);
is(outgoingCall.id.number, outNumber);
is(outgoingCall.number, outNumber);
is(outgoingCall.state, "dialing");
is(outgoingCall, telephony.active);
is(telephony.calls.length, 2);

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

@ -16,7 +16,7 @@ function simulateIncoming() {
log("Received 'incoming' call event.");
incomingCall = event.call;
ok(incomingCall);
is(incomingCall.id.number, inNumber);
is(incomingCall.number, inNumber);
is(incomingCall.state, "incoming");
is(telephony.calls.length, 1);
@ -112,7 +112,7 @@ function dial() {
telephony.dial(outNumber).then(call => {
outgoingCall = call;
ok(outgoingCall);
is(outgoingCall.id.number, outNumber);
is(outgoingCall.number, outNumber);
is(outgoingCall.state, "dialing");
is(outgoingCall, telephony.active);

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

@ -14,7 +14,7 @@ function dial() {
telephony.dial(number).then(call => {
outgoing = call;
ok(outgoing);
is(outgoing.id.number, number);
is(outgoing.number, number);
is(outgoing.state, "dialing");
is(outgoing, telephony.active);

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

@ -25,7 +25,7 @@ function dial() {
if (event.call.state == "dialing") {
outgoing = event.call;
ok(outgoing);
is(outgoing.id.number, number);
is(outgoing.number, number);
is(outgoing, telephony.active);
is(telephony.calls.length, 1);

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

@ -13,7 +13,7 @@ function dial() {
telephony.dial(outNumber).then(call => {
outgoingCall = call;
ok(outgoingCall);
is(outgoingCall.id.number, outNumber);
is(outgoingCall.number, outNumber);
is(outgoingCall.state, "dialing");
is(outgoingCall, telephony.active);

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

@ -32,7 +32,7 @@ function dial(number) {
let deferred = Promise.defer();
telephony.dial(number).then(call => {
ok(call);
is(call.id.number, number);
is(call.number, number);
is(call.state, "dialing");
call.onalerting = function(event) {
@ -59,7 +59,7 @@ function remoteAnswer(call) {
is(call.state, "connected");
deferred.resolve(call);
};
emulator.run("gsm accept " + call.id.number);
emulator.run("gsm accept " + call.number);
return deferred.promise;
}

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

@ -17,7 +17,7 @@ function dial() {
telephony.dial(number).then(call => {
outgoing = call;
ok(outgoing);
is(outgoing.id.number, number);
is(outgoing.number, number);
is(outgoing.state, "dialing");
is(outgoing, telephony.active);

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

@ -13,7 +13,7 @@ function dial() {
telephony.dial(number).then(call => {
outgoing = call;
ok(outgoing);
is(outgoing.id.number, number);
is(outgoing.number, number);
is(outgoing.state, "dialing");
is(outgoing, telephony.active);

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

@ -14,7 +14,7 @@ function dial() {
telephony.dial(number).then(call => {
outgoing = call;
ok(outgoing);
is(outgoing.id.number, number);
is(outgoing.number, number);
is(outgoing.state, "dialing");
is(outgoing, telephony.active);

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

@ -14,7 +14,7 @@ function dial() {
telephony.dial(number).then(call => {
outgoing = call;
ok(outgoing);
is(outgoing.id.number, number);
is(outgoing.number, number);
is(outgoing.state, "dialing");
is(outgoing, telephony.active);
//ok(telephony.calls === calls); // bug 717414

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

@ -14,7 +14,7 @@ function dial() {
telephony.dial(number).then(call => {
outgoingCall = call;
ok(outgoingCall);
is(outgoingCall.id.number, number);
is(outgoingCall.number, number);
is(outgoingCall.state, "dialing");
is(outgoingCall, telephony.active);

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

@ -13,7 +13,7 @@ function dial() {
telephony.dial(outNumber).then(call => {
outgoingCall = call;
ok(outgoingCall);
is(outgoingCall.id.number, outNumber);
is(outgoingCall.number, outNumber);
is(outgoingCall.state, "dialing");
is(outgoingCall, telephony.active);

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

@ -13,7 +13,7 @@ function dial() {
telephony.dial(number).then(call => {
outgoing = call;
ok(outgoing);
is(outgoing.id.number, number);
is(outgoing.number, number);
is(outgoing.state, "dialing");
is(outgoing, telephony.active);

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

@ -12,7 +12,7 @@ function dial() {
telephony.dial(outNumber).then(call => {
outgoingCall = call;
ok(outgoingCall);
is(outgoingCall.id.number, outNumber);
is(outgoingCall.number, outNumber);
is(outgoingCall.state, "dialing");
is(outgoingCall, telephony.active);

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

@ -14,7 +14,7 @@ function simulateIncoming() {
log("Received 'incoming' call event.");
incomingCall = event.call;
ok(incomingCall);
is(incomingCall.id.number, inNumber);
is(incomingCall.number, inNumber);
is(incomingCall.state, "incoming");
is(telephony.calls.length, 1);

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

@ -17,7 +17,7 @@ function dial() {
telephony.dial(outNumber).then(call => {
outgoingCall = call;
ok(outgoingCall);
is(outgoingCall.id.number, outNumber);
is(outgoingCall.number, outNumber);
is(outgoingCall.state, "dialing");
outgoingCall.onalerting = function onalerting(event) {
@ -107,7 +107,7 @@ function simulateIncoming() {
log("Received 'incoming' call event.");
incomingCall = event.call;
ok(incomingCall);
is(incomingCall.id.number, inNumber);
is(incomingCall.number, inNumber);
is(incomingCall.state, "incoming");
// Should be two calls now