|
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 is properly displayed in the UI |
|
6 * and jumping to source in the debugger for the topmost call item works. |
|
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 locationLink = $(".call-item-location", callItem.target); |
|
22 |
|
23 is($(".call-item-stack", callItem.target), null, |
|
24 "There should be no stack container available yet for the draw call."); |
|
25 |
|
26 let callStackDisplayed = once(window, EVENTS.CALL_STACK_DISPLAYED); |
|
27 EventUtils.sendMouseEvent({ type: "mousedown" }, locationLink, window); |
|
28 yield callStackDisplayed; |
|
29 |
|
30 isnot($(".call-item-stack", callItem.target), null, |
|
31 "There should be a stack container available now for the draw call."); |
|
32 is($all(".call-item-stack-fn", callItem.target).length, 4, |
|
33 "There should be 4 functions on the stack for the draw call."); |
|
34 |
|
35 let jumpedToSource = once(window, EVENTS.SOURCE_SHOWN_IN_JS_DEBUGGER); |
|
36 EventUtils.sendMouseEvent({ type: "mousedown" }, $(".call-item-location", callItem.target)); |
|
37 yield jumpedToSource; |
|
38 |
|
39 let toolbox = yield gDevTools.getToolbox(target); |
|
40 let { panelWin: { DebuggerView: view } } = toolbox.getPanel("jsdebugger"); |
|
41 |
|
42 is(view.Sources.selectedValue, SIMPLE_CANVAS_DEEP_STACK_URL, |
|
43 "The expected source was shown in the debugger."); |
|
44 is(view.editor.getCursor().line, 23, |
|
45 "The expected source line is highlighted in the debugger."); |
|
46 |
|
47 yield teardown(panel); |
|
48 finish(); |
|
49 } |