Bug 1714703 - Promisify GamepadServiceTest r=tjr,peterv
make GamepadServiceTest's methods return promises, so to avoid testing with flaky setTimeout(). Differential Revision: https://phabricator.services.mozilla.com/D117258
This commit is contained in:
@@ -4,38 +4,42 @@
|
||||
<script>
|
||||
var SimpleTest = window.parent.SimpleTest;
|
||||
|
||||
function gamepadEventHandler() {
|
||||
SimpleTest.ok(false, "privacy.resistFingerprinting is true, should not receive any gamepad events");
|
||||
function forceFail() {
|
||||
SimpleTest.ok(
|
||||
false,
|
||||
"privacy.resistFingerprinting is true, should not receive any gamepad events"
|
||||
);
|
||||
}
|
||||
|
||||
window.addEventListener("gamepadconnected", gamepadEventHandler);
|
||||
window.addEventListener("gamepaddisconnected", gamepadEventHandler);
|
||||
window.addEventListener("gamepadbuttondown", gamepadEventHandler);
|
||||
window.addEventListener("gamepadconnected", forceFail);
|
||||
window.addEventListener("gamepaddisconnected", forceFail);
|
||||
window.addEventListener("gamepadbuttondown", forceFail);
|
||||
|
||||
var GamepadService = navigator.requestGamepadServiceTest();
|
||||
GamepadService.addGamepad(
|
||||
window.addEventListener("load", async () => {
|
||||
const service = navigator.requestGamepadServiceTest();
|
||||
const buttonIndex = await service.addGamepad(
|
||||
"test gamepad", // id
|
||||
GamepadService.standardMapping,
|
||||
GamepadService.noHand,
|
||||
service.standardMapping,
|
||||
service.noHand,
|
||||
4, // buttons
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0).then((aIndex) => new Promise((aResolve) => {
|
||||
// Press a button to make the gamepad visible to the page.
|
||||
GamepadService.newButtonEvent(aIndex, 0, true, true);
|
||||
0
|
||||
);
|
||||
|
||||
// Wait for a while in order to guarantee navigator.getGamepads() can
|
||||
// get up-to-date result.
|
||||
setTimeout(() => aResolve(aIndex), 1000);
|
||||
})).then((aIndex) => new Promise((aResolve) => {
|
||||
SimpleTest.is(navigator.getGamepads().length, 0,
|
||||
"privacy.resistFingerprinting is true, navigator.getGamepads() should always return an empty array");
|
||||
GamepadService.removeGamepad(aIndex);
|
||||
// Press a button to make the gamepad visible to the page.
|
||||
await service.newButtonEvent(buttonIndex, 0, true, true);
|
||||
|
||||
// Wait for gamepad events to be fired.
|
||||
setTimeout(() => aResolve(), 3000);
|
||||
})).then(() => {
|
||||
SimpleTest.finish();
|
||||
});
|
||||
const { length } = navigator.getGamepads();
|
||||
SimpleTest.is(
|
||||
length,
|
||||
0,
|
||||
"privacy.resistFingerprinting is true, navigator.getGamepads() should always return an empty array"
|
||||
);
|
||||
|
||||
// Attempt to force gamepad events to be fired, by simulating gamepad disconnect
|
||||
await service.removeGamepad(buttonIndex);
|
||||
SimpleTest.finish();
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -133,9 +133,10 @@ already_AddRefed<Promise> GamepadServiceTest::AddGamepad(
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
void GamepadServiceTest::RemoveGamepad(uint32_t aHandleSlot) {
|
||||
already_AddRefed<Promise> GamepadServiceTest::RemoveGamepad(
|
||||
uint32_t aHandleSlot, ErrorResult& aRv) {
|
||||
if (mShuttingDown) {
|
||||
return;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GamepadHandle gamepadHandle = GetHandleInSlot(aHandleSlot);
|
||||
@@ -145,13 +146,24 @@ void GamepadServiceTest::RemoveGamepad(uint32_t aHandleSlot) {
|
||||
GamepadChangeEvent e(gamepadHandle, body);
|
||||
|
||||
uint32_t id = ++mEventNumber;
|
||||
|
||||
RefPtr<Promise> p = Promise::Create(mWindow->AsGlobal(), aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!mPromiseList.Contains(id));
|
||||
mPromiseList.InsertOrUpdate(id, RefPtr{p});
|
||||
|
||||
mChild->SendGamepadTestEvent(id, e);
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
void GamepadServiceTest::NewButtonEvent(uint32_t aHandleSlot, uint32_t aButton,
|
||||
bool aPressed, bool aTouched) {
|
||||
already_AddRefed<Promise> GamepadServiceTest::NewButtonEvent(
|
||||
uint32_t aHandleSlot, uint32_t aButton, bool aPressed, bool aTouched,
|
||||
ErrorResult& aRv) {
|
||||
if (mShuttingDown) {
|
||||
return;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GamepadHandle gamepadHandle = GetHandleInSlot(aHandleSlot);
|
||||
@@ -161,14 +173,22 @@ void GamepadServiceTest::NewButtonEvent(uint32_t aHandleSlot, uint32_t aButton,
|
||||
GamepadChangeEvent e(gamepadHandle, body);
|
||||
|
||||
uint32_t id = ++mEventNumber;
|
||||
RefPtr<Promise> p = Promise::Create(mWindow->AsGlobal(), aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!mPromiseList.Contains(id));
|
||||
mPromiseList.InsertOrUpdate(id, RefPtr{p});
|
||||
mChild->SendGamepadTestEvent(id, e);
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
void GamepadServiceTest::NewButtonValueEvent(uint32_t aHandleSlot,
|
||||
uint32_t aButton, bool aPressed,
|
||||
bool aTouched, double aValue) {
|
||||
already_AddRefed<Promise> GamepadServiceTest::NewButtonValueEvent(
|
||||
uint32_t aHandleSlot, uint32_t aButton, bool aPressed, bool aTouched,
|
||||
double aValue, ErrorResult& aRv) {
|
||||
if (mShuttingDown) {
|
||||
return;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GamepadHandle gamepadHandle = GetHandleInSlot(aHandleSlot);
|
||||
@@ -178,13 +198,21 @@ void GamepadServiceTest::NewButtonValueEvent(uint32_t aHandleSlot,
|
||||
GamepadChangeEvent e(gamepadHandle, body);
|
||||
|
||||
uint32_t id = ++mEventNumber;
|
||||
RefPtr<Promise> p = Promise::Create(mWindow->AsGlobal(), aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!mPromiseList.Contains(id));
|
||||
mPromiseList.InsertOrUpdate(id, RefPtr{p});
|
||||
mChild->SendGamepadTestEvent(id, e);
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
void GamepadServiceTest::NewAxisMoveEvent(uint32_t aHandleSlot, uint32_t aAxis,
|
||||
double aValue) {
|
||||
already_AddRefed<Promise> GamepadServiceTest::NewAxisMoveEvent(
|
||||
uint32_t aHandleSlot, uint32_t aAxis, double aValue, ErrorResult& aRv) {
|
||||
if (mShuttingDown) {
|
||||
return;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GamepadHandle gamepadHandle = GetHandleInSlot(aHandleSlot);
|
||||
@@ -194,18 +222,26 @@ void GamepadServiceTest::NewAxisMoveEvent(uint32_t aHandleSlot, uint32_t aAxis,
|
||||
GamepadChangeEvent e(gamepadHandle, body);
|
||||
|
||||
uint32_t id = ++mEventNumber;
|
||||
RefPtr<Promise> p = Promise::Create(mWindow->AsGlobal(), aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!mPromiseList.Contains(id));
|
||||
mPromiseList.InsertOrUpdate(id, RefPtr{p});
|
||||
mChild->SendGamepadTestEvent(id, e);
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
void GamepadServiceTest::NewPoseMove(
|
||||
already_AddRefed<Promise> GamepadServiceTest::NewPoseMove(
|
||||
uint32_t aHandleSlot, const Nullable<Float32Array>& aOrient,
|
||||
const Nullable<Float32Array>& aPos,
|
||||
const Nullable<Float32Array>& aAngVelocity,
|
||||
const Nullable<Float32Array>& aAngAcceleration,
|
||||
const Nullable<Float32Array>& aLinVelocity,
|
||||
const Nullable<Float32Array>& aLinAcceleration) {
|
||||
const Nullable<Float32Array>& aLinAcceleration, ErrorResult& aRv) {
|
||||
if (mShuttingDown) {
|
||||
return;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GamepadHandle gamepadHandle = GetHandleInSlot(aHandleSlot);
|
||||
@@ -272,15 +308,23 @@ void GamepadServiceTest::NewPoseMove(
|
||||
GamepadChangeEvent e(gamepadHandle, body);
|
||||
|
||||
uint32_t id = ++mEventNumber;
|
||||
RefPtr<Promise> p = Promise::Create(mWindow->AsGlobal(), aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!mPromiseList.Contains(id));
|
||||
mPromiseList.InsertOrUpdate(id, RefPtr{p});
|
||||
mChild->SendGamepadTestEvent(id, e);
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
void GamepadServiceTest::NewTouch(uint32_t aHandleSlot,
|
||||
uint32_t aTouchArrayIndex, uint32_t aTouchId,
|
||||
uint8_t aSurfaceId, const Float32Array& aPos,
|
||||
const Nullable<Float32Array>& aSurfDim) {
|
||||
already_AddRefed<Promise> GamepadServiceTest::NewTouch(
|
||||
uint32_t aHandleSlot, uint32_t aTouchArrayIndex, uint32_t aTouchId,
|
||||
uint8_t aSurfaceId, const Float32Array& aPos,
|
||||
const Nullable<Float32Array>& aSurfDim, ErrorResult& aRv) {
|
||||
if (mShuttingDown) {
|
||||
return;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GamepadHandle gamepadHandle = GetHandleInSlot(aHandleSlot);
|
||||
@@ -308,7 +352,15 @@ void GamepadServiceTest::NewTouch(uint32_t aHandleSlot,
|
||||
GamepadChangeEvent e(gamepadHandle, body);
|
||||
|
||||
uint32_t id = ++mEventNumber;
|
||||
RefPtr<Promise> p = Promise::Create(mWindow->AsGlobal(), aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!mPromiseList.Contains(id));
|
||||
mPromiseList.InsertOrUpdate(id, RefPtr{p});
|
||||
mChild->SendGamepadTestEvent(id, e);
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
JSObject* GamepadServiceTest::WrapObject(JSContext* aCx,
|
||||
|
||||
@@ -37,27 +37,46 @@ class GamepadServiceTest final : public DOMEventTargetHelper,
|
||||
GamepadHand LeftHand() const { return GamepadHand::Left; }
|
||||
GamepadHand RightHand() const { return GamepadHand::Right; }
|
||||
|
||||
// IPC receiver
|
||||
void ReplyGamepadHandle(uint32_t aPromiseId, const GamepadHandle& aHandle);
|
||||
|
||||
// Methods from GamepadServiceTest.webidl
|
||||
already_AddRefed<Promise> AddGamepad(
|
||||
const nsAString& aID, GamepadMappingType aMapping, GamepadHand aHand,
|
||||
uint32_t aNumButtons, uint32_t aNumAxes, uint32_t aNumHaptics,
|
||||
uint32_t aNumLightIndicator, uint32_t aNumTouchEvents, ErrorResult& aRv);
|
||||
void ReplyGamepadHandle(uint32_t aPromiseId, const GamepadHandle& aHandle);
|
||||
|
||||
void RemoveGamepad(uint32_t aHandleSlot);
|
||||
void NewButtonEvent(uint32_t aHandleSlot, uint32_t aButton, bool aPressed,
|
||||
bool aTouched);
|
||||
void NewButtonValueEvent(uint32_t aHandleSlot, uint32_t aButton,
|
||||
bool aPressed, bool aTouched, double aValue);
|
||||
void NewAxisMoveEvent(uint32_t aHandleSlot, uint32_t aAxis, double aValue);
|
||||
void NewPoseMove(uint32_t aHandleSlot, const Nullable<Float32Array>& aOrient,
|
||||
const Nullable<Float32Array>& aPos,
|
||||
const Nullable<Float32Array>& aAngVelocity,
|
||||
const Nullable<Float32Array>& aAngAcceleration,
|
||||
const Nullable<Float32Array>& aLinVelocity,
|
||||
const Nullable<Float32Array>& aLinAcceleration);
|
||||
void NewTouch(uint32_t aHandleSlot, uint32_t aTouchArrayIndex,
|
||||
uint32_t aTouchId, uint8_t aSurfaceId, const Float32Array& aPos,
|
||||
const Nullable<Float32Array>& aSurfDim);
|
||||
already_AddRefed<Promise> RemoveGamepad(uint32_t aHandleSlot,
|
||||
ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise> NewButtonEvent(uint32_t aHandleSlot,
|
||||
uint32_t aButton, bool aPressed,
|
||||
bool aTouched, ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise> NewButtonValueEvent(uint32_t aHandleSlot,
|
||||
uint32_t aButton, bool aPressed,
|
||||
bool aTouched, double aValue,
|
||||
ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise> NewAxisMoveEvent(uint32_t aHandleSlot,
|
||||
uint32_t aAxis, double aValue,
|
||||
ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise> NewPoseMove(
|
||||
uint32_t aHandleSlot, const Nullable<Float32Array>& aOrient,
|
||||
const Nullable<Float32Array>& aPos,
|
||||
const Nullable<Float32Array>& aAngVelocity,
|
||||
const Nullable<Float32Array>& aAngAcceleration,
|
||||
const Nullable<Float32Array>& aLinVelocity,
|
||||
const Nullable<Float32Array>& aLinAcceleration, ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise> NewTouch(uint32_t aHandleSlot,
|
||||
uint32_t aTouchArrayIndex,
|
||||
uint32_t aTouchId, uint8_t aSurfaceId,
|
||||
const Float32Array& aPos,
|
||||
const Nullable<Float32Array>& aSurfDim,
|
||||
ErrorResult& aRv);
|
||||
|
||||
void Shutdown();
|
||||
|
||||
static already_AddRefed<GamepadServiceTest> CreateTestService(
|
||||
|
||||
@@ -87,34 +87,37 @@ mozilla::ipc::IPCResult GamepadTestChannelParent::RecvGamepadTestEvent(
|
||||
|
||||
GamepadHandle handle = aEvent.handle();
|
||||
|
||||
if (body.type() == GamepadChangeEventBody::TGamepadRemoved) {
|
||||
service->RemoveGamepad(handle);
|
||||
return IPC_OK();
|
||||
switch (body.type()) {
|
||||
case GamepadChangeEventBody::TGamepadRemoved:
|
||||
service->RemoveGamepad(handle);
|
||||
break;
|
||||
case GamepadChangeEventBody::TGamepadButtonInformation: {
|
||||
const GamepadButtonInformation& a = body.get_GamepadButtonInformation();
|
||||
service->NewButtonEvent(handle, a.button(), a.pressed(), a.touched(),
|
||||
a.value());
|
||||
break;
|
||||
}
|
||||
case GamepadChangeEventBody::TGamepadAxisInformation: {
|
||||
const GamepadAxisInformation& a = body.get_GamepadAxisInformation();
|
||||
service->NewAxisMoveEvent(handle, a.axis(), a.value());
|
||||
break;
|
||||
}
|
||||
case GamepadChangeEventBody::TGamepadPoseInformation: {
|
||||
const GamepadPoseInformation& a = body.get_GamepadPoseInformation();
|
||||
service->NewPoseEvent(handle, a.pose_state());
|
||||
break;
|
||||
}
|
||||
case GamepadChangeEventBody::TGamepadTouchInformation: {
|
||||
const GamepadTouchInformation& a = body.get_GamepadTouchInformation();
|
||||
service->NewMultiTouchEvent(handle, a.index(), a.touch_state());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
NS_WARNING("Unknown event type.");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
if (body.type() == GamepadChangeEventBody::TGamepadButtonInformation) {
|
||||
const GamepadButtonInformation& a = body.get_GamepadButtonInformation();
|
||||
service->NewButtonEvent(handle, a.button(), a.pressed(), a.touched(),
|
||||
a.value());
|
||||
return IPC_OK();
|
||||
}
|
||||
if (body.type() == GamepadChangeEventBody::TGamepadAxisInformation) {
|
||||
const GamepadAxisInformation& a = body.get_GamepadAxisInformation();
|
||||
service->NewAxisMoveEvent(handle, a.axis(), a.value());
|
||||
return IPC_OK();
|
||||
}
|
||||
if (body.type() == GamepadChangeEventBody::TGamepadPoseInformation) {
|
||||
const GamepadPoseInformation& a = body.get_GamepadPoseInformation();
|
||||
service->NewPoseEvent(handle, a.pose_state());
|
||||
return IPC_OK();
|
||||
}
|
||||
if (body.type() == GamepadChangeEventBody::TGamepadTouchInformation) {
|
||||
const GamepadTouchInformation& a = body.get_GamepadTouchInformation();
|
||||
service->NewMultiTouchEvent(handle, a.index(), a.touch_state());
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
NS_WARNING("Unknown event type.");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
Unused << SendReplyGamepadHandle(aID, handle);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
} // namespace mozilla::dom
|
||||
|
||||
@@ -24,32 +24,31 @@ var testOver = false;
|
||||
|
||||
runGamepadTest(checkTimestamp);
|
||||
|
||||
function checkTimestamp(){
|
||||
GamepadService.addGamepad("test gamepad 1",
|
||||
async function checkTimestamp(){
|
||||
const index = await GamepadService.addGamepad("test gamepad 1",
|
||||
GamepadService.standardMapping,
|
||||
GamepadService.noHand,
|
||||
4,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0).then(function(i) {
|
||||
index = i;
|
||||
// Press a button to make the gamepad visible
|
||||
// to the page.
|
||||
GamepadService.newButtonEvent(index, 0, true, true);
|
||||
GamepadService.newButtonEvent(index, 0, true, true);
|
||||
ok(true, "test");
|
||||
});
|
||||
0);
|
||||
|
||||
// Press a button to make the gamepad visible
|
||||
// to the page.
|
||||
await GamepadService.newButtonEvent(index, 0, true, true);
|
||||
await GamepadService.newButtonEvent(index, 0, true, true);
|
||||
ok(true, "test");
|
||||
}
|
||||
|
||||
function cleanup(){
|
||||
SpecialPowers.executeSoon(function() {
|
||||
GamepadService.removeGamepad(index);
|
||||
SpecialPowers.executeSoon(async function() {
|
||||
await GamepadService.removeGamepad(index);
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
function buttonpresshandler(e) {
|
||||
async function buttonpresshandler(e) {
|
||||
if (testOver) {
|
||||
return;
|
||||
}
|
||||
@@ -58,7 +57,7 @@ function buttonpresshandler(e) {
|
||||
} else {
|
||||
ok(timea <= e.gamepad.timestamp, "Timestamp less than last timestamp");
|
||||
}
|
||||
GamepadService.newButtonEvent(index, 0, false, false);
|
||||
await GamepadService.newButtonEvent(index, 0, false, false);
|
||||
if (!firstPress) {
|
||||
testOver = true;
|
||||
SpecialPowers.executeSoon(cleanup);
|
||||
|
||||
@@ -19,35 +19,34 @@ let SpecialPowers = window.parent.SpecialPowers;
|
||||
|
||||
var gamepad_index;
|
||||
|
||||
function pressButton() {
|
||||
GamepadService.newButtonEvent(gamepad_index, 0, true, true);
|
||||
GamepadService.newButtonEvent(gamepad_index, 0, false, false);
|
||||
async function pressButton() {
|
||||
await GamepadService.newButtonEvent(gamepad_index, 0, true, true);
|
||||
await GamepadService.newButtonEvent(gamepad_index, 0, false, false);
|
||||
}
|
||||
|
||||
// Add a gamepad
|
||||
function startTests() {
|
||||
async function startTests() {
|
||||
window.addEventListener("gamepadbuttondown", function() {
|
||||
// Wait to ensure that all frames received the button press as well.
|
||||
SpecialPowers.executeSoon(tests[testNum++]);
|
||||
});
|
||||
|
||||
GamepadService.addGamepad("test gamepad", // id
|
||||
gamepad_index = await GamepadService.addGamepad("test gamepad", // id
|
||||
GamepadService.standardMapping,
|
||||
GamepadService.noHand,
|
||||
4, // buttons
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0).then(function(i) {
|
||||
gamepad_index = i;
|
||||
gamepad_connected()
|
||||
});
|
||||
0)
|
||||
|
||||
await gamepad_connected();
|
||||
}
|
||||
|
||||
var f1, f2;
|
||||
function gamepad_connected() {
|
||||
async function gamepad_connected() {
|
||||
f1 = document.getElementById('f1');
|
||||
pressButton();
|
||||
await pressButton();
|
||||
}
|
||||
|
||||
var testNum = 0;
|
||||
@@ -61,20 +60,20 @@ function test1() {
|
||||
|
||||
// Now add another frame.
|
||||
f2 = document.createElement("iframe");
|
||||
f2.addEventListener("load", function() {
|
||||
f2.addEventListener("load", async () => {
|
||||
// When the frame is loaded, press a button again.
|
||||
pressButton();
|
||||
await pressButton();
|
||||
});
|
||||
f2.src = "gamepad_frame.html";
|
||||
document.body.appendChild(f2);
|
||||
}
|
||||
|
||||
function test2() {
|
||||
async function test2() {
|
||||
is(f1.contentWindow.connectedEvents, 1, "right number of connection events in frame 1");
|
||||
is(f2.contentWindow.connectedEvents, 1, "right number of connection events in frame 2");
|
||||
is(f1.contentWindow.idlConnected, 1, "right number of IDL connection events in frame 1");
|
||||
is(f2.contentWindow.idlConnected, 1, "right number of IDL connection events in frame 2");
|
||||
GamepadService.removeGamepad(gamepad_index);
|
||||
await GamepadService.removeGamepad(gamepad_index);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,12 +35,14 @@ var touchData = [{touchId: 0, surfaceId: 0, pos: new Float32Array([-0.5, 0.5]),
|
||||
window.addEventListener("gamepadconnected", connecthandler);
|
||||
window.addEventListener("gamepadbuttondown", function() {
|
||||
// Wait to ensure that all frames received the button press as well.
|
||||
SpecialPowers.executeSoon(tests[testNum++]);
|
||||
SpecialPowers.executeSoon(async ()=> {
|
||||
await tests[testNum++]()
|
||||
});
|
||||
});
|
||||
|
||||
function pressButton() {
|
||||
GamepadService.newButtonEvent(gamepad_index, 0, true, true);
|
||||
GamepadService.newButtonEvent(gamepad_index, 0, false, false);
|
||||
async function pressButton() {
|
||||
await GamepadService.newButtonEvent(gamepad_index, 0, true, true);
|
||||
await GamepadService.newButtonEvent(gamepad_index, 0, false, false);
|
||||
}
|
||||
|
||||
async function startTest() {
|
||||
@@ -49,18 +51,18 @@ async function startTest() {
|
||||
["dom.gamepad.extensions.lightindicator", true],
|
||||
["dom.gamepad.extensions.multitouch", true]] });
|
||||
// Add a gamepad
|
||||
GamepadService.addGamepad("test gamepad", // id
|
||||
GamepadService.standardMapping,
|
||||
GamepadService.leftHand,
|
||||
4,
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
2).then(function(i) {
|
||||
gamepad_index = i;
|
||||
// Simulate button events on the gamepad we added
|
||||
pressButton();
|
||||
});
|
||||
gamepad_index = await GamepadService.addGamepad("test gamepad", // id
|
||||
GamepadService.standardMapping,
|
||||
GamepadService.leftHand,
|
||||
4,
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
2);
|
||||
|
||||
// Simulate button events on the gamepad we added
|
||||
await pressButton();
|
||||
|
||||
}
|
||||
|
||||
function connecthandler(e) {
|
||||
@@ -91,14 +93,14 @@ function checkValueInFloat32Array(array1, array2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function poseadd() {
|
||||
GamepadService.newPoseMove(gamepad_index, poseOrient,
|
||||
async function poseadd() {
|
||||
await GamepadService.newPoseMove(gamepad_index, poseOrient,
|
||||
posePos, poseAngVel, poseAngAcc,
|
||||
poseLinVel, poseLinAcc);
|
||||
pressButton();
|
||||
await pressButton();
|
||||
}
|
||||
|
||||
function posecheck() {
|
||||
async function posecheck() {
|
||||
var gamepads = navigator.getGamepads();
|
||||
var pose = gamepads[0].pose;
|
||||
is(gamepads[0].pose.hasOrientation, true,
|
||||
@@ -117,7 +119,7 @@ function posecheck() {
|
||||
"correct gamepadPose linearVelocity");
|
||||
is(checkValueInFloat32Array(pose.linearAcceleration, poseLinAcc), true,
|
||||
"correct gamepadPose linearAcceleration");
|
||||
pressButton();
|
||||
await pressButton();
|
||||
}
|
||||
|
||||
function setFrameVisible(f, visible) {
|
||||
@@ -127,9 +129,9 @@ function setFrameVisible(f, visible) {
|
||||
function haptictest() {
|
||||
var gamepads = navigator.getGamepads();
|
||||
var hapticActuators = gamepads[0].hapticActuators[0];
|
||||
hapticActuators.pulse(1, 100).then(function(result) {
|
||||
hapticActuators.pulse(1, 100).then(async function(result) {
|
||||
is(result, true, "gamepad hapticActuators test success.");
|
||||
GamepadService.removeGamepad(gamepad_index);
|
||||
await GamepadService.removeGamepad(gamepad_index);
|
||||
SimpleTest.finish();
|
||||
});
|
||||
// When page is background, we should stop our haptics and still
|
||||
@@ -138,19 +140,17 @@ function haptictest() {
|
||||
setFrameVisible(f1, false);
|
||||
}
|
||||
|
||||
function touchadd() {
|
||||
var count = 0;
|
||||
touchData.forEach(function(touch) {
|
||||
GamepadService.newTouch(gamepad_index, count, touch.touchId,
|
||||
async function touchadd() {
|
||||
for(var count = 0; count < touchData.length; count++) {
|
||||
const touch = touchData[count];
|
||||
await GamepadService.newTouch(gamepad_index, count, touch.touchId,
|
||||
touch.surfaceId, touch.pos,
|
||||
touch.surf);
|
||||
++count;
|
||||
});
|
||||
|
||||
pressButton();
|
||||
}
|
||||
await pressButton();
|
||||
}
|
||||
|
||||
function touchcheck() {
|
||||
async function touchcheck() {
|
||||
var gamepads = navigator.getGamepads();
|
||||
var touches = gamepads[0].touchEvents;
|
||||
|
||||
@@ -169,8 +169,8 @@ function touchcheck() {
|
||||
|
||||
++count;
|
||||
});
|
||||
|
||||
pressButton();
|
||||
|
||||
await pressButton();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -22,24 +22,21 @@ function setFrameVisible(f, visible) {
|
||||
}
|
||||
|
||||
var frames_loaded = 0;
|
||||
function startTest() {
|
||||
async function startTest() {
|
||||
frames_loaded++;
|
||||
if (frames_loaded == 2) {
|
||||
GamepadService.addGamepad("test gamepad", // id
|
||||
if (frames_loaded != 2) return;
|
||||
index = await GamepadService.addGamepad("test gamepad", // id
|
||||
GamepadService.standardMapping,
|
||||
GamepadService.noHand,
|
||||
4, // buttons
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0).then(function(i) {
|
||||
index = i;
|
||||
gamepad_loaded();
|
||||
});
|
||||
}
|
||||
0);
|
||||
await gamepad_loaded();
|
||||
}
|
||||
var f1, f2;
|
||||
function gamepad_loaded() {
|
||||
async function gamepad_loaded() {
|
||||
f1 = document.getElementById('f1');
|
||||
f2 = document.getElementById('f2');
|
||||
let w1 = f1.contentWindow;
|
||||
@@ -56,12 +53,12 @@ function gamepad_loaded() {
|
||||
ok(!f2.contentWindow.gamepad.buttons[0].touched,
|
||||
"frame 2 no button touched");
|
||||
setFrameVisible(f2, false);
|
||||
SpecialPowers.executeSoon(function() {
|
||||
GamepadService.newButtonEvent(index, 0, true, true);
|
||||
SpecialPowers.executeSoon(async function() {
|
||||
await GamepadService.newButtonEvent(index, 0, true, true);
|
||||
});
|
||||
})
|
||||
// Now press the button, but don't release it.
|
||||
GamepadService.newButtonEvent(index, 0, true, true);
|
||||
await GamepadService.newButtonEvent(index, 0, true, true);
|
||||
}
|
||||
|
||||
window.addEventListener("gamepadbuttondown", function() {
|
||||
@@ -75,7 +72,7 @@ var tests = [
|
||||
check_second_frame_no_button_press,
|
||||
];
|
||||
|
||||
function check_button_pressed() {
|
||||
async function check_button_pressed() {
|
||||
// At this point the both frames should see the button as pressed.
|
||||
ok(f1.contentWindow.gamepad.buttons[0].pressed, "frame 1 sees button pressed");
|
||||
ok(f1.contentWindow.gamepad.buttons[0].touched, "frame 1 sees button touched");
|
||||
@@ -83,10 +80,10 @@ function check_button_pressed() {
|
||||
ok(f2.contentWindow.gamepad.buttons[0].touched, "frame 2 sees button touched");
|
||||
|
||||
// Now release the button, then hide the second frame.
|
||||
GamepadService.newButtonEvent(index, 0, false, false);
|
||||
await GamepadService.newButtonEvent(index, 0, false, false);
|
||||
}
|
||||
|
||||
function check_second_frame_no_button_press () {
|
||||
async function check_second_frame_no_button_press () {
|
||||
/*
|
||||
* At this point the first frame should see the button as pressed,
|
||||
* but the second frame should not, since it's hidden.
|
||||
@@ -98,13 +95,13 @@ function check_second_frame_no_button_press () {
|
||||
|
||||
// Now unhide the second frame.
|
||||
setFrameVisible(f2, true);
|
||||
SpecialPowers.executeSoon(function() {
|
||||
SpecialPowers.executeSoon(async function() {
|
||||
// Now that the frame is visible again, it should see the button
|
||||
// that was pressed.
|
||||
ok(f2.contentWindow.gamepad.buttons[0].pressed, "frame 2 sees button pressed");
|
||||
ok(f2.contentWindow.gamepad.buttons[0].touched, "frame 2 sees button touched");
|
||||
// cleanup
|
||||
GamepadService.removeGamepad(index);
|
||||
await GamepadService.removeGamepad(index);
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ window.addEventListener("gamepadbuttondown", function() {
|
||||
SpecialPowers.executeSoon(tests[testNum++]);
|
||||
});
|
||||
|
||||
function pressButton() {
|
||||
GamepadService.newButtonEvent(index, 0, true, true);
|
||||
GamepadService.newButtonEvent(index, 0, false, false);
|
||||
async function pressButton() {
|
||||
await GamepadService.newButtonEvent(index, 0, true, true);
|
||||
await GamepadService.newButtonEvent(index, 0, false, false);
|
||||
}
|
||||
|
||||
function setFrameVisible(f, visible) {
|
||||
@@ -29,27 +29,25 @@ function setFrameVisible(f, visible) {
|
||||
}
|
||||
|
||||
var frames_loaded = 0;
|
||||
function startTest() {
|
||||
async function startTest() {
|
||||
frames_loaded++;
|
||||
if (frames_loaded == 2) {
|
||||
GamepadService.addGamepad("test gamepad", // id
|
||||
if (frames_loaded != 2) return;
|
||||
index = await GamepadService.addGamepad("test gamepad", // id
|
||||
GamepadService.standardMapping,
|
||||
GamepadService.noHand,
|
||||
4, // buttons
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0).then(function(i) {
|
||||
index = i;
|
||||
gamepad_loaded();
|
||||
});
|
||||
}
|
||||
0);
|
||||
|
||||
await gamepad_loaded();
|
||||
}
|
||||
var f1, f2;
|
||||
function gamepad_loaded() {
|
||||
async function gamepad_loaded() {
|
||||
f1 = document.getElementById('f1');
|
||||
f2 = document.getElementById('f2');
|
||||
pressButton();
|
||||
await pressButton();
|
||||
}
|
||||
|
||||
|
||||
@@ -66,13 +64,13 @@ function test1() {
|
||||
|
||||
// Now hide the second frame and send another button press.
|
||||
setFrameVisible(f2, false);
|
||||
SpecialPowers.executeSoon( () => { pressButton(); });
|
||||
SpecialPowers.executeSoon( async () => { await pressButton(); });
|
||||
}
|
||||
|
||||
function test2() {
|
||||
async function test2() {
|
||||
is(f1.contentWindow.buttonPresses, 2, "right number of button presses in frame 1");
|
||||
is(f2.contentWindow.buttonPresses, 1, "right number of button presses in frame 2");
|
||||
GamepadService.removeGamepad(index);
|
||||
await GamepadService.removeGamepad(index);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ let SpecialPowers = window.parent.SpecialPowers;
|
||||
// This should be held for the entire time the testing API is being used to
|
||||
// ensure monitoring has been started and that a single GamepadPlatformService
|
||||
// instance is used for the entire test
|
||||
var GamepadsKungFuDeathGrip = navigator.getGamepads();
|
||||
var GamepadsKungFuDeathGrip = navigator.getGamepads();
|
||||
|
||||
// Due to gamepad being a polling API instead of event driven, test ordering
|
||||
// ends up being a little weird in order to deal with e10s. Calls to
|
||||
@@ -37,20 +37,17 @@ window.addEventListener("gamepadbuttonup", () => {
|
||||
|
||||
runGamepadTest(startTest);
|
||||
|
||||
function startTest() {
|
||||
async function startTest() {
|
||||
// Add a gamepad
|
||||
GamepadService.addGamepad("test gamepad", // id
|
||||
index = await GamepadService.addGamepad("test gamepad", // id
|
||||
GamepadService.standardMapping,
|
||||
GamepadService.noHand,
|
||||
4,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0).then(function(i) {
|
||||
index = i;
|
||||
// Simulate button events on the gamepad we added
|
||||
GamepadService.newButtonEvent(index, 0, true, true);
|
||||
});
|
||||
0);
|
||||
await GamepadService.newButtonEvent(index, 0, true, true);
|
||||
}
|
||||
|
||||
function connecthandler(e) {
|
||||
@@ -63,19 +60,19 @@ function connecthandler(e) {
|
||||
is(e.gamepad.axes.length, 2, "correct number of axes");
|
||||
}
|
||||
|
||||
function buttontest1() {
|
||||
async function buttontest1() {
|
||||
var gamepads = navigator.getGamepads();
|
||||
is(gamepads[0].buttons[0].pressed, true, "gamepad button should register as pressed");
|
||||
is(gamepads[0].buttons[0].touched, true, "gamepad button should register as touched");
|
||||
GamepadService.newButtonValueEvent(index, 1, true, true, 0.5);
|
||||
await GamepadService.newButtonValueEvent(index, 1, true, true, 0.5);
|
||||
}
|
||||
|
||||
function buttontest2() {
|
||||
async function buttontest2() {
|
||||
var gamepads = navigator.getGamepads();
|
||||
is(gamepads[0].buttons[1].pressed, true, "gamepad button should register as pressed");
|
||||
is(gamepads[0].buttons[1].touched, true, "gamepad button should register as touched");
|
||||
is(gamepads[0].buttons[1].value, 0.5, "gamepad button value should be 0.5");
|
||||
GamepadService.removeGamepad(index);
|
||||
await GamepadService.removeGamepad(index);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
||||
@@ -46,9 +46,9 @@ window.addEventListener("gamepadbuttondown", function() {
|
||||
SpecialPowers.executeSoon(tests[testNum++]);
|
||||
});
|
||||
|
||||
function pressButton() {
|
||||
GamepadService.newButtonEvent(gamepad_index, 0, true, true);
|
||||
GamepadService.newButtonEvent(gamepad_index, 0, false, false);
|
||||
async function pressButton() {
|
||||
await GamepadService.newButtonEvent(gamepad_index, 0, true, true);
|
||||
await GamepadService.newButtonEvent(gamepad_index, 0, false, false);
|
||||
}
|
||||
|
||||
let frames_loaded = 0;
|
||||
@@ -59,27 +59,25 @@ async function startTest() {
|
||||
["dom.gamepad.extensions.lightindicator", true],
|
||||
["dom.gamepad.extensions.multitouch", true]] });
|
||||
if (frames_loaded == 2) {
|
||||
await promise;
|
||||
// Add a gamepad
|
||||
GamepadService.addGamepad("test gamepad", // id
|
||||
GamepadService.standardMapping,
|
||||
GamepadService.leftHand,
|
||||
4,
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
2).then(function(i) {
|
||||
gamepad_index = i;
|
||||
gamepad_loaded();
|
||||
});
|
||||
await promise;
|
||||
// Add a gamepad
|
||||
gamepad_index = await GamepadService.addGamepad("test gamepad", // id
|
||||
GamepadService.standardMapping,
|
||||
GamepadService.leftHand,
|
||||
4,
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
2)
|
||||
await gamepad_loaded();
|
||||
}
|
||||
}
|
||||
|
||||
let f1, f2;
|
||||
function gamepad_loaded() {
|
||||
async function gamepad_loaded() {
|
||||
f1 = document.getElementById('f1');
|
||||
f2 = document.getElementById('f2');
|
||||
GamepadService.newButtonEvent(gamepad_index, 0, true, true);
|
||||
await GamepadService.newButtonEvent(gamepad_index, 0, true, true);
|
||||
}
|
||||
|
||||
function connecthandler(e) {
|
||||
@@ -114,20 +112,18 @@ function setFrameVisible(f, visible) {
|
||||
SpecialPowers.wrap(f.contentWindow).browsingContext.isActive = visible;
|
||||
}
|
||||
|
||||
function touchAdd() {
|
||||
let count = 0;
|
||||
data[dataNum].forEach(function(touch) {
|
||||
GamepadService.newTouch(gamepad_index, count, touch.touchId,
|
||||
async function touchAdd() {
|
||||
for(let count = 0; count < data[dataNum].length; count++) {
|
||||
const touch = data[dataNum][count];
|
||||
await GamepadService.newTouch(gamepad_index, count, touch.touchId,
|
||||
touch.surfaceId, touch.pos,
|
||||
touch.surf);
|
||||
++count;
|
||||
});
|
||||
|
||||
}
|
||||
++dataNum;
|
||||
pressButton();
|
||||
await pressButton();
|
||||
}
|
||||
|
||||
function touchcheck1() {
|
||||
async function touchcheck1() {
|
||||
let touches = f1.contentWindow.gamepad.touchEvents;
|
||||
is(touches.length, touchData1.length, "f1 number of touches");
|
||||
|
||||
@@ -167,7 +163,7 @@ function touchcheck1() {
|
||||
pressButton();
|
||||
}
|
||||
|
||||
function touchcheck2() {
|
||||
async function touchcheck2() {
|
||||
let touches = f1.contentWindow.gamepad.touchEvents;
|
||||
is(touches.length, data[1].length, "f1 number of touches");
|
||||
|
||||
@@ -207,7 +203,7 @@ function touchcheck2() {
|
||||
pressButton();
|
||||
}
|
||||
|
||||
function touchcheck3() {
|
||||
async function touchcheck3() {
|
||||
let touches = f1.contentWindow.gamepad.touchEvents;
|
||||
is(touches.length, touchData3.length, "f1 number of touches");
|
||||
|
||||
@@ -247,8 +243,8 @@ function touchcheck3() {
|
||||
}
|
||||
|
||||
function cleanup(){
|
||||
SpecialPowers.executeSoon(function() {
|
||||
GamepadService.removeGamepad(gamepad_index);
|
||||
SpecialPowers.executeSoon(async function() {
|
||||
await GamepadService.removeGamepad(gamepad_index);
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,6 +15,10 @@ let isnot = window.parent.isnot;
|
||||
let SimpleTest = window.parent.SimpleTest;
|
||||
let SpecialPowers = window.parent.SpecialPowers;
|
||||
|
||||
var content_index1 = 0;
|
||||
var internal_index2;
|
||||
var content_index2 = 1;
|
||||
|
||||
var testNum = 0;
|
||||
var tests = [
|
||||
check_first_gamepad,
|
||||
@@ -24,7 +28,9 @@ var tests = [
|
||||
];
|
||||
|
||||
function run_next_test(event) {
|
||||
SpecialPowers.executeSoon(function() { tests[testNum++](event); });
|
||||
SpecialPowers.executeSoon(async function() {
|
||||
await tests[testNum++](event);
|
||||
});
|
||||
}
|
||||
|
||||
function buttonhandler(e) {
|
||||
@@ -39,29 +45,24 @@ window.addEventListener("gamepaddisconnected", disconnecthandler);
|
||||
|
||||
runGamepadTest(startTest)
|
||||
|
||||
function startTest() {
|
||||
async function startTest() {
|
||||
// gamepads should be empty first
|
||||
is(navigator.getGamepads().length, 0, "should be zero gamepads exposed");
|
||||
// Add a gamepad
|
||||
GamepadService.addGamepad("test gamepad 1", // id
|
||||
internal_index1 = await GamepadService.addGamepad("test gamepad 1", // id
|
||||
GamepadService.standardMapping,
|
||||
GamepadService.noHand,
|
||||
4, // buttons
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0).then(function(index) {
|
||||
internal_index1 = index;
|
||||
// Press a button to make the gamepad visible to the page.
|
||||
GamepadService.newButtonEvent(internal_index1, 0, true, true);
|
||||
});
|
||||
0);
|
||||
|
||||
// Press a button to make the gamepad visible to the page.
|
||||
await GamepadService.newButtonEvent(internal_index1, 0, true, true);
|
||||
}
|
||||
|
||||
var content_index1 = 0;
|
||||
var internal_index2;
|
||||
var content_index2 = 1;
|
||||
|
||||
function check_first_gamepad(e) {
|
||||
async function check_first_gamepad(e) {
|
||||
ok(true, "Checking first gamepad");
|
||||
// First gamepad gets added.
|
||||
is(e.gamepad.id, "test gamepad 1", "correct gamepad name");
|
||||
@@ -70,21 +71,21 @@ function check_first_gamepad(e) {
|
||||
is(gamepads[e.gamepad.index], e.gamepad, "right gamepad exposed at index");
|
||||
is(gamepads[content_index1], e.gamepad, "gamepad counter working correctly");
|
||||
// Add a second gamepad, should automatically show up.
|
||||
GamepadService.addGamepad("test gamepad 2", // id
|
||||
internal_index2 = await GamepadService.addGamepad("test gamepad 2", // id
|
||||
GamepadService.standardMapping,
|
||||
GamepadService.noHand,
|
||||
4, // buttons
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0).then(function(index) {
|
||||
internal_index2 = index;
|
||||
GamepadService.newButtonEvent(internal_index2, 0, true, true);
|
||||
});
|
||||
0);
|
||||
|
||||
await GamepadService.newButtonEvent(internal_index2, 0, true, true);
|
||||
|
||||
ok(true, "Done checking first gamepad");
|
||||
}
|
||||
|
||||
function check_second_gamepad(e) {
|
||||
async function check_second_gamepad(e) {
|
||||
ok(true, "Checking second gamepad");
|
||||
// Second gamepad gets added.
|
||||
is(e.gamepad.index, 1, "gamepad index should be 1")
|
||||
@@ -94,11 +95,11 @@ function check_second_gamepad(e) {
|
||||
is(gamepads[e.gamepad.index], e.gamepad, "right gamepad exposed at index");
|
||||
is(gamepads[content_index2], e.gamepad, "gamepad counter working correctly");
|
||||
// Now remove the first one.
|
||||
GamepadService.removeGamepad(internal_index1);
|
||||
await GamepadService.removeGamepad(internal_index1);
|
||||
ok(true, "Done checking second gamepad");
|
||||
}
|
||||
|
||||
function check_gamepad_hole(e) {
|
||||
async function check_gamepad_hole(e) {
|
||||
ok(true, "Checking gamepad hole");
|
||||
// First gamepad gets removed.
|
||||
var gamepads = navigator.getGamepads();
|
||||
@@ -106,7 +107,7 @@ function check_gamepad_hole(e) {
|
||||
is(gamepads[content_index1], null, "should be a hole in the gamepad list");
|
||||
isnot(gamepads[content_index2], null, "second gamepad should exist");
|
||||
// Now remove the second one.
|
||||
GamepadService.removeGamepad(internal_index2);
|
||||
await GamepadService.removeGamepad(internal_index2);
|
||||
ok(true, "Done checking gamepad hole");
|
||||
}
|
||||
|
||||
|
||||
@@ -22,31 +22,37 @@ interface GamepadServiceTest
|
||||
unsigned long numLightIndicator,
|
||||
unsigned long numTouchEvents);
|
||||
|
||||
void removeGamepad(unsigned long index);
|
||||
[Throws]
|
||||
Promise<unsigned long> removeGamepad(unsigned long index);
|
||||
|
||||
void newButtonEvent(unsigned long index,
|
||||
[Throws]
|
||||
Promise<unsigned long> newButtonEvent(unsigned long index,
|
||||
unsigned long button,
|
||||
boolean pressed,
|
||||
boolean touched);
|
||||
|
||||
void newButtonValueEvent(unsigned long index,
|
||||
[Throws]
|
||||
Promise<unsigned long> newButtonValueEvent(unsigned long index,
|
||||
unsigned long button,
|
||||
boolean pressed,
|
||||
boolean touched,
|
||||
double value);
|
||||
|
||||
void newAxisMoveEvent(unsigned long index,
|
||||
[Throws]
|
||||
Promise<unsigned long> newAxisMoveEvent(unsigned long index,
|
||||
unsigned long axis,
|
||||
double value);
|
||||
void newPoseMove(unsigned long index,
|
||||
[Throws]
|
||||
Promise<unsigned long> newPoseMove(unsigned long index,
|
||||
Float32Array? orient,
|
||||
Float32Array? pos,
|
||||
Float32Array? angVelocity,
|
||||
Float32Array? angAcceleration,
|
||||
Float32Array? linVelocity,
|
||||
Float32Array? linAcceleration);
|
||||
|
||||
void newTouch(unsigned long index, unsigned long aTouchArrayIndex,
|
||||
|
||||
[Throws]
|
||||
Promise<unsigned long> newTouch(unsigned long index, unsigned long aTouchArrayIndex,
|
||||
unsigned long touchId, octet surfaceId,
|
||||
Float32Array position, Float32Array? surfaceDimension);
|
||||
};
|
||||
Reference in New Issue
Block a user