haikuwebkit/LayoutTests/gamepad/gamepad-visibility-1.html

57 lines
1.1 KiB
HTML
Raw Permalink Normal View History

Require a button press on a gamepad for them to be exposed to the DOM. <rdar://problem/28620919> and https://bugs.webkit.org/show_bug.cgi?id=167272 Reviewed by Alex Christensen. Source/WebCore: Test: gamepad/gamepad-visibility-1.html * Modules/gamepad/GamepadManager.cpp: (WebCore::GamepadManager::platformGamepadInputActivity): * Modules/gamepad/GamepadManager.h: * platform/gamepad/GamepadProvider.cpp: (WebCore::GamepadProvider::dispatchPlatformGamepadInputActivity): * platform/gamepad/GamepadProvider.h: (WebCore::GamepadProvider::~GamepadProvider): Deleted. (WebCore::GamepadProvider::isMockGamepadProvider): Deleted. * platform/gamepad/GamepadProviderClient.h: * platform/gamepad/cocoa/GameControllerGamepad.h: * platform/gamepad/cocoa/GameControllerGamepad.mm: (WebCore::GameControllerGamepad::setupAsExtendedGamepad): (WebCore::GameControllerGamepad::setupAsGamepad): * platform/gamepad/cocoa/GameControllerGamepadProvider.h: * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: (WebCore::GameControllerGamepadProvider::gamepadHadInput): (WebCore::GameControllerGamepadProvider::inputNotificationTimerFired): * platform/gamepad/mac/HIDGamepad.cpp: (WebCore::HIDGamepad::valueChanged): * platform/gamepad/mac/HIDGamepad.h: * platform/gamepad/mac/HIDGamepadProvider.cpp: (WebCore::HIDGamepadProvider::valuesChanged): (WebCore::HIDGamepadProvider::inputNotificationTimerFired): * platform/gamepad/mac/HIDGamepadProvider.h: * testing/MockGamepadProvider.cpp: (WebCore::MockGamepadProvider::setMockGamepadButtonValue): (WebCore::MockGamepadProvider::gamepadInputActivity): * testing/MockGamepadProvider.h: Source/WebKit2: * UIProcess/Gamepad/UIGamepadProvider.cpp: (WebKit::UIGamepadProvider::gamepadSyncTimerFired): (WebKit::UIGamepadProvider::platformGamepadInputActivity): * UIProcess/Gamepad/UIGamepadProvider.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::gamepadActivity): * UIProcess/WebPageProxy.h: * WebProcess/Gamepad/WebGamepadProvider.cpp: (WebKit::WebGamepadProvider::gamepadActivity): * WebProcess/Gamepad/WebGamepadProvider.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::gamepadActivity): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: LayoutTests: * gamepad/gamepad-visibility-1-expected.txt: Added. * gamepad/gamepad-visibility-1.html: Added. Canonical link: https://commits.webkit.org/184321@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211007 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-21 02:24:17 +00:00
<head>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function log(msg)
{
document.getElementById("logger").innerHTML += msg + "<br>";
}
function finishTest()
{
if (testRunner)
testRunner.notifyDone();
}
var timeoutCount = 0;
function spinABit()
{
if (timeoutCount == 20) {
log("No connect event seen in 20 run loop spins. Yay.");
finishTest();
}
++timeoutCount;
setTimeout(spinABit, 0);
}
function handleGamepadConnect()
{
log("Connect event seen! Should NOT have been seen");
finishTest();
}
function runTest() {
addEventListener("gamepadconnected", handleGamepadConnect);
// Connecting the gamepad and changing axis values should *not* make it visible.
// Only button presses should expose it.
Standard gamepad mapping for GameControllerGamepads https://bugs.webkit.org/show_bug.cgi?id=206033 Patch by James Howard <jameshoward@mac.com> on 2020-02-10 Reviewed by Dean Jackson. Source/WebCore: Extend PlatformGamepad to add a field for the gamepad mapping. The mapping defines the order and interpretation of the axes and buttons vectors, and is passed along to users of the Gamepad API[1]. Letting PlatformGamepad subclassers define their mapping is the natural place for this functionality. The PlatformGamepad already defines the order of the axes and buttons and PlatformGamepad subclassers may know something about the physical layout of the gamepad they represent. This change modifies the GameControllerGamepad subclass of PlatformGamepad to set the mapping to "standard" when a GCExtendedGamepad is detected, and to bind the axes and buttons appropriately. Previously, the buttons and axes were bound arbitrarily, and in some cases incompletely. While that wasn't a bug per se, because with the mapping set to the empty string an implementation is free to provide any interpretation of the gamepad elements it likes, it was certainly less useful than the "standard" mapping. [1] https://www.w3.org/TR/gamepad/#remapping * Modules/gamepad/Gamepad.cpp: (WebCore::Gamepad::Gamepad): * platform/gamepad/PlatformGamepad.h: (WebCore::PlatformGamepad::mapping const): * platform/gamepad/cocoa/GameControllerGamepad.mm: (WebCore::GameControllerGamepad::setupAsExtendedGamepad): * testing/MockGamepad.cpp: (WebCore::MockGamepad::MockGamepad): (WebCore::MockGamepad::updateDetails): * testing/MockGamepad.h: * testing/MockGamepadProvider.cpp: (WebCore::MockGamepadProvider::setMockGamepadDetails): * testing/MockGamepadProvider.h: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setMockGamepadDetails): * testing/js/WebCoreTestSupport.h: Source/WebKit: Make the mapping as provided by PlatformGamepad available in UIGamepad, and pass it along to GamepadData so it can be correctly reflected in the Gamepad API. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::encode const): (WebKit::GamepadData::decode): * Shared/Gamepad/GamepadData.h: (WebKit::GamepadData::mapping const): * UIProcess/Gamepad/UIGamepad.cpp: (WebKit::UIGamepad::UIGamepad): (WebKit::UIGamepad::fullGamepadData const): * UIProcess/Gamepad/UIGamepad.h: * WebProcess/Gamepad/WebGamepad.cpp: (WebKit::WebGamepad::WebGamepad): Tools: * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setMockGamepadDetails): * WebKitTestRunner/InjectedBundle/TestRunner.h: * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): LayoutTests: * gamepad/gamepad-polling-access-expected.txt: * gamepad/gamepad-polling-access.html: * gamepad/gamepad-timestamp.html: * gamepad/gamepad-visibility-1.html: Canonical link: https://commits.webkit.org/220496@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256215 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-02-10 22:38:22 +00:00
testRunner.setMockGamepadDetails(0, "Test Joystick", "", 2, 2);
Require a button press on a gamepad for them to be exposed to the DOM. <rdar://problem/28620919> and https://bugs.webkit.org/show_bug.cgi?id=167272 Reviewed by Alex Christensen. Source/WebCore: Test: gamepad/gamepad-visibility-1.html * Modules/gamepad/GamepadManager.cpp: (WebCore::GamepadManager::platformGamepadInputActivity): * Modules/gamepad/GamepadManager.h: * platform/gamepad/GamepadProvider.cpp: (WebCore::GamepadProvider::dispatchPlatformGamepadInputActivity): * platform/gamepad/GamepadProvider.h: (WebCore::GamepadProvider::~GamepadProvider): Deleted. (WebCore::GamepadProvider::isMockGamepadProvider): Deleted. * platform/gamepad/GamepadProviderClient.h: * platform/gamepad/cocoa/GameControllerGamepad.h: * platform/gamepad/cocoa/GameControllerGamepad.mm: (WebCore::GameControllerGamepad::setupAsExtendedGamepad): (WebCore::GameControllerGamepad::setupAsGamepad): * platform/gamepad/cocoa/GameControllerGamepadProvider.h: * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: (WebCore::GameControllerGamepadProvider::gamepadHadInput): (WebCore::GameControllerGamepadProvider::inputNotificationTimerFired): * platform/gamepad/mac/HIDGamepad.cpp: (WebCore::HIDGamepad::valueChanged): * platform/gamepad/mac/HIDGamepad.h: * platform/gamepad/mac/HIDGamepadProvider.cpp: (WebCore::HIDGamepadProvider::valuesChanged): (WebCore::HIDGamepadProvider::inputNotificationTimerFired): * platform/gamepad/mac/HIDGamepadProvider.h: * testing/MockGamepadProvider.cpp: (WebCore::MockGamepadProvider::setMockGamepadButtonValue): (WebCore::MockGamepadProvider::gamepadInputActivity): * testing/MockGamepadProvider.h: Source/WebKit2: * UIProcess/Gamepad/UIGamepadProvider.cpp: (WebKit::UIGamepadProvider::gamepadSyncTimerFired): (WebKit::UIGamepadProvider::platformGamepadInputActivity): * UIProcess/Gamepad/UIGamepadProvider.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::gamepadActivity): * UIProcess/WebPageProxy.h: * WebProcess/Gamepad/WebGamepadProvider.cpp: (WebKit::WebGamepadProvider::gamepadActivity): * WebProcess/Gamepad/WebGamepadProvider.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::gamepadActivity): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: LayoutTests: * gamepad/gamepad-visibility-1-expected.txt: Added. * gamepad/gamepad-visibility-1.html: Added. Canonical link: https://commits.webkit.org/184321@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211007 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-21 02:24:17 +00:00
testRunner.connectMockGamepad(0);
testRunner.setMockGamepadAxisValue(0, 0, 0.7);
testRunner.setMockGamepadAxisValue(0, 1, -1.0);
setTimeout(spinABit, 0);
}
</script>
</head>
<body onload="runTest();">
<div id="logger"></div>
</body>