blob: 94731ccfbb4937cabe175de5acce4423fbf8de43 [file] [log] [blame]
<!DOCTYPE html>
<body>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="resources/webxr_util.js"></script>
<canvas id="webgl-canvas"></canvas>
<script>
xr_promise_test("webglCanvasContext can be created with an XRDevice",
(t) => {
return XRTest.simulateDeviceConnection({ supportsImmersive:true })
.then( (controller) => { return navigator.xr.requestDevice() })
.then( (device) => {
webglCanvas = document.getElementById('webgl-canvas');
gl = webglCanvas.getContext('webgl', {compatibleXRDevice: device});
assert_equals(gl.getContextAttributes().compatibleXRDevice, device);
// Check that an offscreen context behaves no different.
let offscreenCanvas = document.createElement('canvas');
let offscreenGl = webglCanvas.getContext(
'webgl', {compatibleXRDevice: device});
assert_equals(
offscreenGl.getContextAttributes().compatibleXRDevice, device);
});
});
</script>
</body>