blob: 1eb33fe3f9d3a10ee5c4c1568a83da1416088f06 [file] [log] [blame]
z<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
if (window.internals)
window.internals.settings.setWebGPUEnabled(true);
async function createClient() {
let adapter = await navigator.gpu.requestAdapter();
let device = await adapter.requestDevice();
let context = document.createElement("canvas").getContext("gpu");
context.configureSwapChain({device, format: "bgra8unorm"});
}
function test() {
let suite = InspectorTest.createAsyncSuite("Canvas.requestClientNodes.WebGPU");
function logClientNodes(clientNodes) {
for (let clientNode of clientNodes) {
if (clientNode)
InspectorTest.pass(`Client node "${clientNode.appropriateSelectorFor()}" is valid.`);
else
InspectorTest.fail("Invalid client node.");
}
}
suite.addTestCase({
name: "Canvas.requestClientNodes.WebGPU.Create",
description: "Check that creating a WebGPU device client node is tracked correctly.",
test(resolve, reject) {
WI.Canvas.awaitEvent(WI.Canvas.Event.ClientNodesChanged)
.then((event) => {
InspectorTest.assert(event.target.contextType === WI.Canvas.ContextType.WebGPU);
event.target.requestClientNodes((clientNodes) => {
InspectorTest.expectEqual(clientNodes.length, 1, "There should be one client node.");
logClientNodes(clientNodes);
resolve();
});
});
InspectorTest.evaluateInPage(`createClient()`).catch(reject);
}
});
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="runTest()">
<p>Test that CanvasAgent tracks changes in the client nodes of a WebGPU device.</p>
</body>
</html>