Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * Tests that debugger's tab is highlighted when it is paused and not the |
michael@0 | 6 | * currently selected tool. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; |
michael@0 | 10 | |
michael@0 | 11 | let gTab, gDebuggee, gPanel, gDebugger; |
michael@0 | 12 | let gToolbox, gToolboxTab; |
michael@0 | 13 | |
michael@0 | 14 | function test() { |
michael@0 | 15 | initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { |
michael@0 | 16 | gTab = aTab; |
michael@0 | 17 | gDebuggee = aDebuggee; |
michael@0 | 18 | gPanel = aPanel; |
michael@0 | 19 | gDebugger = gPanel.panelWin; |
michael@0 | 20 | gToolbox = gPanel._toolbox; |
michael@0 | 21 | gToolboxTab = gToolbox.doc.getElementById("toolbox-tab-jsdebugger"); |
michael@0 | 22 | |
michael@0 | 23 | waitForSourceShown(gPanel, ".html").then(testPause); |
michael@0 | 24 | }); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | function testPause() { |
michael@0 | 28 | is(gDebugger.gThreadClient.paused, false, |
michael@0 | 29 | "Should be running after starting test."); |
michael@0 | 30 | |
michael@0 | 31 | gDebugger.gThreadClient.addOneTimeListener("paused", () => { |
michael@0 | 32 | gToolbox.selectTool("webconsole").then(() => { |
michael@0 | 33 | ok(gToolboxTab.hasAttribute("highlighted") && |
michael@0 | 34 | gToolboxTab.getAttribute("highlighted") == "true", |
michael@0 | 35 | "The highlighted class is present"); |
michael@0 | 36 | ok(!gToolboxTab.hasAttribute("selected") || |
michael@0 | 37 | gToolboxTab.getAttribute("selected") != "true", |
michael@0 | 38 | "The tab is not selected"); |
michael@0 | 39 | }).then(() => gToolbox.selectTool("jsdebugger")).then(() => { |
michael@0 | 40 | ok(gToolboxTab.hasAttribute("highlighted") && |
michael@0 | 41 | gToolboxTab.getAttribute("highlighted") == "true", |
michael@0 | 42 | "The highlighted class is present"); |
michael@0 | 43 | ok(gToolboxTab.hasAttribute("selected") && |
michael@0 | 44 | gToolboxTab.getAttribute("selected") == "true", |
michael@0 | 45 | "...and the tab is selected, so the glow will not be present."); |
michael@0 | 46 | }).then(testResume); |
michael@0 | 47 | }); |
michael@0 | 48 | |
michael@0 | 49 | EventUtils.sendMouseEvent({ type: "mousedown" }, |
michael@0 | 50 | gDebugger.document.getElementById("resume"), |
michael@0 | 51 | gDebugger); |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | function testResume() { |
michael@0 | 55 | gDebugger.gThreadClient.addOneTimeListener("resumed", () => { |
michael@0 | 56 | gToolbox.selectTool("webconsole").then(() => { |
michael@0 | 57 | ok(!gToolboxTab.classList.contains("highlighted"), |
michael@0 | 58 | "The highlighted class is not present now after the resume"); |
michael@0 | 59 | ok(!gToolboxTab.hasAttribute("selected") || |
michael@0 | 60 | gToolboxTab.getAttribute("selected") != "true", |
michael@0 | 61 | "The tab is not selected"); |
michael@0 | 62 | }).then(() => closeDebuggerAndFinish(gPanel)); |
michael@0 | 63 | }); |
michael@0 | 64 | |
michael@0 | 65 | EventUtils.sendMouseEvent({ type: "mousedown" }, |
michael@0 | 66 | gDebugger.document.getElementById("resume"), |
michael@0 | 67 | gDebugger); |
michael@0 | 68 | } |
michael@0 | 69 | |
michael@0 | 70 | registerCleanupFunction(function() { |
michael@0 | 71 | gTab = null; |
michael@0 | 72 | gDebuggee = null; |
michael@0 | 73 | gPanel = null; |
michael@0 | 74 | gDebugger = null; |
michael@0 | 75 | gToolbox = null; |
michael@0 | 76 | gToolboxTab = null; |
michael@0 | 77 | }); |