browser/devtools/debugger/test/browser_dbg_blackboxing-05.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /**
     5  * Test that a "this source is blackboxed" message is shown when necessary
     6  * and can be properly dismissed.
     7  */
     9 const TAB_URL = EXAMPLE_URL + "doc_binary_search.html";
    11 let gTab, gDebuggee, gPanel, gDebugger;
    12 let gDeck;
    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     gDeck = gDebugger.document.getElementById("editor-deck");
    22     waitForSourceShown(gPanel, ".coffee")
    23       .then(testSourceEditorShown)
    24       .then(toggleBlackBoxing.bind(null, gPanel))
    25       .then(testBlackBoxMessageShown)
    26       .then(clickStopBlackBoxingButton)
    27       .then(testSourceEditorShownAgain)
    28       .then(() => closeDebuggerAndFinish(gPanel))
    29       .then(null, aError => {
    30         ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
    31       });
    32   });
    33 }
    35 function testSourceEditorShown() {
    36   is(gDeck.selectedIndex, "0",
    37     "The first item in the deck should be selected (the source editor).");
    38 }
    40 function testBlackBoxMessageShown() {
    41   is(gDeck.selectedIndex, "1",
    42     "The second item in the deck should be selected (the black box message).");
    43 }
    45 function clickStopBlackBoxingButton() {
    46   let finished = waitForThreadEvents(gPanel, "blackboxchange");
    47   getEditorBlackboxMessageButton().click();
    48   return finished;
    49 }
    51 function testSourceEditorShownAgain() {
    52   is(gDeck.selectedIndex, "0",
    53     "The first item in the deck should be selected again (the source editor).");
    54 }
    56 function getEditorBlackboxMessageButton() {
    57   return gDebugger.document.getElementById("black-boxed-message-button");
    58 }
    60 registerCleanupFunction(function() {
    61   gTab = null;
    62   gDebuggee = null;
    63   gPanel = null;
    64   gDebugger = null;
    65   gDeck = null;
    66 });

mercurial