Bug 779217 - Intermittent test_outgoing_hangup_held.js: got OK, expected outbound to 5555552368 : unknown | got false, expected true. r=philikon

This commit is contained in:
Hsin-Yi Tsai 2012-08-03 12:08:15 +08:00
Родитель ebdb8a9a42
Коммит c8a775055e
1 изменённых файлов: 22 добавлений и 6 удалений

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

@ -39,12 +39,8 @@ function dial() {
is(telephony.calls.length, 1);
is(telephony.calls[0], outgoing);
runEmulatorCmd("gsm list", function(result) {
log("Call list is now: " + result);
is(result[0], "outbound to " + number + " : unknown");
is(result[1], "OK");
answer();
});
// Get call list. Answer a call if the connection is established.
runEmulatorCmd("gsm list", cmdCallback);
}
function answer() {
@ -128,6 +124,26 @@ function 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() {
SpecialPowers.clearUserPref(WHITELIST_PREF);
finish();