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 stepping buttons in the call list toolbar work as advertised. michael@0: */ michael@0: michael@0: function ifTestingSupported() { michael@0: let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_URL); michael@0: let { window, $, 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: checkSteppingButtons(1, 1, 1, 1); michael@0: is(CallsListView.selectedIndex, -1, michael@0: "There should be no selected item in the calls list view initially."); michael@0: michael@0: CallsListView._onResume(); michael@0: checkSteppingButtons(1, 1, 1, 1); michael@0: is(CallsListView.selectedIndex, 0, michael@0: "The first draw call should now be selected."); michael@0: michael@0: CallsListView._onResume(); michael@0: checkSteppingButtons(1, 1, 1, 1); michael@0: is(CallsListView.selectedIndex, 2, michael@0: "The second draw call should now be selected."); michael@0: michael@0: CallsListView._onStepOver(); michael@0: checkSteppingButtons(1, 1, 1, 1); michael@0: is(CallsListView.selectedIndex, 3, michael@0: "The next context call should now be selected."); michael@0: michael@0: CallsListView._onStepOut(); michael@0: checkSteppingButtons(0, 0, 1, 0); michael@0: is(CallsListView.selectedIndex, 7, michael@0: "The last context call should now be selected."); michael@0: michael@0: function checkSteppingButtons(resume, stepOver, stepIn, stepOut) { michael@0: if (!resume) { michael@0: is($("#resume").getAttribute("disabled"), "true", michael@0: "The resume button doesn't have the expected disabled state."); michael@0: } else { michael@0: is($("#resume").hasAttribute("disabled"), false, michael@0: "The resume button doesn't have the expected enabled state."); michael@0: } michael@0: if (!stepOver) { michael@0: is($("#step-over").getAttribute("disabled"), "true", michael@0: "The stepOver button doesn't have the expected disabled state."); michael@0: } else { michael@0: is($("#step-over").hasAttribute("disabled"), false, michael@0: "The stepOver button doesn't have the expected enabled state."); michael@0: } michael@0: if (!stepIn) { michael@0: is($("#step-in").getAttribute("disabled"), "true", michael@0: "The stepIn button doesn't have the expected disabled state."); michael@0: } else { michael@0: is($("#step-in").hasAttribute("disabled"), false, michael@0: "The stepIn button doesn't have the expected enabled state."); michael@0: } michael@0: if (!stepOut) { michael@0: is($("#step-out").getAttribute("disabled"), "true", michael@0: "The stepOut button doesn't have the expected disabled state."); michael@0: } else { michael@0: is($("#step-out").hasAttribute("disabled"), false, michael@0: "The stepOut button doesn't have the expected enabled state."); michael@0: } michael@0: } michael@0: michael@0: yield teardown(panel); michael@0: finish(); michael@0: }