browser_canvas-frontend-img-screenshots.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. /**
  4. * Tests if screenshots are properly displayed in the UI.
  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 recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
  11. let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
  12. let screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
  13. SnapshotsListView._onRecordButtonClick();
  14. yield promise.all([recordingFinished, callListPopulated, screenshotDisplayed]);
  15. is($("#screenshot-container").hidden, false,
  16. "The screenshot container should now be visible.");
  17. is($("#screenshot-dimensions").getAttribute("value"), "128" + "\u00D7" + "128",
  18. "The screenshot dimensions label has the expected value.");
  19. is($("#screenshot-image").getAttribute("flipped"), "false",
  20. "The screenshot element should not be flipped vertically.");
  21. ok(window.getComputedStyle($("#screenshot-image")).backgroundImage.includes("#screenshot-rendering"),
  22. "The screenshot element should have an offscreen canvas element as a background.");
  23. yield teardown(panel);
  24. finish();
  25. }