michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Tests if the a function call's stack is properly displayed in the UI michael@0: * and jumping to source in the debugger for the topmost call item works. michael@0: */ michael@0: michael@0: function ifTestingSupported() { michael@0: let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_DEEP_STACK_URL); michael@0: let { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin; michael@0: michael@0: yield reload(target); michael@0: michael@0: let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED); michael@0: let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED); michael@0: SnapshotsListView._onRecordButtonClick(); michael@0: yield promise.all([recordingFinished, callListPopulated]); michael@0: michael@0: let callItem = CallsListView.getItemAtIndex(2); michael@0: let locationLink = $(".call-item-location", callItem.target); michael@0: michael@0: is($(".call-item-stack", callItem.target), null, michael@0: "There should be no stack container available yet for the draw call."); michael@0: michael@0: let callStackDisplayed = once(window, EVENTS.CALL_STACK_DISPLAYED); michael@0: EventUtils.sendMouseEvent({ type: "mousedown" }, locationLink, window); michael@0: yield callStackDisplayed; michael@0: michael@0: isnot($(".call-item-stack", callItem.target), null, michael@0: "There should be a stack container available now for the draw call."); michael@0: is($all(".call-item-stack-fn", callItem.target).length, 4, michael@0: "There should be 4 functions on the stack for the draw call."); michael@0: michael@0: let jumpedToSource = once(window, EVENTS.SOURCE_SHOWN_IN_JS_DEBUGGER); michael@0: EventUtils.sendMouseEvent({ type: "mousedown" }, $(".call-item-location", callItem.target)); michael@0: yield jumpedToSource; michael@0: michael@0: let toolbox = yield gDevTools.getToolbox(target); michael@0: let { panelWin: { DebuggerView: view } } = toolbox.getPanel("jsdebugger"); michael@0: michael@0: is(view.Sources.selectedValue, SIMPLE_CANVAS_DEEP_STACK_URL, michael@0: "The expected source was shown in the debugger."); michael@0: is(view.editor.getCursor().line, 23, michael@0: "The expected source line is highlighted in the debugger."); michael@0: michael@0: yield teardown(panel); michael@0: finish(); michael@0: }