Bug 1641531 [wpt PR 23827] - Implement the ability to request XR compatibility on...
[gecko.git] / testing / web-platform / tests / webxr / webGLCanvasContext_makecompatible_reentrant.https.html
blobf412c6fb2e00caae8eafe6407038acd26d592dd4
1 <!DOCTYPE html>
2 <script src="/resources/testharness.js"></script>
3 <script src="/resources/testharnessreport.js"></script>
4 <script src="resources/webxr_test_constants.js"></script>
5 <script src="resources/webxr_util.js"></script>
6 <script>
8 xr_promise_test(
9 "Verify promise from a non-reentrant to makeXRCompatible() is resolved",
10 (t) => {
11 var gl = document.createElement('canvas').getContext('webgl');
12 return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE)
13 .then((controller) => {
14 assert_false(gl.getContextAttributes().xrCompatible);
15 return gl.makeXRCompatible();
16 }).then(() => {
17 assert_true(gl.getContextAttributes().xrCompatible);
18 return gl.makeXRCompatible();
19 }).then(() => {
20 assert_true(gl.getContextAttributes().xrCompatible);
21 });
22 });
24 xr_promise_test(
25 "Verify promises from reentrant calls to makeXRCompatible() are resolved",
26 (t) => {
27 var gl = document.createElement('canvas').getContext('webgl');
28 return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE)
29 .then((controller) => {
30 assert_false(gl.getContextAttributes().xrCompatible);
32 return Promise.all([gl.makeXRCompatible(),
33 gl.makeXRCompatible(),
34 gl.makeXRCompatible()]);
35 }).then(() => {
36 assert_true(gl.getContextAttributes().xrCompatible);
37 });
38 });
40 </script>