browser_canvas-frontend-stop-01.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. /**
  4. * Tests that you can stop a recording that does not have a rAF cycle.
  5. */
  6. function* ifTestingSupported() {
  7. let { target, panel } = yield initCanvasDebuggerFrontend(NO_CANVAS_URL);
  8. let { window, EVENTS, $, SnapshotsListView } = panel.panelWin;
  9. yield reload(target);
  10. let recordingStarted = once(window, EVENTS.SNAPSHOT_RECORDING_STARTED);
  11. SnapshotsListView._onRecordButtonClick();
  12. yield recordingStarted;
  13. is($("#empty-notice").hidden, true, "Empty notice not shown");
  14. is($("#waiting-notice").hidden, false, "Waiting notice shown");
  15. let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
  16. let recordingCancelled = once(window, EVENTS.SNAPSHOT_RECORDING_CANCELLED);
  17. SnapshotsListView._onRecordButtonClick();
  18. yield promise.all([recordingFinished, recordingCancelled]);
  19. ok(true, "Recording stopped and was considered failed.");
  20. is(SnapshotsListView.itemCount, 0, "No snapshots in the list.");
  21. is($("#empty-notice").hidden, false, "Empty notice shown");
  22. is($("#waiting-notice").hidden, true, "Waiting notice not shown");
  23. yield teardown(panel);
  24. finish();
  25. }