1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/debugger/test/browser_dbg_on-pause-highlight.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,77 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +/** 1.8 + * Tests that debugger's tab is highlighted when it is paused and not the 1.9 + * currently selected tool. 1.10 + */ 1.11 + 1.12 +const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; 1.13 + 1.14 +let gTab, gDebuggee, gPanel, gDebugger; 1.15 +let gToolbox, gToolboxTab; 1.16 + 1.17 +function test() { 1.18 + initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { 1.19 + gTab = aTab; 1.20 + gDebuggee = aDebuggee; 1.21 + gPanel = aPanel; 1.22 + gDebugger = gPanel.panelWin; 1.23 + gToolbox = gPanel._toolbox; 1.24 + gToolboxTab = gToolbox.doc.getElementById("toolbox-tab-jsdebugger"); 1.25 + 1.26 + waitForSourceShown(gPanel, ".html").then(testPause); 1.27 + }); 1.28 +} 1.29 + 1.30 +function testPause() { 1.31 + is(gDebugger.gThreadClient.paused, false, 1.32 + "Should be running after starting test."); 1.33 + 1.34 + gDebugger.gThreadClient.addOneTimeListener("paused", () => { 1.35 + gToolbox.selectTool("webconsole").then(() => { 1.36 + ok(gToolboxTab.hasAttribute("highlighted") && 1.37 + gToolboxTab.getAttribute("highlighted") == "true", 1.38 + "The highlighted class is present"); 1.39 + ok(!gToolboxTab.hasAttribute("selected") || 1.40 + gToolboxTab.getAttribute("selected") != "true", 1.41 + "The tab is not selected"); 1.42 + }).then(() => gToolbox.selectTool("jsdebugger")).then(() => { 1.43 + ok(gToolboxTab.hasAttribute("highlighted") && 1.44 + gToolboxTab.getAttribute("highlighted") == "true", 1.45 + "The highlighted class is present"); 1.46 + ok(gToolboxTab.hasAttribute("selected") && 1.47 + gToolboxTab.getAttribute("selected") == "true", 1.48 + "...and the tab is selected, so the glow will not be present."); 1.49 + }).then(testResume); 1.50 + }); 1.51 + 1.52 + EventUtils.sendMouseEvent({ type: "mousedown" }, 1.53 + gDebugger.document.getElementById("resume"), 1.54 + gDebugger); 1.55 +} 1.56 + 1.57 +function testResume() { 1.58 + gDebugger.gThreadClient.addOneTimeListener("resumed", () => { 1.59 + gToolbox.selectTool("webconsole").then(() => { 1.60 + ok(!gToolboxTab.classList.contains("highlighted"), 1.61 + "The highlighted class is not present now after the resume"); 1.62 + ok(!gToolboxTab.hasAttribute("selected") || 1.63 + gToolboxTab.getAttribute("selected") != "true", 1.64 + "The tab is not selected"); 1.65 + }).then(() => closeDebuggerAndFinish(gPanel)); 1.66 + }); 1.67 + 1.68 + EventUtils.sendMouseEvent({ type: "mousedown" }, 1.69 + gDebugger.document.getElementById("resume"), 1.70 + gDebugger); 1.71 +} 1.72 + 1.73 +registerCleanupFunction(function() { 1.74 + gTab = null; 1.75 + gDebuggee = null; 1.76 + gPanel = null; 1.77 + gDebugger = null; 1.78 + gToolbox = null; 1.79 + gToolboxTab = null; 1.80 +});