xrFrame_getLightEstimate_oldSession.https.html (2013B)
1 <!DOCTYPE html> 2 <body> 3 <script src=/resources/testharness.js></script> 4 <script src=/resources/testharnessreport.js></script> 5 <script src="../resources/webxr_util.js"></script> 6 <script src="../resources/webxr_test_constants.js"></script> 7 8 <script> 9 let testName = "getLightEstimate rejects if probe is from wrong session"; 10 let testFunction = (session, controller, t, sessionObjects) => new Promise((resolve) => { 11 let staleLightProbe = null; 12 let newSession = null; 13 14 function onFrame(time, frame) { 15 t.step(() => { 16 // Attempting to get a lightEstimate with a probe created for a 17 // different session should throw an exception. 18 assert_throws_dom('InvalidStateError', () => frame.getLightEstimate(staleLightProbe)); 19 }); 20 21 // Cleanup the new session we made and then resolve. 22 resolve(newSession.end()); 23 } 24 25 // Request a default lightProbe 26 let probeInit = {reflectionFormat: session.preferredReflectionFormat }; 27 session.requestLightProbe(probeInit).then((probe) => { 28 staleLightProbe = probe; 29 return session.end(); 30 }).then(() => { 31 // Need to request a new session. 32 navigator.xr.test.simulateUserActivation( () => { 33 navigator.xr.requestSession('immersive-ar', {'requiredFeatures': ['light-estimation']}) 34 .then((session2) => { 35 36 let glLayer = new XRWebGLLayer(session2, sessionObjects.gl); 37 glLayer.context = sessionObjects.gl; 38 // Session must have a baseLayer or frame requests will be ignored. 39 session2.updateRenderState({ 40 baseLayer: glLayer 41 }); 42 newSession = session2; 43 newSession.requestAnimationFrame(onFrame); 44 }); 45 }); 46 }); 47 }); 48 49 xr_session_promise_test( 50 testName, 51 testFunction, 52 IMMERSIVE_AR_DEVICE, 53 'immersive-ar', 54 {'requiredFeatures': ['light-estimation']}); 55 56 </script> 57 </body>