browser/devtools/canvasdebugger/test/browser_canvas-frontend-clear.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:71fd1839b331
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 /**
5 * Tests if clearing the snapshots list works as expected.
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 let firstRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
15 SnapshotsListView._onRecordButtonClick();
16
17 yield firstRecordingFinished;
18 ok(true, "Finished recording a snapshot of the animation loop.");
19
20 is(SnapshotsListView.itemCount, 1,
21 "There should be one item available in the snapshots list.");
22
23 let secondRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
24 SnapshotsListView._onRecordButtonClick();
25
26 yield secondRecordingFinished;
27 ok(true, "Finished recording another snapshot of the animation loop.");
28
29 is(SnapshotsListView.itemCount, 2,
30 "There should be two items available in the snapshots list.");
31
32 let clearingFinished = once(window, EVENTS.SNAPSHOTS_LIST_CLEARED);
33 SnapshotsListView._onClearButtonClick();
34
35 yield clearingFinished;
36 ok(true, "Finished recording all snapshots.");
37
38 is(SnapshotsListView.itemCount, 0,
39 "There should be no items available in the snapshots list.");
40
41 yield teardown(panel);
42 finish();
43 }

mercurial