blob: a75d993e2e49e357d6cf1083bc054256393e5734 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
if (window.internals)
window.internals.settings.setWebGPUEnabled(true);
function load() {
window.contextWebGPU = document.body.appendChild(document.createElement("canvas")).getContext("gpu");
runTest();
}
function test()
{
let suite = InspectorTest.createAsyncSuite("Canvas.resolveCanvasContextWebGPU");
suite.addTestCase({
name: `Canvas.resolveCanvasContextWebGPU.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.WebGPU);
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, "GPUCanvasContext", `Payload should have className "GPUCanvasContext".`);
})
.then(resolve, reject);
}
});
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="load()">
<p>Tests for the Canvas.resolveCanvasContext command for WebGPU contexts.</p>
</body>
</html>