browser/devtools/debugger/test/browser_dbg_blackboxing-03.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-03.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,59 @@
     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 black boxed frames are compressed into a single frame on the stack
     1.9 + * view when we are already paused.
    1.10 + */
    1.11 +
    1.12 +const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html";
    1.13 +const BLACKBOXME_URL = EXAMPLE_URL + "code_blackboxing_blackboxme.js"
    1.14 +
    1.15 +let gTab, gDebuggee, gPanel, gDebugger;
    1.16 +let gFrames;
    1.17 +
    1.18 +function test() {
    1.19 +  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
    1.20 +    gTab = aTab;
    1.21 +    gDebuggee = aDebuggee;
    1.22 +    gPanel = aPanel;
    1.23 +    gDebugger = gPanel.panelWin;
    1.24 +    gFrames = gDebugger.DebuggerView.StackFrames;
    1.25 +
    1.26 +    waitForSourceAndCaretAndScopes(gPanel, ".html", 21)
    1.27 +      .then(testBlackBoxStack)
    1.28 +      .then(testBlackBoxSource)
    1.29 +      .then(() => resumeDebuggerThenCloseAndFinish(gPanel))
    1.30 +      .then(null, aError => {
    1.31 +        ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
    1.32 +      });
    1.33 +
    1.34 +    gDebuggee.runTest();
    1.35 +  });
    1.36 +}
    1.37 +
    1.38 +function testBlackBoxStack() {
    1.39 +  is(gFrames.itemCount, 6,
    1.40 +    "Should get 6 frames.");
    1.41 +  is(gDebugger.document.querySelectorAll(".dbg-stackframe-black-boxed").length, 0,
    1.42 +    "And none of them are black boxed.");
    1.43 +}
    1.44 +
    1.45 +function testBlackBoxSource() {
    1.46 +  return toggleBlackBoxing(gPanel, BLACKBOXME_URL).then(aSource => {
    1.47 +    ok(aSource.isBlackBoxed, "The source should be black boxed now.");
    1.48 +
    1.49 +    is(gFrames.itemCount, 3,
    1.50 +      "Should only get 3 frames.");
    1.51 +    is(gDebugger.document.querySelectorAll(".dbg-stackframe-black-boxed").length, 1,
    1.52 +      "And one of them should be the combined black boxed frames.");
    1.53 +  });
    1.54 +}
    1.55 +
    1.56 +registerCleanupFunction(function() {
    1.57 +  gTab = null;
    1.58 +  gDebuggee = null;
    1.59 +  gPanel = null;
    1.60 +  gDebugger = null;
    1.61 +  gFrames = null;
    1.62 +});

mercurial