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

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

mercurial