blob: 1151f917a7a23e6fe332b43a9a3406a9cfe90a54 [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.body.appendChild(document.createElement("canvas")).getContext("webgl2");
runTest();
}
function test()
{
let suite = InspectorTest.createAsyncSuite("Canvas.resolveContextWebGL2");
suite.addTestCase({
name: `Canvas.resolveContextWebGL2.validIdentifier`,
description: "Should return a valid object for the given canvas identifier.",
test(resolve, reject) {
let canvas = WI.canvasManager.canvases.find((canvas) => canvas.contextType === WI.Canvas.ContextType.WebGL2);
if (!canvas) {
reject(`Missing Canvas.`);
return;
}
const objectGroup = "test";
CanvasAgent.resolveContext(canvas.identifier, objectGroup)
.then(({object}) => {
InspectorTest.expectEqual(object.type, "object", `Payload should have type "object".`);
InspectorTest.expectEqual(object.className, "WebGL2RenderingContext", `Payload should have className "WebGL2RenderingContext".`);
})
.then(resolve, reject);
}
});
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="load()">
<p>Tests for the Canvas.resolveContext command for WebGL2 contexts.</p>
</body>
</html>