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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /**
michael@0 5 * Tests if the a function call's stack can be shown/hidden by double-clicking
michael@0 6 * on a function call item.
michael@0 7 */
michael@0 8
michael@0 9 function ifTestingSupported() {
michael@0 10 let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_DEEP_STACK_URL);
michael@0 11 let { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
michael@0 12
michael@0 13 yield reload(target);
michael@0 14
michael@0 15 let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
michael@0 16 let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
michael@0 17 SnapshotsListView._onRecordButtonClick();
michael@0 18 yield promise.all([recordingFinished, callListPopulated]);
michael@0 19
michael@0 20 let callItem = CallsListView.getItemAtIndex(2);
michael@0 21 let view = $(".call-item-view", callItem.target);
michael@0 22 let contents = $(".call-item-contents", callItem.target);
michael@0 23
michael@0 24 is(view.hasAttribute("call-stack-populated"), false,
michael@0 25 "The call item's view should not have the stack populated yet.");
michael@0 26 is(view.hasAttribute("call-stack-expanded"), false,
michael@0 27 "The call item's view should not have the stack populated yet.");
michael@0 28 is($(".call-item-stack", callItem.target), null,
michael@0 29 "There should be no stack container available yet for the draw call.");
michael@0 30
michael@0 31 let callStackDisplayed = once(window, EVENTS.CALL_STACK_DISPLAYED);
michael@0 32 EventUtils.sendMouseEvent({ type: "dblclick" }, contents, window);
michael@0 33 yield callStackDisplayed;
michael@0 34
michael@0 35 is(view.hasAttribute("call-stack-populated"), true,
michael@0 36 "The call item's view should have the stack populated now.");
michael@0 37 is(view.getAttribute("call-stack-expanded"), "true",
michael@0 38 "The call item's view should have the stack expanded now.");
michael@0 39 isnot($(".call-item-stack", callItem.target), null,
michael@0 40 "There should be a stack container available now for the draw call.");
michael@0 41 is($(".call-item-stack", callItem.target).hidden, false,
michael@0 42 "The stack container should now be visible.");
michael@0 43 is($all(".call-item-stack-fn", callItem.target).length, 4,
michael@0 44 "There should be 4 functions on the stack for the draw call.");
michael@0 45
michael@0 46 EventUtils.sendMouseEvent({ type: "dblclick" }, contents, window);
michael@0 47
michael@0 48 is(view.hasAttribute("call-stack-populated"), true,
michael@0 49 "The call item's view should still have the stack populated.");
michael@0 50 is(view.getAttribute("call-stack-expanded"), "false",
michael@0 51 "The call item's view should not have the stack expanded anymore.");
michael@0 52 isnot($(".call-item-stack", callItem.target), null,
michael@0 53 "There should still be a stack container available for the draw call.");
michael@0 54 is($(".call-item-stack", callItem.target).hidden, true,
michael@0 55 "The stack container should now be hidden.");
michael@0 56 is($all(".call-item-stack-fn", callItem.target).length, 4,
michael@0 57 "There should still be 4 functions on the stack for the draw call.");
michael@0 58
michael@0 59 yield teardown(panel);
michael@0 60 finish();
michael@0 61 }

mercurial