From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- dom/vr/test/reftest/VRSimulationDriver.js | 60 +++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 dom/vr/test/reftest/VRSimulationDriver.js (limited to 'dom/vr/test/reftest/VRSimulationDriver.js') diff --git a/dom/vr/test/reftest/VRSimulationDriver.js b/dom/vr/test/reftest/VRSimulationDriver.js new file mode 100644 index 0000000000..971cdb8626 --- /dev/null +++ b/dom/vr/test/reftest/VRSimulationDriver.js @@ -0,0 +1,60 @@ + +var VRServiceTest; +var vrMockDisplay; + +var VRSimulationDriver = (function() { +"use strict"; + +var AttachWebVRDisplay = function() { + if (vrMockDisplay) { + // Avoid creating multiple displays + return Promise.resolve(vrMockDisplay); + } + var promise = VRServiceTest.attachVRDisplay("VRDisplayTest"); + promise.then(function (display) { + vrMockDisplay = display; + }); + + return promise; +}; + +var SetVRDisplayPose = function(position, + linearVelocity, linearAcceleration, + orientation, angularVelocity, + angularAcceleration) { + vrMockDisplay.setPose(position, linearVelocity, linearAcceleration, + orientation, angularVelocity, angularAcceleration); +}; + +var SetEyeResolution = function(width, height) { + vrMockDisplay.setEyeResolution(width, height); +} + +var SetEyeParameter = function(eye, offsetX, offsetY, offsetZ, + upDegree, rightDegree, downDegree, leftDegree) { + vrMockDisplay.setEyeParameter(eye, offsetX, offsetY, offsetZ, upDegree, rightDegree, + downDegree, leftDegree); +} + +var SetMountState = function(isMounted) { + vrMockDisplay.setMountState(isMounted); +} + +var UpdateVRDisplay = function() { + vrMockDisplay.update(); +} + +var API = { + AttachWebVRDisplay: AttachWebVRDisplay, + SetVRDisplayPose: SetVRDisplayPose, + SetEyeResolution: SetEyeResolution, + SetEyeParameter: SetEyeParameter, + SetMountState: SetMountState, + UpdateVRDisplay: UpdateVRDisplay, + + none: false +}; + +return API; + +}()); \ No newline at end of file -- cgit v1.2.3