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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/debugger/test/browser_dbg_blackboxing-05.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,66 @@
     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 + * Test that a "this source is blackboxed" message is shown when necessary
     1.9 + * and can be properly dismissed.
    1.10 + */
    1.11 +
    1.12 +const TAB_URL = EXAMPLE_URL + "doc_binary_search.html";
    1.13 +
    1.14 +let gTab, gDebuggee, gPanel, gDebugger;
    1.15 +let gDeck;
    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 +    gDeck = gDebugger.document.getElementById("editor-deck");
    1.24 +
    1.25 +    waitForSourceShown(gPanel, ".coffee")
    1.26 +      .then(testSourceEditorShown)
    1.27 +      .then(toggleBlackBoxing.bind(null, gPanel))
    1.28 +      .then(testBlackBoxMessageShown)
    1.29 +      .then(clickStopBlackBoxingButton)
    1.30 +      .then(testSourceEditorShownAgain)
    1.31 +      .then(() => closeDebuggerAndFinish(gPanel))
    1.32 +      .then(null, aError => {
    1.33 +        ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
    1.34 +      });
    1.35 +  });
    1.36 +}
    1.37 +
    1.38 +function testSourceEditorShown() {
    1.39 +  is(gDeck.selectedIndex, "0",
    1.40 +    "The first item in the deck should be selected (the source editor).");
    1.41 +}
    1.42 +
    1.43 +function testBlackBoxMessageShown() {
    1.44 +  is(gDeck.selectedIndex, "1",
    1.45 +    "The second item in the deck should be selected (the black box message).");
    1.46 +}
    1.47 +
    1.48 +function clickStopBlackBoxingButton() {
    1.49 +  let finished = waitForThreadEvents(gPanel, "blackboxchange");
    1.50 +  getEditorBlackboxMessageButton().click();
    1.51 +  return finished;
    1.52 +}
    1.53 +
    1.54 +function testSourceEditorShownAgain() {
    1.55 +  is(gDeck.selectedIndex, "0",
    1.56 +    "The first item in the deck should be selected again (the source editor).");
    1.57 +}
    1.58 +
    1.59 +function getEditorBlackboxMessageButton() {
    1.60 +  return gDebugger.document.getElementById("black-boxed-message-button");
    1.61 +}
    1.62 +
    1.63 +registerCleanupFunction(function() {
    1.64 +  gTab = null;
    1.65 +  gDebuggee = null;
    1.66 +  gPanel = null;
    1.67 +  gDebugger = null;
    1.68 +  gDeck = null;
    1.69 +});

mercurial