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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /**
     5  * Tests that debugger's tab is highlighted when it is paused and not the
     6  * currently selected tool.
     7  */
     9 const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
    11 let gTab, gDebuggee, gPanel, gDebugger;
    12 let gToolbox, gToolboxTab;
    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");
    23     waitForSourceShown(gPanel, ".html").then(testPause);
    24   });
    25 }
    27 function testPause() {
    28   is(gDebugger.gThreadClient.paused, false,
    29     "Should be running after starting test.");
    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   });
    49   EventUtils.sendMouseEvent({ type: "mousedown" },
    50     gDebugger.document.getElementById("resume"),
    51     gDebugger);
    52 }
    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   });
    65   EventUtils.sendMouseEvent({ type: "mousedown" },
    66     gDebugger.document.getElementById("resume"),
    67     gDebugger);
    68 }
    70 registerCleanupFunction(function() {
    71   gTab = null;
    72   gDebuggee = null;
    73   gPanel = null;
    74   gDebugger = null;
    75   gToolbox = null;
    76   gToolboxTab = null;
    77 });

mercurial