browser/devtools/canvasdebugger/test/browser_canvas-frontend-img-screenshots.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /**
michael@0 5 * Tests if screenshots are properly displayed in the UI.
michael@0 6 */
michael@0 7
michael@0 8 function ifTestingSupported() {
michael@0 9 let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_URL);
michael@0 10 let { window, $, EVENTS, SnapshotsListView } = panel.panelWin;
michael@0 11
michael@0 12 yield reload(target);
michael@0 13
michael@0 14 let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
michael@0 15 let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
michael@0 16 let screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
michael@0 17 SnapshotsListView._onRecordButtonClick();
michael@0 18 yield promise.all([recordingFinished, callListPopulated, screenshotDisplayed]);
michael@0 19
michael@0 20 is($("#screenshot-container").hidden, false,
michael@0 21 "The screenshot container should now be visible.");
michael@0 22
michael@0 23 is($("#screenshot-dimensions").getAttribute("value"), "128 x 128",
michael@0 24 "The screenshot dimensions label has the expected value.");
michael@0 25
michael@0 26 is($("#screenshot-image").getAttribute("flipped"), "false",
michael@0 27 "The screenshot element should not be flipped vertically.");
michael@0 28
michael@0 29 ok(window.getComputedStyle($("#screenshot-image")).backgroundImage.contains("#screenshot-rendering"),
michael@0 30 "The screenshot element should have an offscreen canvas element as a background.");
michael@0 31
michael@0 32 yield teardown(panel);
michael@0 33 finish();
michael@0 34 }

mercurial