From 76da970a9934741cc31250f7c6e011660220cdf5 Mon Sep 17 00:00:00 2001 From: Rob Wood Date: Wed, 24 Apr 2013 12:38:19 -0400 Subject: [PATCH] Bug 849714 - Fix intermittent failure in outgoing_answer_hangup_oncallschanged; r=jgriffin --- ...t_outgoing_answer_hangup_oncallschanged.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/dom/telephony/test/marionette/test_outgoing_answer_hangup_oncallschanged.js b/dom/telephony/test/marionette/test_outgoing_answer_hangup_oncallschanged.js index af5fbd94fb9..f6b46af9417 100644 --- a/dom/telephony/test/marionette/test_outgoing_answer_hangup_oncallschanged.js +++ b/dom/telephony/test/marionette/test_outgoing_answer_hangup_oncallschanged.js @@ -46,16 +46,10 @@ function dial() { is(outgoing.number, number); is(outgoing, telephony.active); - //ok(telephony.calls === calls); // bug 717414 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(); - }); + checkCallList(); } if (event.call.state == "disconnected") { @@ -69,6 +63,17 @@ function dial() { telephony.dial(number); } +function checkCallList() { + runEmulatorCmd("gsm list", function(result) { + log("Call list is now: " + result) + if ((result[0] == "outbound to " + number + " : unknown") && (result[1] == "OK")) { + answer(); + } else { + window.setTimeout(checkCallList, 100); + } + }); +} + function answer() { log("Answering the outgoing call."); @@ -82,7 +87,7 @@ function answer() { is(outgoing, telephony.active); runEmulatorCmd("gsm list", function(result) { - log("Call list is now: " + result); + log("Call list (after 'connected' event) is now: " + result); is(result[0], "outbound to " + number + " : active"); is(result[1], "OK"); hangUp();