browser/devtools/debugger/test/browser_dbg_stack-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_stack-03.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,71 @@
     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 scrollable.
     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, gFramesScrollingInterval;
    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", 26).then(performTest);
    1.26 +
    1.27 +    gDebuggee.gRecurseLimit = (gDebugger.gCallStackPageSize * 2) + 1;
    1.28 +    gDebuggee.recurse();
    1.29 +  });
    1.30 +}
    1.31 +
    1.32 +function performTest() {
    1.33 +  is(gDebugger.gThreadClient.state, "paused",
    1.34 +    "Should only be getting stack frames while paused.");
    1.35 +  is(gFrames.itemCount, gDebugger.gCallStackPageSize,
    1.36 +    "Should have only the max limit of frames.");
    1.37 +  is(gClassicFrames.itemCount, gDebugger.gCallStackPageSize,
    1.38 +    "Should have only the max limit of frames in the mirrored view as well.")
    1.39 +
    1.40 +  gDebugger.gThreadClient.addOneTimeListener("framesadded", () => {
    1.41 +    is(gFrames.itemCount, gDebugger.gCallStackPageSize * 2,
    1.42 +      "Should now have twice the max limit of frames.");
    1.43 +    is(gClassicFrames.itemCount, gDebugger.gCallStackPageSize * 2,
    1.44 +      "Should now have twice the max limit of frames in the mirrored view as well.");
    1.45 +
    1.46 +    gDebugger.gThreadClient.addOneTimeListener("framesadded", () => {
    1.47 +      is(gFrames.itemCount, gDebuggee.gRecurseLimit,
    1.48 +        "Should have reached the recurse limit.");
    1.49 +      is(gClassicFrames.itemCount, gDebuggee.gRecurseLimit,
    1.50 +        "Should have reached the recurse limit in the mirrored view as well.");
    1.51 +
    1.52 +      gDebugger.gThreadClient.resume(() => {
    1.53 +        window.clearInterval(gFramesScrollingInterval);
    1.54 +        closeDebuggerAndFinish(gPanel);
    1.55 +      });
    1.56 +    });
    1.57 +  });
    1.58 +
    1.59 +  gFramesScrollingInterval = window.setInterval(() => {
    1.60 +    gFrames.widget._list.scrollByIndex(-1);
    1.61 +  }, 100);
    1.62 +}
    1.63 +
    1.64 +registerCleanupFunction(function() {
    1.65 +  window.clearInterval(gFramesScrollingInterval);
    1.66 +  gFramesScrollingInterval = null;
    1.67 +
    1.68 +  gTab = null;
    1.69 +  gDebuggee = null;
    1.70 +  gPanel = null;
    1.71 +  gDebugger = null;
    1.72 +  gFrames = null;
    1.73 +  gClassicFrames = null;
    1.74 +});

mercurial