From 86e4b1ad875277045f3f8894a72d7c9daf449500 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Tue, 25 Jan 2011 15:27:35 +0100 Subject: [PATCH] =?UTF-8?q?Bugzilla@Mozilla=20=E2=80=93=20Bug=20628614=20T?= =?UTF-8?q?EST-UNEXPECTED-FAIL=20|=20chrome://mochitests/content/browser/m?= =?UTF-8?q?obile/chrome/browser=5Fforms.js=20|=20Form=20Assistant=20should?= =?UTF-8?q?=20be=20open=20[r=3Dmfinkle]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile/chrome/tests/browser_forms.js | 30 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/mobile/chrome/tests/browser_forms.js b/mobile/chrome/tests/browser_forms.js index 6b11a47d6575..a956cb825e03 100644 --- a/mobile/chrome/tests/browser_forms.js +++ b/mobile/chrome/tests/browser_forms.js @@ -9,7 +9,7 @@ function test() { // Need to wait until the page is loaded messageManager.addMessageListener("pageshow", function(aMessage) { - if (newTab.browser.currentURI.spec != "about:blank") { + if (newTab && newTab.browser.currentURI.spec != "about:blank") { messageManager.removeMessageListener(aMessage.name, arguments.callee); setTimeout(onTabLoaded, 0); } @@ -42,25 +42,29 @@ function testMouseEvents() { }); }; -function testOpenUIWithSyncFocus() { - AsyncTests.waitFor("Test:Open", { value: "*[tabindex='0']" }, function(json) { - ok(FormHelperUI._open, "Form Assistant should be open"); - testOpenUI(); +function waitForFormAssist(aCallback) { + messageManager.addMessageListener("FormAssist:Show", function(aMessage) { + messageManager.removeMessageListener(aMessage.name, arguments.callee); + setTimeout(function() { + ok(FormHelperUI._open, "Form Assistant should be open"); + setTimeout(aCallback, 0); + }); }); }; +function testOpenUIWithSyncFocus() { + AsyncTests.waitFor("Test:Open", { value: "*[tabindex='0']" }, function(json) {}); + waitForFormAssist(testOpenUI); +}; + function testOpenUI() { - AsyncTests.waitFor("Test:Open", { value: "*[tabindex='0']" }, function(json) { - ok(FormHelperUI._open, "Form Assistant should be open"); - testOpenUIWithFocusRedirect(); - }); + AsyncTests.waitFor("Test:Open", { value: "*[tabindex='0']" }, function(json) {}); + waitForFormAssist(testOpenUIWithFocusRedirect); }; function testOpenUIWithFocusRedirect() { - AsyncTests.waitFor("Test:OpenWithFocusRedirect", { value: "*[tabindex='0']" }, function(json) { - ok(FormHelperUI._open, "Form Assistant should be open"); - testShowUIForSelect(); - }); + AsyncTests.waitFor("Test:OpenWithFocusRedirect", { value: "*[tabindex='0']" }, function(json) {}); + waitForFormAssist(testShowUIForSelect); }; function testShowUIForSelect() {