Backed out changeset 498baf1613db (bug 1375816)

This commit is contained in:
Sebastian Hengst 2017-07-18 11:48:22 +02:00
Родитель b371a6a665
Коммит b5972de663
9 изменённых файлов: 18 добавлений и 89 удалений

Просмотреть файл

@ -41,15 +41,6 @@ var UpdateVRDisplay = function() {
vrMockDisplay.update();
}
var AttachVRController = function() {
var promise = VRServiceTest.attachVRController("VRControllerTest");
promise.then(function (controller) {
assert_true(controller != null, "AttachVRController should success.");
});
return promise;
}
var API = {
AttachWebVRDisplay: AttachWebVRDisplay,
SetVRDisplayPose: SetVRDisplayPose,
@ -57,7 +48,6 @@ var API = {
SetEyeParameter: SetEyeParameter,
SetMountState: SetMountState,
UpdateVRDisplay: UpdateVRDisplay,
AttachVRController: AttachVRController,
none: false
};

Просмотреть файл

@ -5,9 +5,6 @@ support-files =
runVRTest.js
WebVRHelpers.js
[test_vrController_displayId.html]
# Enable Linux after Bug 1310655 # TIMED_OUT for Mac in release nonE10s, and Android.
skip-if = (os != "win" && release_or_beta) || (os == "mac" && !e10s && !debug) || (os == "android")
[test_vrDisplay_canvas2d.html]
skip-if = (os != "win" && release_or_beta) # Enable Linux after Bug 1310655
[test_vrDisplay_exitPresent.html]

Просмотреть файл

@ -1,54 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>VRController DisplayId</title>
<meta name="timeout" content="long"/>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="VRSimulationDriver.js"></script>
<script src="runVRTest.js"></script>
</head>
<body>
<script>
"use strict";
var vrDisplay;
var controllerCount = 0;
function addController() {
promise_test((test) => {
return VRSimulationDriver.AttachVRController().then((controller) => {
controller.newButtonEvent(0, true);
});
}, "Finish to add VRController.");
}
function listenControllerEvents() {
async_test(function(t) {
window.addEventListener("gamepadconnected", function() {
var gamepads = navigator.getGamepads();
assert_equals(gamepads[controllerCount].displayId, vrDisplay.displayId, "gamepad.displayId should be equal to vrDisplay.");
++controllerCount;
if (controllerCount == 1) {
t.done();
}
});
}, "Finish to verify VRController.displayId.");
}
function startTest() {
promise_test((test) => {
listenControllerEvents();
return navigator.getVRDisplays().then((displays) => {
vrDisplay = displays[0];
assert_equals(displays.length, 1, "displays.length must be one after attach.");
assert_equals(displays[0].displayId, 1, "displayId must be one.");
addController();
});
}, "Finish to add VRDisplay.");
}
runVRTest(startTest);
</script>
</body>
</html>

Просмотреть файл

@ -12,11 +12,13 @@
</head>
<body id="body">
<canvas id="webglCanvas"></canvas>
<div id="testDiv"></div>
<script>
"use strict";
var vrDisplay;
var vrRAF;
var canvas = document.getElementById('webglCanvas');
var div = document.getElementById('testDiv');
function startTest() {
promise_test((test) => {
return attachVRDisplay(test).then(() => {

Просмотреть файл

@ -37,7 +37,6 @@ public:
void NotifyVsync(const TimeStamp& aVsyncTimestamp);
void NotifyVRVsync(const uint32_t& aDisplayID);
void RefreshVRDisplays(bool aMustDispatch = false);
void RefreshVRControllers();
void ScanForControllers();
void RemoveControllers();
template<class T> void NotifyGamepadChange(const T& aInfo);
@ -68,6 +67,7 @@ private:
void Shutdown();
void DispatchVRDisplayInfoUpdate();
void RefreshVRControllers();
typedef nsTHashtable<nsRefPtrHashKey<VRManagerParent>> VRManagerParentSet;
VRManagerParentSet mVRManagerParents;

Просмотреть файл

@ -492,12 +492,14 @@ VRDisplayPuppet::NotifyVSync()
VRDisplayHost::NotifyVSync();
}
VRControllerPuppet::VRControllerPuppet(dom::GamepadHand aHand, uint32_t aDisplayID)
: VRControllerHost(VRDeviceType::Puppet, aHand, aDisplayID)
VRControllerPuppet::VRControllerPuppet(dom::GamepadHand aHand)
: VRControllerHost(VRDeviceType::Puppet)
, mButtonPressState(0)
{
MOZ_COUNT_CTOR_INHERITED(VRControllerPuppet, VRControllerHost);
mControllerInfo.mControllerName.AssignLiteral("Puppet Gamepad");
mControllerInfo.mMappingType = GamepadMappingType::_empty;
mControllerInfo.mHand = aHand;
mControllerInfo.mNumButtons = kNumPuppetButtonMask;
mControllerInfo.mNumAxes = kNumPuppetAxis;
mControllerInfo.mNumHaptics = kNumPuppetHaptcs;
@ -738,11 +740,6 @@ VRSystemManagerPuppet::GetControllers(nsTArray<RefPtr<VRControllerHost>>& aContr
void
VRSystemManagerPuppet::ScanForControllers()
{
// mPuppetHMD is available after VRDisplay is created
// at GetHMDs().
if (!mPuppetHMD) {
return;
}
// We make VRSystemManagerPuppet has two controllers always.
const uint32_t newControllerCount = 2;
@ -753,8 +750,7 @@ VRSystemManagerPuppet::ScanForControllers()
for (uint32_t i = 0; i < newControllerCount; ++i) {
dom::GamepadHand hand = (i % 2) ? dom::GamepadHand::Right :
dom::GamepadHand::Left;
RefPtr<VRControllerPuppet> puppetController = new VRControllerPuppet(hand,
mPuppetHMD->GetDisplayInfo().GetDisplayID());
RefPtr<VRControllerPuppet> puppetController = new VRControllerPuppet(hand);
mPuppetController.AppendElement(puppetController);
// Not already present, add it.

Просмотреть файл

@ -71,7 +71,7 @@ private:
class VRControllerPuppet : public VRControllerHost
{
public:
explicit VRControllerPuppet(dom::GamepadHand aHand, uint32_t aDisplayID);
explicit VRControllerPuppet(dom::GamepadHand aHand);
void SetButtonPressState(uint32_t aButton, bool aPressed);
uint64_t GetButtonPressState();
void SetButtonTouchState(uint32_t aButton, bool aTouched);

Просмотреть файл

@ -310,8 +310,6 @@ VRManagerParent::RecvCreateVRTestSystem()
{
VRManager* vm = VRManager::Get();
vm->CreateVRTestSystem();
mDisplayTestID = 0;
mControllerTestID = 0;
return IPC_OK();
}
@ -355,10 +353,6 @@ VRManagerParent::RecvCreateVRServiceTestController(const nsCString& aID, const u
impl::VRControllerPuppet* controllerPuppet = nullptr;
VRManager* vm = VRManager::Get();
if (mHaveControllerListener) {
vm->RefreshVRControllers();
}
// Get VRControllerPuppet from VRManager
vm->GetVRControllerInfo(controllerInfoArray);
for (auto& controllerInfo : controllerInfoArray) {
@ -392,7 +386,7 @@ VRManagerParent::RecvSetDisplayInfoToMockDisplay(const uint32_t& aDeviceID,
const VRDisplayInfo& aDisplayInfo)
{
RefPtr<impl::VRDisplayPuppet> displayPuppet;
mVRDisplayTests.Get(aDeviceID,
mVRDisplayTests.Get(mDisplayTestID,
getter_AddRefs(displayPuppet));
MOZ_ASSERT(displayPuppet);
displayPuppet->SetDisplayInfo(aDisplayInfo);
@ -404,7 +398,7 @@ VRManagerParent::RecvSetSensorStateToMockDisplay(const uint32_t& aDeviceID,
const VRHMDSensorState& aSensorState)
{
RefPtr<impl::VRDisplayPuppet> displayPuppet;
mVRDisplayTests.Get(aDeviceID,
mVRDisplayTests.Get(mDisplayTestID,
getter_AddRefs(displayPuppet));
MOZ_ASSERT(displayPuppet);
displayPuppet->SetSensorState(aSensorState);
@ -416,7 +410,7 @@ VRManagerParent::RecvNewButtonEventToMockController(const uint32_t& aDeviceID, c
const bool& aPressed)
{
RefPtr<impl::VRControllerPuppet> controllerPuppet;
mVRControllerTests.Get(aDeviceID,
mVRControllerTests.Get(mControllerTestID,
getter_AddRefs(controllerPuppet));
MOZ_ASSERT(controllerPuppet);
controllerPuppet->SetButtonPressState(aButton, aPressed);
@ -428,7 +422,7 @@ VRManagerParent::RecvNewAxisMoveEventToMockController(const uint32_t& aDeviceID,
const double& aValue)
{
RefPtr<impl::VRControllerPuppet> controllerPuppet;
mVRControllerTests.Get(aDeviceID,
mVRControllerTests.Get(mControllerTestID,
getter_AddRefs(controllerPuppet));
MOZ_ASSERT(controllerPuppet);
controllerPuppet->SetAxisMoveState(aAxis, aValue);
@ -440,7 +434,7 @@ VRManagerParent::RecvNewPoseMoveToMockController(const uint32_t& aDeviceID,
const GamepadPoseState& pose)
{
RefPtr<impl::VRControllerPuppet> controllerPuppet;
mVRControllerTests.Get(aDeviceID,
mVRControllerTests.Get(mControllerTestID,
getter_AddRefs(controllerPuppet));
MOZ_ASSERT(controllerPuppet);
controllerPuppet->SetPoseMoveState(pose);

Просмотреть файл

@ -12,3 +12,7 @@
[HTMLIFrameElement interface: attribute allowvr]
expected: FAIL
[Gamepad interface: attribute displayId]
expected: FAIL