browser/devtools/debugger/test/browser_dbg_on-pause-highlight.js

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

mercurial