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 can be shown/hidden by double-clicking michael@0: * on a function call item. 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 view = $(".call-item-view", callItem.target); michael@0: let contents = $(".call-item-contents", callItem.target); michael@0: michael@0: is(view.hasAttribute("call-stack-populated"), false, michael@0: "The call item's view should not have the stack populated yet."); michael@0: is(view.hasAttribute("call-stack-expanded"), false, michael@0: "The call item's view should not have the stack populated yet."); 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: "dblclick" }, contents, window); michael@0: yield callStackDisplayed; michael@0: michael@0: is(view.hasAttribute("call-stack-populated"), true, michael@0: "The call item's view should have the stack populated now."); michael@0: is(view.getAttribute("call-stack-expanded"), "true", michael@0: "The call item's view should have the stack expanded now."); 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($(".call-item-stack", callItem.target).hidden, false, michael@0: "The stack container should now be visible."); 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: EventUtils.sendMouseEvent({ type: "dblclick" }, contents, window); michael@0: michael@0: is(view.hasAttribute("call-stack-populated"), true, michael@0: "The call item's view should still have the stack populated."); michael@0: is(view.getAttribute("call-stack-expanded"), "false", michael@0: "The call item's view should not have the stack expanded anymore."); michael@0: isnot($(".call-item-stack", callItem.target), null, michael@0: "There should still be a stack container available for the draw call."); michael@0: is($(".call-item-stack", callItem.target).hidden, true, michael@0: "The stack container should now be hidden."); michael@0: is($all(".call-item-stack-fn", callItem.target).length, 4, michael@0: "There should still be 4 functions on the stack for the draw call."); michael@0: michael@0: yield teardown(panel); michael@0: finish(); michael@0: }