webGLCanvasContext_makecompatible_reentrant.https.html (1728B)
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> 7 8 function testNonReentrant(t, gl) { 9 return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE) 10 .then((controller) => { 11 assert_false(gl.getContextAttributes().xrCompatible); 12 return gl.makeXRCompatible(); 13 }).then(() => { 14 assert_true(gl.getContextAttributes().xrCompatible); 15 return gl.makeXRCompatible(); 16 }).then(() => { 17 assert_true(gl.getContextAttributes().xrCompatible); 18 }); 19 } 20 21 xr_promise_test( 22 "Verify promise from a non-reentrant call to makeXRCompatible() is resolved for webgl", 23 testNonReentrant, null, 'webgl'); 24 xr_promise_test( 25 "Verify promise from a non-reentrant call to makeXRCompatible() is resolved for webgl2", 26 testNonReentrant, null, 'webgl2'); 27 28 function testReentrant(t, gl) { 29 return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE) 30 .then((controller) => { 31 assert_false(gl.getContextAttributes().xrCompatible); 32 33 return Promise.all([gl.makeXRCompatible(), 34 gl.makeXRCompatible(), 35 gl.makeXRCompatible()]); 36 }).then(() => { 37 assert_true(gl.getContextAttributes().xrCompatible); 38 }); 39 } 40 41 xr_promise_test( 42 "Verify promises from reentrant calls to makeXRCompatible() are resolved for webgl", 43 testReentrant, null, 'webgl'); 44 xr_promise_test( 45 "Verify promises from reentrant calls to makeXRCompatible() are resolved for webgl2", 46 testReentrant, null, 'webgl2'); 47 48 </script>