From 2942463f2e837bf89500744e512b1defe73eb5b4 Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Wed, 16 Apr 2014 14:54:03 +0100 Subject: [PATCH] Bug 996988 - add more test assertions to debug intermittent orange for browser_995164_registerArea_during_customize_mode.js, rs=firebot/test-only --HG-- extra : rebase_source : a70df662df41f7316d96c123e250267ddd46b8c8 --- ...5164_registerArea_during_customize_mode.js | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/browser/components/customizableui/test/browser_995164_registerArea_during_customize_mode.js b/browser/components/customizableui/test/browser_995164_registerArea_during_customize_mode.js index f10f8fd17ea4..04b2896a6ecb 100644 --- a/browser/components/customizableui/test/browser_995164_registerArea_during_customize_mode.js +++ b/browser/components/customizableui/test/browser_995164_registerArea_during_customize_mode.js @@ -58,7 +58,19 @@ add_task(function*() { let otherTB = otherWin.document.createElementNS(kNSXUL, "toolbar"); otherTB.id = TOOLBARID; otherTB.setAttribute("customizable", "true"); + let wasInformedCorrectlyOfAreaAppearing = false; + let listener = { + onAreaNodeRegistered: function(aArea, aNode) { + if (aNode == otherTB) { + wasInformedCorrectlyOfAreaAppearing = true; + } + } + }; + CustomizableUI.addListener(listener); otherWin.gNavToolbox.appendChild(otherTB); + ok(wasInformedCorrectlyOfAreaAppearing, "Should have been told area was registered."); + CustomizableUI.removeListener(listener); + ok(otherTB.querySelector("#sync-button"), "Sync button is on other toolbar, too."); simulateItemDrag(syncButton, gNavToolbox.palette); @@ -73,18 +85,25 @@ add_task(function*() { ok(otherTB.querySelector("#sync-button"), "Sync button is on other toolbar, too."); let wasInformedCorrectlyOfAreaDisappearing = false; - let listener = { + let windowClosed = null; + listener = { onAreaNodeUnregistered: function(aArea, aNode, aReason) { if (aArea == TOOLBARID) { is(aNode, otherTB, "Should be informed about other toolbar"); is(aReason, CustomizableUI.REASON_WINDOW_CLOSED, "Reason should be correct."); wasInformedCorrectlyOfAreaDisappearing = (aReason === CustomizableUI.REASON_WINDOW_CLOSED); } - } + }, + onWindowClosed: function(aWindow) { + if (aWindow == otherWin) { + windowClosed = aWindow; + } + }, }; CustomizableUI.addListener(listener); yield promiseWindowClosed(otherWin); + is(windowClosed, otherWin, "Window should have sent onWindowClosed notification."); ok(wasInformedCorrectlyOfAreaDisappearing, "Should be told about window closing."); CustomizableUI.removeListener(listener); // Closing the other window should not be counted against this window's customize mode: