blob: d8e0831e6bc3a2965e8d42cfd587e2dfa14d2c78 [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 = Array.from(WI.canvasManager.canvasCollection).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>