test_vrController_displayId.html (1409B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>VRController DisplayId</title> 5 <meta name="timeout" content="long"/> 6 <meta http-equiv="Content-type" content="text/html;charset=UTF-8"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script src="VRSimulationDriver.js"></script> 10 <script src="runVRTest.js"></script> 11 </head> 12 <body> 13 <script> 14 "use strict"; 15 var vrDisplay; 16 var controllerCount = 0; 17 18 function addController() { 19 promise_test((test) => { 20 return VRSimulationDriver.AttachVRController().then((controller) => { 21 controller.newButtonEvent(0, true); 22 }); 23 }, "Finish to add VRController."); 24 } 25 26 function startTest() { 27 promise_test((test) => { 28 return VRSimulationDriver.AttachWebVRDisplay().then(() => { 29 return navigator.getVRDisplays().then((displays) => { 30 vrDisplay = displays[0]; 31 assert_equals(displays.length, 1, "displays.length must be one after attach."); 32 assert_equals(vrDisplay.displayName, "Puppet HMD", "display.displayName must be equal to 'Puppet HMD'."); 33 addController(); 34 addController(); 35 }); 36 }); 37 }, "Finish to add VRDisplay."); 38 } 39 40 runVRTest(startTest); 41 </script> 42 </body> 43 </html>