blob: 9af5894de2df64cd3b35d03eb38090b19c9e464b [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
if (window.internals)
window.internals.settings.setWebGL2Enabled(true);
function load() {
window.contextWebGL2 = document.createElement("canvas").getContext("webgl2");
window.contextWebGL2.clearColor(0, 0, 1, 0.5); // Half-transparent blue
window.contextWebGL2.clear(window.contextWebGL2.COLOR_BUFFER_BIT);
runTest();
}
function test() {
let suite = InspectorTest.createAsyncSuite("Canvas.requestContentWebGL2");
suite.addTestCase({
name: "Canvas.requestContentWebGL2.validCanvasId",
description: "Get the base64 encoded data for the WebGL2 canvas on the page.",
test(resolve, reject) {
let canvas = WI.canvasManager.canvases.find((canvas) => canvas.contextType === WI.Canvas.ContextType.WebGL2);
if (!canvas) {
reject(`Missing Canvas.`);
return;
}
CanvasAgent.requestContent(canvas.identifier)
.then(({content}) => InspectorTest.log(content))
.then(resolve, reject);
}
});
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="load()">
<p>Test that CanvasAgent.requestContent can retrieve a dataURL with the current content of the WebGL2 canvas.</p>
</body>
</html>