blob: 6df42a09755dfde618432a061f081472e8d4284f [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
function load() {
window.contextWebGL = document.body.appendChild(document.createElement("canvas")).getContext("webgl");
runTest();
}
function test()
{
let suite = InspectorTest.createAsyncSuite("Canvas.resolveCanvasContextWebGL");
suite.addTestCase({
name: `Canvas.resolveCanvasContextWebGL.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.WebGL);
if (!canvas) {
reject(`Missing Canvas.`);
return;
}
const objectGroup = "test";
CanvasAgent.resolveCanvasContext(canvas.identifier, objectGroup)
.then(({object}) => {
InspectorTest.expectEqual(object.type, "object", `Payload should have type "object".`);
InspectorTest.expectEqual(object.className, "WebGLRenderingContext", `Payload should have className "WebGLRenderingContext".`);
})
.then(resolve, reject);
}
});
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="load()">
<p>Tests for the Canvas.resolveCanvasContext command for WebGL contexts.</p>
</body>
</html>