browser/devtools/debugger/test/browser_dbg_stack-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_stack-01.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,45 @@
     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 stackframes are added when debugger is paused.
     1.9 + */
    1.10 +
    1.11 +const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
    1.12 +
    1.13 +let gTab, gDebuggee, gPanel, gDebugger;
    1.14 +let gFrames, gClassicFrames;
    1.15 +
    1.16 +function test() {
    1.17 +  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
    1.18 +    gTab = aTab;
    1.19 +    gDebuggee = aDebuggee;
    1.20 +    gPanel = aPanel;
    1.21 +    gDebugger = gPanel.panelWin;
    1.22 +    gFrames = gDebugger.DebuggerView.StackFrames;
    1.23 +    gClassicFrames = gDebugger.DebuggerView.StackFramesClassicList;
    1.24 +
    1.25 +    waitForSourceAndCaretAndScopes(gPanel, ".html", 14).then(performTest);
    1.26 +    gDebuggee.simpleCall();
    1.27 +  });
    1.28 +}
    1.29 +
    1.30 +function performTest() {
    1.31 +  is(gDebugger.gThreadClient.state, "paused",
    1.32 +    "Should only be getting stack frames while paused.");
    1.33 +  is(gFrames.itemCount, 1,
    1.34 +    "Should have only one frame.");
    1.35 +  is(gClassicFrames.itemCount, 1,
    1.36 +    "Should also have only one frame in the mirrored view.");
    1.37 +
    1.38 +  resumeDebuggerThenCloseAndFinish(gPanel);
    1.39 +}
    1.40 +
    1.41 +registerCleanupFunction(function() {
    1.42 +  gTab = null;
    1.43 +  gDebuggee = null;
    1.44 +  gPanel = null;
    1.45 +  gDebugger = null;
    1.46 +  gFrames = null;
    1.47 +  gClassicFrames = null;
    1.48 +});

mercurial