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 whether the frontend behaves correctly while reording a snapshot. 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 } = panel.panelWin; michael@0: michael@0: yield reload(target); michael@0: michael@0: is($("#record-snapshot").hasAttribute("checked"), false, michael@0: "The 'record snapshot' button should initially be unchecked."); michael@0: is($("#record-snapshot").hasAttribute("disabled"), false, michael@0: "The 'record snapshot' button should initially be enabled."); michael@0: is($("#record-snapshot").hasAttribute("hidden"), false, michael@0: "The 'record snapshot' button should now be visible."); michael@0: michael@0: is(SnapshotsListView.itemCount, 0, michael@0: "There should be no items available in the snapshots list view."); michael@0: is(SnapshotsListView.selectedIndex, -1, michael@0: "There should be no selected item in the snapshots list view."); michael@0: michael@0: let recordingStarted = once(window, EVENTS.SNAPSHOT_RECORDING_STARTED); michael@0: let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED); michael@0: SnapshotsListView._onRecordButtonClick(); michael@0: michael@0: yield recordingStarted; michael@0: ok(true, "Started recording a snapshot of the animation loop."); michael@0: michael@0: is($("#record-snapshot").getAttribute("checked"), "true", michael@0: "The 'record snapshot' button should now be checked."); michael@0: is($("#record-snapshot").getAttribute("disabled"), "true", michael@0: "The 'record snapshot' button should now be disabled."); michael@0: is($("#record-snapshot").hasAttribute("hidden"), false, michael@0: "The 'record snapshot' button should still be visible."); michael@0: michael@0: is(SnapshotsListView.itemCount, 1, michael@0: "There should be one item available in the snapshots list view now."); michael@0: is(SnapshotsListView.selectedIndex, -1, michael@0: "There should be no selected item in the snapshots list view yet."); michael@0: michael@0: yield recordingFinished; michael@0: ok(true, "Finished recording a snapshot of the animation loop."); michael@0: michael@0: is($("#record-snapshot").hasAttribute("checked"), false, michael@0: "The 'record snapshot' button should now be unchecked."); michael@0: is($("#record-snapshot").hasAttribute("disabled"), false, michael@0: "The 'record snapshot' button should now be re-enabled."); michael@0: is($("#record-snapshot").hasAttribute("hidden"), false, michael@0: "The 'record snapshot' button should still be visible."); michael@0: michael@0: is(SnapshotsListView.itemCount, 1, michael@0: "There should still be only one item available in the snapshots list view."); michael@0: is(SnapshotsListView.selectedIndex, 0, michael@0: "There should be one selected item in the snapshots list view now."); michael@0: michael@0: yield teardown(panel); michael@0: finish(); michael@0: }