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

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

mercurial