blob: 39d77b796ef09509ebd56991a02c9158a01bb836 [file] [log] [blame]
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function log(msg)
{
let p = document.createElement("p");
p.textContent = msg;
document.body.appendChild(p);
}
function runTest()
{
if (!window.internals) {
log("This test must run inside DRT/WKTR.");
return;
}
log("We should see three changed events.");
let changedEventsSeen = 0;
let handleChangedEvent = (event) => {
log("Saw webglcontextchanged event.");
changedEventsSeen++;
if (changedEventsSeen == 3)
testRunner.notifyDone();
}
document.querySelectorAll("canvas").forEach((c) =>
{
c.addEventListener("webglcontextchanged", handleChangedEvent, false);
let gl = c.getContext("webgl");
gl.clearColor(1, 0, 0, 1);
gl.clear(gl.COLOR_BUFFER_BIT);
});
let gl = document.querySelector("canvas").getContext("webgl");
window.internals.simulateWebGLContextChanged(gl);
}
window.addEventListener("load", runTest, false);
</script>
<canvas></canvas>
<canvas></canvas>
<canvas></canvas>