test_vrDisplay_onvrdisplayconnect.html (1367B)
1 <html> 2 <head> 3 <title>VRDisplay onvrdisplayconnect test</title> 4 <meta name="timeout" content="long"/> 5 <meta http-equiv="Content-type" content="text/html;charset=UTF-8"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="VRSimulationDriver.js"></script> 9 <script src="WebVRHelpers.js"></script> 10 <script src="requestPresent.js"></script> 11 <script src="runVRTest.js"></script> 12 </head> 13 <body> 14 <script> 15 16 function eventAfterConnectedTest() { 17 async_test(function (test) { 18 window.addEventListener("vrdisplayconnect", () => { 19 test.done(); 20 }); 21 }, "vrdisplayconnect should fire as soon as content listens for it, \ 22 even if the VR display was already connected."); 23 } 24 25 function startTest() { 26 promise_test((test) => { 27 return attachVRDisplay(test).then(() => { 28 return promise_test((test) => { 29 return setupVRDisplay(test).then(() => { 30 VRSimulationDriver.UpdateVRDisplay(); 31 eventAfterConnectedTest(); 32 VRSimulationDriver.UpdateVRDisplay(); 33 }); 34 }); 35 }); 36 }); 37 } 38 39 runVRTest(startTest); 40 </script> 41 <iframe id="iframe1"></iframe> 42 </body> 43 </html>