зеркало из https://github.com/mozilla/gecko-dev.git
Bug 803861 - Tests should wait for 'onalerting' event when making outgoing calls; r=jgriffin, DONTBUILD(NPOTB)
This commit is contained in:
Родитель
cc5389f360
Коммит
b0939c3fae
|
@ -38,12 +38,18 @@ function dial() {
|
||||||
is(telephony.calls.length, 1);
|
is(telephony.calls.length, 1);
|
||||||
is(telephony.calls[0], outgoing);
|
is(telephony.calls[0], outgoing);
|
||||||
|
|
||||||
runEmulatorCmd("gsm list", function(result) {
|
outgoing.onalerting = function onalerting(event) {
|
||||||
log("Call list is now: " + result);
|
log("Received 'onalerting' call event.");
|
||||||
is(result[0], "outbound to " + number + " : unknown");
|
is(outgoing, event.call);
|
||||||
is(result[1], "OK");
|
is(outgoing.state, "alerting");
|
||||||
answer();
|
|
||||||
});
|
runEmulatorCmd("gsm list", function(result) {
|
||||||
|
log("Call list is now: " + result);
|
||||||
|
is(result[0], "outbound to " + number + " : ringing");
|
||||||
|
is(result[1], "OK");
|
||||||
|
answer();
|
||||||
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function answer() {
|
function answer() {
|
||||||
|
|
|
@ -37,12 +37,18 @@ function dial() {
|
||||||
is(telephony.calls.length, 1);
|
is(telephony.calls.length, 1);
|
||||||
is(telephony.calls[0], outgoingCall);
|
is(telephony.calls[0], outgoingCall);
|
||||||
|
|
||||||
runEmulatorCmd("gsm list", function(result) {
|
outgoingCall.onalerting = function onalerting(event) {
|
||||||
log("Call list is now: " + result);
|
log("Received 'onalerting' call event.");
|
||||||
is(result[0], "outbound to " + outNumber + " : unknown");
|
is(outgoingCall, event.call);
|
||||||
is(result[1], "OK");
|
is(outgoingCall.state, "alerting");
|
||||||
answer();
|
|
||||||
});
|
runEmulatorCmd("gsm list", function(result) {
|
||||||
|
log("Call list is now: " + result);
|
||||||
|
is(result[0], "outbound to " + outNumber + " : ringing");
|
||||||
|
is(result[1], "OK");
|
||||||
|
answer();
|
||||||
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function answer() {
|
function answer() {
|
||||||
|
|
|
@ -37,12 +37,18 @@ function dial() {
|
||||||
is(telephony.calls.length, 1);
|
is(telephony.calls.length, 1);
|
||||||
is(telephony.calls[0], outgoingCall);
|
is(telephony.calls[0], outgoingCall);
|
||||||
|
|
||||||
runEmulatorCmd("gsm list", function(result) {
|
outgoingCall.onalerting = function onalerting(event) {
|
||||||
log("Call list is now: " + result);
|
log("Received 'onalerting' call event.");
|
||||||
is(result[0], "outbound to " + outNumber + " : unknown");
|
is(outgoingCall, event.call);
|
||||||
is(result[1], "OK");
|
is(outgoingCall.state, "alerting");
|
||||||
answer();
|
|
||||||
});
|
runEmulatorCmd("gsm list", function(result) {
|
||||||
|
log("Call list is now: " + result);
|
||||||
|
is(result[0], "outbound to " + outNumber + " : ringing");
|
||||||
|
is(result[1], "OK");
|
||||||
|
answer();
|
||||||
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function answer() {
|
function answer() {
|
||||||
|
|
|
@ -112,7 +112,7 @@ function holdCall(){
|
||||||
// With one call on hold, make outgoing call
|
// With one call on hold, make outgoing call
|
||||||
function dial() {
|
function dial() {
|
||||||
log("Making an outgoing call (while have one call already held).");
|
log("Making an outgoing call (while have one call already held).");
|
||||||
|
|
||||||
outgoingCall = telephony.dial(outNumber);
|
outgoingCall = telephony.dial(outNumber);
|
||||||
ok(outgoingCall);
|
ok(outgoingCall);
|
||||||
is(outgoingCall.number, outNumber);
|
is(outgoingCall.number, outNumber);
|
||||||
|
@ -123,13 +123,19 @@ function dial() {
|
||||||
is(telephony.calls[0], incomingCall);
|
is(telephony.calls[0], incomingCall);
|
||||||
is(telephony.calls[1], outgoingCall);
|
is(telephony.calls[1], outgoingCall);
|
||||||
|
|
||||||
runEmulatorCmd("gsm list", function(result) {
|
outgoingCall.onalerting = function onalerting(event) {
|
||||||
log("Call list is now: " + result);
|
log("Received 'onalerting' call event.");
|
||||||
is(result[0], "inbound from " + inNumber + " : held");
|
is(outgoingCall, event.call);
|
||||||
is(result[1], "outbound to " + outNumber + " : unknown");
|
is(outgoingCall.state, "alerting");
|
||||||
is(result[2], "OK");
|
|
||||||
answerOutgoing();
|
runEmulatorCmd("gsm list", function(result) {
|
||||||
});
|
log("Call list is now: " + result);
|
||||||
|
is(result[0], "inbound from " + inNumber + " : held");
|
||||||
|
is(result[1], "outbound to " + outNumber + " : ringing");
|
||||||
|
is(result[2], "OK");
|
||||||
|
answerOutgoing();
|
||||||
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Have the outgoing call answered
|
// Have the outgoing call answered
|
||||||
|
|
|
@ -38,12 +38,18 @@ function dial() {
|
||||||
is(telephony.calls.length, 1);
|
is(telephony.calls.length, 1);
|
||||||
is(telephony.calls[0], outgoing);
|
is(telephony.calls[0], outgoing);
|
||||||
|
|
||||||
runEmulatorCmd("gsm list", function(result) {
|
outgoing.onalerting = function onalerting(event) {
|
||||||
log("Call list is now: " + result);
|
log("Received 'onalerting' call event.");
|
||||||
is(result[0], "outbound to " + number + " : unknown");
|
is(outgoing, event.call);
|
||||||
is(result[1], "OK");
|
is(outgoing.state, "alerting");
|
||||||
answer();
|
|
||||||
});
|
runEmulatorCmd("gsm list", function(result) {
|
||||||
|
log("Call list is now: " + result);
|
||||||
|
is(result[0], "outbound to " + number + " : ringing");
|
||||||
|
is(result[1], "OK");
|
||||||
|
answer();
|
||||||
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function answer() {
|
function answer() {
|
||||||
|
|
|
@ -32,14 +32,23 @@ function dial() {
|
||||||
ok(outgoing);
|
ok(outgoing);
|
||||||
is(outgoing.number, number);
|
is(outgoing.number, number);
|
||||||
is(outgoing.state, "dialing");
|
is(outgoing.state, "dialing");
|
||||||
|
|
||||||
is(outgoing, telephony.active);
|
is(outgoing, telephony.active);
|
||||||
//ok(telephony.calls === calls); // bug 717414
|
//ok(telephony.calls === calls); // bug 717414
|
||||||
is(telephony.calls.length, 1);
|
is(telephony.calls.length, 1);
|
||||||
is(telephony.calls[0], outgoing);
|
is(telephony.calls[0], outgoing);
|
||||||
|
|
||||||
// Get call list. Answer a call if the connection is established.
|
outgoing.onalerting = function onalerting(event) {
|
||||||
runEmulatorCmd("gsm list", cmdCallback);
|
log("Received 'onalerting' call event.");
|
||||||
|
is(outgoing, event.call);
|
||||||
|
is(outgoing.state, "alerting");
|
||||||
|
|
||||||
|
runEmulatorCmd("gsm list", function(result) {
|
||||||
|
log("Call list is now: " + result);
|
||||||
|
is(result[0], "outbound to " + number + " : ringing");
|
||||||
|
is(result[1], "OK");
|
||||||
|
answer();
|
||||||
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function answer() {
|
function answer() {
|
||||||
|
@ -123,26 +132,6 @@ function hangUp() {
|
||||||
outgoing.hangUp();
|
outgoing.hangUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdCallback(result) {
|
|
||||||
let unknownState = "outbound to " + number + " : unknown";
|
|
||||||
let alertingState = "outbound to " + number + " : alerting";
|
|
||||||
|
|
||||||
log("Call list is now: " + result);
|
|
||||||
|
|
||||||
switch (result[0]) {
|
|
||||||
// Gsm list is empty. Wait until the connection is established.
|
|
||||||
case "OK":
|
|
||||||
runEmulatorCmd("gsm list", cmdCallback);
|
|
||||||
break;
|
|
||||||
// Answer the call now since the connection is established.
|
|
||||||
case unknownState: // Fall through ...
|
|
||||||
case alertingState:
|
|
||||||
is(result[1], "OK");
|
|
||||||
answer();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function cleanUp() {
|
function cleanUp() {
|
||||||
SpecialPowers.removePermission("telephony", document);
|
SpecialPowers.removePermission("telephony", document);
|
||||||
finish();
|
finish();
|
||||||
|
|
|
@ -36,12 +36,18 @@ function dial() {
|
||||||
is(telephony.calls.length, 1);
|
is(telephony.calls.length, 1);
|
||||||
is(telephony.calls[0], outgoingCall);
|
is(telephony.calls[0], outgoingCall);
|
||||||
|
|
||||||
runEmulatorCmd("gsm list", function(result) {
|
outgoingCall.onalerting = function onalerting(event) {
|
||||||
log("Call list is now: " + result);
|
log("Received 'onalerting' call event.");
|
||||||
is(result[0], "outbound to " + number + " : unknown");
|
is(outgoingCall, event.call);
|
||||||
is(result[1], "OK");
|
is(outgoingCall.state, "alerting");
|
||||||
answer();
|
|
||||||
});
|
runEmulatorCmd("gsm list", function(result) {
|
||||||
|
log("Call list is now: " + result);
|
||||||
|
is(result[0], "outbound to " + number + " : ringing");
|
||||||
|
is(result[1], "OK");
|
||||||
|
answer();
|
||||||
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function answer() {
|
function answer() {
|
||||||
|
|
|
@ -38,17 +38,22 @@ function dial() {
|
||||||
is(telephony.calls.length, 1);
|
is(telephony.calls.length, 1);
|
||||||
is(telephony.calls[0], outgoing);
|
is(telephony.calls[0], outgoing);
|
||||||
|
|
||||||
runEmulatorCmd("gsm list", function(result) {
|
outgoing.onalerting = function onalerting(event) {
|
||||||
log("Call list is now: " + result);
|
log("Received 'onalerting' call event.");
|
||||||
is(result[0], "outbound to " + number + " : unknown");
|
is(outgoing, event.call);
|
||||||
is(result[1], "OK");
|
is(outgoing.state, "alerting");
|
||||||
reject();
|
|
||||||
});
|
runEmulatorCmd("gsm list", function(result) {
|
||||||
|
log("Call list is now: " + result);
|
||||||
|
is(result[0], "outbound to " + number + " : ringing");
|
||||||
|
is(result[1], "OK");
|
||||||
|
reject();
|
||||||
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function reject() {
|
function reject() {
|
||||||
log("Reject the outgoing call on the other end.");
|
log("Reject the outgoing call on the other end.");
|
||||||
|
|
||||||
// We get no "disconnecting" event when the remote party rejects the call.
|
// We get no "disconnecting" event when the remote party rejects the call.
|
||||||
|
|
||||||
outgoing.ondisconnected = function ondisconnected(event) {
|
outgoing.ondisconnected = function ondisconnected(event) {
|
||||||
|
@ -65,22 +70,9 @@ function reject() {
|
||||||
cleanUp();
|
cleanUp();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
runEmulatorCmd("gsm list", cmdCallback);
|
runEmulatorCmd("gsm cancel " + number);
|
||||||
};
|
};
|
||||||
|
|
||||||
function cmdCallback(result) {
|
|
||||||
let state = "outbound to " + number + " : unknown";
|
|
||||||
log("Call list is now: " + result);
|
|
||||||
|
|
||||||
// The outgoing call cannot be canceled when call state is unknown.
|
|
||||||
// Wait until the call connection is established.
|
|
||||||
if (result[0] == state) {
|
|
||||||
runEmulatorCmd("gsm list", cmdCallback);
|
|
||||||
} else {
|
|
||||||
runEmulatorCmd("gsm cancel " + number);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function cleanUp() {
|
function cleanUp() {
|
||||||
SpecialPowers.removePermission("telephony", document);
|
SpecialPowers.removePermission("telephony", document);
|
||||||
finish();
|
finish();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче