browser/devtools/canvasdebugger/test/browser_canvas-frontend-record-01.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /**
michael@0 5 * Tests whether the frontend behaves correctly while reording a snapshot.
michael@0 6 */
michael@0 7
michael@0 8 function ifTestingSupported() {
michael@0 9 let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_URL);
michael@0 10 let { window, EVENTS, $, SnapshotsListView } = panel.panelWin;
michael@0 11
michael@0 12 yield reload(target);
michael@0 13
michael@0 14 is($("#record-snapshot").hasAttribute("checked"), false,
michael@0 15 "The 'record snapshot' button should initially be unchecked.");
michael@0 16 is($("#record-snapshot").hasAttribute("disabled"), false,
michael@0 17 "The 'record snapshot' button should initially be enabled.");
michael@0 18 is($("#record-snapshot").hasAttribute("hidden"), false,
michael@0 19 "The 'record snapshot' button should now be visible.");
michael@0 20
michael@0 21 is(SnapshotsListView.itemCount, 0,
michael@0 22 "There should be no items available in the snapshots list view.");
michael@0 23 is(SnapshotsListView.selectedIndex, -1,
michael@0 24 "There should be no selected item in the snapshots list view.");
michael@0 25
michael@0 26 let recordingStarted = once(window, EVENTS.SNAPSHOT_RECORDING_STARTED);
michael@0 27 let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
michael@0 28 SnapshotsListView._onRecordButtonClick();
michael@0 29
michael@0 30 yield recordingStarted;
michael@0 31 ok(true, "Started recording a snapshot of the animation loop.");
michael@0 32
michael@0 33 is($("#record-snapshot").getAttribute("checked"), "true",
michael@0 34 "The 'record snapshot' button should now be checked.");
michael@0 35 is($("#record-snapshot").getAttribute("disabled"), "true",
michael@0 36 "The 'record snapshot' button should now be disabled.");
michael@0 37 is($("#record-snapshot").hasAttribute("hidden"), false,
michael@0 38 "The 'record snapshot' button should still be visible.");
michael@0 39
michael@0 40 is(SnapshotsListView.itemCount, 1,
michael@0 41 "There should be one item available in the snapshots list view now.");
michael@0 42 is(SnapshotsListView.selectedIndex, -1,
michael@0 43 "There should be no selected item in the snapshots list view yet.");
michael@0 44
michael@0 45 yield recordingFinished;
michael@0 46 ok(true, "Finished recording a snapshot of the animation loop.");
michael@0 47
michael@0 48 is($("#record-snapshot").hasAttribute("checked"), false,
michael@0 49 "The 'record snapshot' button should now be unchecked.");
michael@0 50 is($("#record-snapshot").hasAttribute("disabled"), false,
michael@0 51 "The 'record snapshot' button should now be re-enabled.");
michael@0 52 is($("#record-snapshot").hasAttribute("hidden"), false,
michael@0 53 "The 'record snapshot' button should still be visible.");
michael@0 54
michael@0 55 is(SnapshotsListView.itemCount, 1,
michael@0 56 "There should still be only one item available in the snapshots list view.");
michael@0 57 is(SnapshotsListView.selectedIndex, 0,
michael@0 58 "There should be one selected item in the snapshots list view now.");
michael@0 59
michael@0 60 yield teardown(panel);
michael@0 61 finish();
michael@0 62 }

mercurial