browser/devtools/canvasdebugger/test/browser_canvas-frontend-call-stack-03.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/canvasdebugger/test/browser_canvas-frontend-call-stack-03.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,61 @@
     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 + * Tests if the a function call's stack can be shown/hidden by double-clicking
     1.9 + * on a function call item.
    1.10 + */
    1.11 +
    1.12 +function ifTestingSupported() {
    1.13 +  let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_DEEP_STACK_URL);
    1.14 +  let { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
    1.15 +
    1.16 +  yield reload(target);
    1.17 +
    1.18 +  let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
    1.19 +  let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
    1.20 +  SnapshotsListView._onRecordButtonClick();
    1.21 +  yield promise.all([recordingFinished, callListPopulated]);
    1.22 +
    1.23 +  let callItem = CallsListView.getItemAtIndex(2);
    1.24 +  let view = $(".call-item-view", callItem.target);
    1.25 +  let contents = $(".call-item-contents", callItem.target);
    1.26 +
    1.27 +  is(view.hasAttribute("call-stack-populated"), false,
    1.28 +    "The call item's view should not have the stack populated yet.");
    1.29 +  is(view.hasAttribute("call-stack-expanded"), false,
    1.30 +    "The call item's view should not have the stack populated yet.");
    1.31 +  is($(".call-item-stack", callItem.target), null,
    1.32 +    "There should be no stack container available yet for the draw call.");
    1.33 +
    1.34 +  let callStackDisplayed = once(window, EVENTS.CALL_STACK_DISPLAYED);
    1.35 +  EventUtils.sendMouseEvent({ type: "dblclick" }, contents, window);
    1.36 +  yield callStackDisplayed;
    1.37 +
    1.38 +  is(view.hasAttribute("call-stack-populated"), true,
    1.39 +    "The call item's view should have the stack populated now.");
    1.40 +  is(view.getAttribute("call-stack-expanded"), "true",
    1.41 +    "The call item's view should have the stack expanded now.");
    1.42 +  isnot($(".call-item-stack", callItem.target), null,
    1.43 +    "There should be a stack container available now for the draw call.");
    1.44 +  is($(".call-item-stack", callItem.target).hidden, false,
    1.45 +    "The stack container should now be visible.");
    1.46 +  is($all(".call-item-stack-fn", callItem.target).length, 4,
    1.47 +    "There should be 4 functions on the stack for the draw call.");
    1.48 +
    1.49 +  EventUtils.sendMouseEvent({ type: "dblclick" }, contents, window);
    1.50 +
    1.51 +  is(view.hasAttribute("call-stack-populated"), true,
    1.52 +    "The call item's view should still have the stack populated.");
    1.53 +  is(view.getAttribute("call-stack-expanded"), "false",
    1.54 +    "The call item's view should not have the stack expanded anymore.");
    1.55 +  isnot($(".call-item-stack", callItem.target), null,
    1.56 +    "There should still be a stack container available for the draw call.");
    1.57 +  is($(".call-item-stack", callItem.target).hidden, true,
    1.58 +    "The stack container should now be hidden.");
    1.59 +  is($all(".call-item-stack-fn", callItem.target).length, 4,
    1.60 +    "There should still be 4 functions on the stack for the draw call.");
    1.61 +
    1.62 +  yield teardown(panel);
    1.63 +  finish();
    1.64 +}

mercurial