browser/devtools/debugger/test/browser_dbg_blackboxing-01.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-01.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     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 if we black box a source and then refresh, it is still black boxed.
     1.9 + */
    1.10 +
    1.11 +const TAB_URL = EXAMPLE_URL + "doc_binary_search.html";
    1.12 +
    1.13 +let gTab, gDebuggee, gPanel, gDebugger;
    1.14 +
    1.15 +function test() {
    1.16 +  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
    1.17 +    gTab = aTab;
    1.18 +    gDebuggee = aDebuggee;
    1.19 +    gPanel = aPanel;
    1.20 +    gDebugger = gPanel.panelWin;
    1.21 +
    1.22 +    waitForSourceShown(gPanel, ".coffee")
    1.23 +      .then(testBlackBoxSource)
    1.24 +      .then(testBlackBoxReload)
    1.25 +      .then(() => closeDebuggerAndFinish(gPanel))
    1.26 +      .then(null, aError => {
    1.27 +        ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
    1.28 +      });
    1.29 +  });
    1.30 +}
    1.31 +
    1.32 +function testBlackBoxSource() {
    1.33 +  const bbButton = getBlackBoxButton(gPanel);
    1.34 +  ok(!bbButton.checked, "Should not be black boxed by default");
    1.35 +
    1.36 +  return toggleBlackBoxing(gPanel).then(aSource => {
    1.37 +    ok(aSource.isBlackBoxed, "The source should be black boxed now.");
    1.38 +    ok(bbButton.checked, "The checkbox should no longer be checked.");
    1.39 +  });
    1.40 +}
    1.41 +
    1.42 +function testBlackBoxReload() {
    1.43 +  return reloadActiveTab(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(() => {
    1.44 +    const bbButton = getBlackBoxButton(gPanel);
    1.45 +    ok(bbButton.checked, "Should still be black boxed.");
    1.46 +  });
    1.47 +}
    1.48 +
    1.49 +registerCleanupFunction(function() {
    1.50 +  gTab = null;
    1.51 +  gDebuggee = null;
    1.52 +  gPanel = null;
    1.53 +  gDebugger = null;
    1.54 +});

mercurial