browser_canvas-frontend-clear.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. /**
  4. * Tests if clearing the snapshots list works as expected.
  5. */
  6. function* ifTestingSupported() {
  7. let { target, panel } = yield initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
  8. let { window, EVENTS, SnapshotsListView } = panel.panelWin;
  9. yield reload(target);
  10. let firstRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
  11. SnapshotsListView._onRecordButtonClick();
  12. yield firstRecordingFinished;
  13. ok(true, "Finished recording a snapshot of the animation loop.");
  14. is(SnapshotsListView.itemCount, 1,
  15. "There should be one item available in the snapshots list.");
  16. let secondRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
  17. SnapshotsListView._onRecordButtonClick();
  18. yield secondRecordingFinished;
  19. ok(true, "Finished recording another snapshot of the animation loop.");
  20. is(SnapshotsListView.itemCount, 2,
  21. "There should be two items available in the snapshots list.");
  22. let clearingFinished = once(window, EVENTS.SNAPSHOTS_LIST_CLEARED);
  23. SnapshotsListView._onClearButtonClick();
  24. yield clearingFinished;
  25. ok(true, "Finished recording all snapshots.");
  26. is(SnapshotsListView.itemCount, 0,
  27. "There should be no items available in the snapshots list.");
  28. yield teardown(panel);
  29. finish();
  30. }