gecko-dev/dom/vr/test/VRSimulationDriver.js
Daosheng Mu c7e761255a Bug 1306493 - Part 2: Make vrMockDisplay to be the global var in VRSimulationDriver; r=kip
MozReview-Commit-ID: HTHqehkUMwC

--HG--
extra : rebase_source : dee4245fcdee8f054703287fc5c321bd55ffc8f1
2017-03-13 13:09:19 +08:00

52 lines
1.4 KiB
JavaScript

var VRServiceTest;
var vrMockDisplay;
var VRSimulationDriver = (function() {
"use strict";
var AttachWebVRDisplay = function() {
var promise = VRServiceTest.attachVRDisplay("VRDisplayTest");
promise.then(function (display) {
assert_true(display != null, "AttachWebVRDisplay should success.");
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 UpdateVRDisplay = function() {
vrMockDisplay.update();
}
var API = {
AttachWebVRDisplay: AttachWebVRDisplay,
SetVRDisplayPose: SetVRDisplayPose,
SetEyeResolution: SetEyeResolution,
SetEyeParameter: SetEyeParameter,
UpdateVRDisplay: UpdateVRDisplay,
none: false
};
return API;
}());