haikuwebkit/LayoutTests/gamepad/gamepad-polling-access.html

102 lines
2.4 KiB
HTML
Raw Permalink Normal View History

WK2 Gamepad layout test support. https://bugs.webkit.org/show_bug.cgi?id=134671 Source/WebCore: Reviewed by Alex Christensen. No new tests (Covered by changes to existing tests). Add a MockGamepadProvider and expose it in WebCoreTestSupport. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * Modules/gamepad/Gamepad.cpp: (WebCore::Gamepad::Gamepad): * bindings/generic/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::reset): Deleted. Gamepads should either always be enabled during tests (As in Mac WK2), or never enabled (As in all other platforms). * bindings/generic/RuntimeEnabledFeatures.h: * platform/gamepad/GamepadProvider.h: (WebCore::GamepadProvider::isMockGamepadProvider): * testing/MockGamepad.cpp: Copied from Source/WebKit2/Shared/Gamepad/GamepadData.cpp. (WebCore::MockGamepad::MockGamepad): (WebCore::MockGamepad::updateDetails): (WebCore::MockGamepad::setAxisValue): (WebCore::MockGamepad::setButtonValue): * testing/MockGamepad.h: Copied from Source/WebKit2/UIProcess/Gamepad/UIGamepad.h. * testing/MockGamepadProvider.cpp: Added. (WebCore::MockGamepadProvider::singleton): (WebCore::MockGamepadProvider::MockGamepadProvider): (WebCore::MockGamepadProvider::startMonitoringGamepads): (WebCore::MockGamepadProvider::stopMonitoringGamepads): (WebCore::MockGamepadProvider::setMockGamepadDetails): (WebCore::MockGamepadProvider::connectMockGamepad): (WebCore::MockGamepadProvider::disconnectMockGamepad): (WebCore::MockGamepadProvider::setMockGamepadAxisValue): (WebCore::MockGamepadProvider::setMockGamepadButtonValue): (WebCore::MockGamepadProvider::gamepadInputActivity): * testing/MockGamepadProvider.h: Copied from Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h. (WebCore::MockGamepadProvider::~MockGamepadProvider): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::installMockGamepadProvider): (WebCoreTestSupport::connectMockGamepad): (WebCoreTestSupport::disconnectMockGamepad): (WebCoreTestSupport::setMockGamepadDetails): (WebCoreTestSupport::setMockGamepadAxisValue): (WebCoreTestSupport::setMockGamepadButtonValue): * testing/js/WebCoreTestSupport.h: Source/WebKit2: Reviewed by Alex Christensen. - Teach the UIGamepadProvider to use the default shared provider. - Especially if its the MockGamepadProvider, don't overwrite it. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::encode): (WebKit::GamepadData::decode): (WebKit::GamepadData::loggingString): (WebKit::GamepadData::isNull): Deleted. * Shared/Gamepad/GamepadData.h: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::isNull): (WebKit::GamepadData::index): (WebKit::GamepadData::axisValues): (WebKit::GamepadData::buttonValues): * UIProcess/Gamepad/UIGamepad.h: * UIProcess/Gamepad/UIGamepadProvider.cpp: (WebKit::UIGamepadProvider::UIGamepadProvider): (WebKit::UIGamepadProvider::~UIGamepadProvider): (WebKit::UIGamepadProvider::platformGamepadInputActivity): (WebKit::UIGamepadProvider::startMonitoringGamepads): (WebKit::UIGamepadProvider::stopMonitoringGamepads): (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): * UIProcess/Gamepad/UIGamepadProvider.h: * UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp: (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): (WebKit::UIGamepadProvider::platformStopMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformStopMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformGamepads): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/Gamepad/WebGamepad.cpp: (WebKit::WebGamepad::WebGamepad): (WebKit::WebGamepad::updateValues): * WebProcess/Gamepad/WebGamepad.h: * WebProcess/Gamepad/WebGamepadProvider.cpp: (WebKit::WebGamepadProvider::gamepadConnected): * WebProcess/Gamepad/WebGamepadProvider.h: * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.h: Tools: Reviewed by Alex Christensen. Have the injected bundle expose the MockGamepadProvider to the UI process, which will then feed back into the UIGamepadProvider. Also, fool NSApplication into treating the most recently created "isKeyWindow" of the test windows as the actual keyWindow for the test runner, which will allow the view to get gamepad updates. * WebKitTestRunner/Configurations/WebKitTestRunner.xcconfig: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setMockGamepadDetails): (WTR::TestRunner::setMockGamepadAxisValue): (WTR::TestRunner::setMockGamepadButtonValue): * WebKitTestRunner/PlatformWebView.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): Deleted. * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: * WebKitTestRunner/ios/PlatformWebViewIOS.mm: (-[WebKitTestRunnerWindow initWithFrame:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/ios/TestControllerIOS.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/PlatformWebViewMac.mm: (+[WebKitTestRunnerWindow _WTR_keyWindow]): (-[WebKitTestRunnerWindow initWithContentRect:styleMask:backing:defer:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/mac/TestControllerMac.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/main.mm: LayoutTests: Reviewed by Alex Christensen. * gamepad/gamepad-api-expected.txt: * gamepad/gamepad-api.html: * gamepad/gamepad-out-of-range-crasher-expected.txt: Removed. * gamepad/gamepad-out-of-range-crasher.html: Removed. * gamepad/gamepad-polling-access-expected.txt: * gamepad/gamepad-polling-access.html: * platform/mac/TestExpectations: * platform/mac-wk1/TestExpectations: * platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt: Added. Canonical link: https://commits.webkit.org/179243@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-23 19:41:00 +00:00
<head>
Adding gamepad support https://bugs.webkit.org/show_bug.cgi?id=69451 Source/WebCore: Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. Plumb gamepad data access through platform. Test: gamepad/gamepad-polling-access.html * WebCore.gypi: * page/Navigator.cpp: (WebCore::Navigator::webkitGamepads): * page/Navigator.h: * platform/Gamepads.h: Added. * platform/chromium/GamepadsChromium.cpp: Added. (WebCore::sampleGamepads): * platform/chromium/PlatformSupport.h: Source/WebKit/chromium: Add implementation of sampleGamepads in Chromium platform. Retrieves gamepad data from Chromium port and converts to DOM format, i.e. GamepadList. Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. * src/PlatformSupport.cpp: (WebCore::PlatformSupport::sampleGamepads): Tools: Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. Add a 'gamepadController' to Chromium DRT. Allows for setting of mock gamepad data that will be retrieved when JS code pulls via API access. * DumpRenderTree/DumpRenderTree.gypi: * DumpRenderTree/chromium/GamepadController.cpp: Added. (GamepadController::GamepadController): (GamepadController::bindToJavascript): (GamepadController::reset): (GamepadController::connect): (GamepadController::disconnect): (GamepadController::setId): (GamepadController::setButtonCount): (GamepadController::setButtonData): (GamepadController::setAxisCount): (GamepadController::setAxisData): (GamepadController::fallbackCallback): * DumpRenderTree/chromium/GamepadController.h: Added. * DumpRenderTree/chromium/TestShell.cpp: (TestShell::TestShell): (TestShell::resetTestController): (TestShell::bindJSObjectsToWindow): * DumpRenderTree/chromium/TestShell.h: (TestShell::gamepadController): LayoutTests: Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. * fast/dom/script-tests/prototype-inheritance.js: Exclude gamepadController from enumeration. * gamepad/gamepad-polling-access-expected.txt: Added. * gamepad/gamepad-polling-access.html: Added. Canonical link: https://commits.webkit.org/89548@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@101065 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-11-23 12:16:13 +00:00
<script>
WK2 Gamepad layout test support. https://bugs.webkit.org/show_bug.cgi?id=134671 Source/WebCore: Reviewed by Alex Christensen. No new tests (Covered by changes to existing tests). Add a MockGamepadProvider and expose it in WebCoreTestSupport. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * Modules/gamepad/Gamepad.cpp: (WebCore::Gamepad::Gamepad): * bindings/generic/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::reset): Deleted. Gamepads should either always be enabled during tests (As in Mac WK2), or never enabled (As in all other platforms). * bindings/generic/RuntimeEnabledFeatures.h: * platform/gamepad/GamepadProvider.h: (WebCore::GamepadProvider::isMockGamepadProvider): * testing/MockGamepad.cpp: Copied from Source/WebKit2/Shared/Gamepad/GamepadData.cpp. (WebCore::MockGamepad::MockGamepad): (WebCore::MockGamepad::updateDetails): (WebCore::MockGamepad::setAxisValue): (WebCore::MockGamepad::setButtonValue): * testing/MockGamepad.h: Copied from Source/WebKit2/UIProcess/Gamepad/UIGamepad.h. * testing/MockGamepadProvider.cpp: Added. (WebCore::MockGamepadProvider::singleton): (WebCore::MockGamepadProvider::MockGamepadProvider): (WebCore::MockGamepadProvider::startMonitoringGamepads): (WebCore::MockGamepadProvider::stopMonitoringGamepads): (WebCore::MockGamepadProvider::setMockGamepadDetails): (WebCore::MockGamepadProvider::connectMockGamepad): (WebCore::MockGamepadProvider::disconnectMockGamepad): (WebCore::MockGamepadProvider::setMockGamepadAxisValue): (WebCore::MockGamepadProvider::setMockGamepadButtonValue): (WebCore::MockGamepadProvider::gamepadInputActivity): * testing/MockGamepadProvider.h: Copied from Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h. (WebCore::MockGamepadProvider::~MockGamepadProvider): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::installMockGamepadProvider): (WebCoreTestSupport::connectMockGamepad): (WebCoreTestSupport::disconnectMockGamepad): (WebCoreTestSupport::setMockGamepadDetails): (WebCoreTestSupport::setMockGamepadAxisValue): (WebCoreTestSupport::setMockGamepadButtonValue): * testing/js/WebCoreTestSupport.h: Source/WebKit2: Reviewed by Alex Christensen. - Teach the UIGamepadProvider to use the default shared provider. - Especially if its the MockGamepadProvider, don't overwrite it. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::encode): (WebKit::GamepadData::decode): (WebKit::GamepadData::loggingString): (WebKit::GamepadData::isNull): Deleted. * Shared/Gamepad/GamepadData.h: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::isNull): (WebKit::GamepadData::index): (WebKit::GamepadData::axisValues): (WebKit::GamepadData::buttonValues): * UIProcess/Gamepad/UIGamepad.h: * UIProcess/Gamepad/UIGamepadProvider.cpp: (WebKit::UIGamepadProvider::UIGamepadProvider): (WebKit::UIGamepadProvider::~UIGamepadProvider): (WebKit::UIGamepadProvider::platformGamepadInputActivity): (WebKit::UIGamepadProvider::startMonitoringGamepads): (WebKit::UIGamepadProvider::stopMonitoringGamepads): (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): * UIProcess/Gamepad/UIGamepadProvider.h: * UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp: (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): (WebKit::UIGamepadProvider::platformStopMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformStopMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformGamepads): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/Gamepad/WebGamepad.cpp: (WebKit::WebGamepad::WebGamepad): (WebKit::WebGamepad::updateValues): * WebProcess/Gamepad/WebGamepad.h: * WebProcess/Gamepad/WebGamepadProvider.cpp: (WebKit::WebGamepadProvider::gamepadConnected): * WebProcess/Gamepad/WebGamepadProvider.h: * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.h: Tools: Reviewed by Alex Christensen. Have the injected bundle expose the MockGamepadProvider to the UI process, which will then feed back into the UIGamepadProvider. Also, fool NSApplication into treating the most recently created "isKeyWindow" of the test windows as the actual keyWindow for the test runner, which will allow the view to get gamepad updates. * WebKitTestRunner/Configurations/WebKitTestRunner.xcconfig: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setMockGamepadDetails): (WTR::TestRunner::setMockGamepadAxisValue): (WTR::TestRunner::setMockGamepadButtonValue): * WebKitTestRunner/PlatformWebView.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): Deleted. * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: * WebKitTestRunner/ios/PlatformWebViewIOS.mm: (-[WebKitTestRunnerWindow initWithFrame:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/ios/TestControllerIOS.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/PlatformWebViewMac.mm: (+[WebKitTestRunnerWindow _WTR_keyWindow]): (-[WebKitTestRunnerWindow initWithContentRect:styleMask:backing:defer:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/mac/TestControllerMac.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/main.mm: LayoutTests: Reviewed by Alex Christensen. * gamepad/gamepad-api-expected.txt: * gamepad/gamepad-api.html: * gamepad/gamepad-out-of-range-crasher-expected.txt: Removed. * gamepad/gamepad-out-of-range-crasher.html: Removed. * gamepad/gamepad-polling-access-expected.txt: * gamepad/gamepad-polling-access.html: * platform/mac/TestExpectations: * platform/mac-wk1/TestExpectations: * platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt: Added. Canonical link: https://commits.webkit.org/179243@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-23 19:41:00 +00:00
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function log(msg)
{
document.getElementById("logger").innerHTML += msg + "<br>";
}
function finishTest()
{
if (testRunner)
testRunner.notifyDone();
}
function handleGamepadConnect(evt)
{
log("Connecting gamepad:");
log(navigator.getGamepads());
logGamepad(evt.gamepad);
testGenerator.next();
}
function handleGamepadDisconnect(evt)
{
log("Disconnecting gamepad:");
log(navigator.getGamepads());
testGenerator.next();
}
function logGamepad(gp)
{
log("Name: " + gp.id);
WK2 Gamepad layout test support. https://bugs.webkit.org/show_bug.cgi?id=134671 Source/WebCore: Reviewed by Alex Christensen. No new tests (Covered by changes to existing tests). Add a MockGamepadProvider and expose it in WebCoreTestSupport. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * Modules/gamepad/Gamepad.cpp: (WebCore::Gamepad::Gamepad): * bindings/generic/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::reset): Deleted. Gamepads should either always be enabled during tests (As in Mac WK2), or never enabled (As in all other platforms). * bindings/generic/RuntimeEnabledFeatures.h: * platform/gamepad/GamepadProvider.h: (WebCore::GamepadProvider::isMockGamepadProvider): * testing/MockGamepad.cpp: Copied from Source/WebKit2/Shared/Gamepad/GamepadData.cpp. (WebCore::MockGamepad::MockGamepad): (WebCore::MockGamepad::updateDetails): (WebCore::MockGamepad::setAxisValue): (WebCore::MockGamepad::setButtonValue): * testing/MockGamepad.h: Copied from Source/WebKit2/UIProcess/Gamepad/UIGamepad.h. * testing/MockGamepadProvider.cpp: Added. (WebCore::MockGamepadProvider::singleton): (WebCore::MockGamepadProvider::MockGamepadProvider): (WebCore::MockGamepadProvider::startMonitoringGamepads): (WebCore::MockGamepadProvider::stopMonitoringGamepads): (WebCore::MockGamepadProvider::setMockGamepadDetails): (WebCore::MockGamepadProvider::connectMockGamepad): (WebCore::MockGamepadProvider::disconnectMockGamepad): (WebCore::MockGamepadProvider::setMockGamepadAxisValue): (WebCore::MockGamepadProvider::setMockGamepadButtonValue): (WebCore::MockGamepadProvider::gamepadInputActivity): * testing/MockGamepadProvider.h: Copied from Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h. (WebCore::MockGamepadProvider::~MockGamepadProvider): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::installMockGamepadProvider): (WebCoreTestSupport::connectMockGamepad): (WebCoreTestSupport::disconnectMockGamepad): (WebCoreTestSupport::setMockGamepadDetails): (WebCoreTestSupport::setMockGamepadAxisValue): (WebCoreTestSupport::setMockGamepadButtonValue): * testing/js/WebCoreTestSupport.h: Source/WebKit2: Reviewed by Alex Christensen. - Teach the UIGamepadProvider to use the default shared provider. - Especially if its the MockGamepadProvider, don't overwrite it. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::encode): (WebKit::GamepadData::decode): (WebKit::GamepadData::loggingString): (WebKit::GamepadData::isNull): Deleted. * Shared/Gamepad/GamepadData.h: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::isNull): (WebKit::GamepadData::index): (WebKit::GamepadData::axisValues): (WebKit::GamepadData::buttonValues): * UIProcess/Gamepad/UIGamepad.h: * UIProcess/Gamepad/UIGamepadProvider.cpp: (WebKit::UIGamepadProvider::UIGamepadProvider): (WebKit::UIGamepadProvider::~UIGamepadProvider): (WebKit::UIGamepadProvider::platformGamepadInputActivity): (WebKit::UIGamepadProvider::startMonitoringGamepads): (WebKit::UIGamepadProvider::stopMonitoringGamepads): (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): * UIProcess/Gamepad/UIGamepadProvider.h: * UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp: (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): (WebKit::UIGamepadProvider::platformStopMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformStopMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformGamepads): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/Gamepad/WebGamepad.cpp: (WebKit::WebGamepad::WebGamepad): (WebKit::WebGamepad::updateValues): * WebProcess/Gamepad/WebGamepad.h: * WebProcess/Gamepad/WebGamepadProvider.cpp: (WebKit::WebGamepadProvider::gamepadConnected): * WebProcess/Gamepad/WebGamepadProvider.h: * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.h: Tools: Reviewed by Alex Christensen. Have the injected bundle expose the MockGamepadProvider to the UI process, which will then feed back into the UIGamepadProvider. Also, fool NSApplication into treating the most recently created "isKeyWindow" of the test windows as the actual keyWindow for the test runner, which will allow the view to get gamepad updates. * WebKitTestRunner/Configurations/WebKitTestRunner.xcconfig: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setMockGamepadDetails): (WTR::TestRunner::setMockGamepadAxisValue): (WTR::TestRunner::setMockGamepadButtonValue): * WebKitTestRunner/PlatformWebView.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): Deleted. * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: * WebKitTestRunner/ios/PlatformWebViewIOS.mm: (-[WebKitTestRunnerWindow initWithFrame:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/ios/TestControllerIOS.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/PlatformWebViewMac.mm: (+[WebKitTestRunnerWindow _WTR_keyWindow]): (-[WebKitTestRunnerWindow initWithContentRect:styleMask:backing:defer:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/mac/TestControllerMac.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/main.mm: LayoutTests: Reviewed by Alex Christensen. * gamepad/gamepad-api-expected.txt: * gamepad/gamepad-api.html: * gamepad/gamepad-out-of-range-crasher-expected.txt: Removed. * gamepad/gamepad-out-of-range-crasher.html: Removed. * gamepad/gamepad-polling-access-expected.txt: * gamepad/gamepad-polling-access.html: * platform/mac/TestExpectations: * platform/mac-wk1/TestExpectations: * platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt: Added. Canonical link: https://commits.webkit.org/179243@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-23 19:41:00 +00:00
log("Index: " + gp.index);
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
log("Mapping: " + gp.mapping);
WK2 Gamepad layout test support. https://bugs.webkit.org/show_bug.cgi?id=134671 Source/WebCore: Reviewed by Alex Christensen. No new tests (Covered by changes to existing tests). Add a MockGamepadProvider and expose it in WebCoreTestSupport. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * Modules/gamepad/Gamepad.cpp: (WebCore::Gamepad::Gamepad): * bindings/generic/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::reset): Deleted. Gamepads should either always be enabled during tests (As in Mac WK2), or never enabled (As in all other platforms). * bindings/generic/RuntimeEnabledFeatures.h: * platform/gamepad/GamepadProvider.h: (WebCore::GamepadProvider::isMockGamepadProvider): * testing/MockGamepad.cpp: Copied from Source/WebKit2/Shared/Gamepad/GamepadData.cpp. (WebCore::MockGamepad::MockGamepad): (WebCore::MockGamepad::updateDetails): (WebCore::MockGamepad::setAxisValue): (WebCore::MockGamepad::setButtonValue): * testing/MockGamepad.h: Copied from Source/WebKit2/UIProcess/Gamepad/UIGamepad.h. * testing/MockGamepadProvider.cpp: Added. (WebCore::MockGamepadProvider::singleton): (WebCore::MockGamepadProvider::MockGamepadProvider): (WebCore::MockGamepadProvider::startMonitoringGamepads): (WebCore::MockGamepadProvider::stopMonitoringGamepads): (WebCore::MockGamepadProvider::setMockGamepadDetails): (WebCore::MockGamepadProvider::connectMockGamepad): (WebCore::MockGamepadProvider::disconnectMockGamepad): (WebCore::MockGamepadProvider::setMockGamepadAxisValue): (WebCore::MockGamepadProvider::setMockGamepadButtonValue): (WebCore::MockGamepadProvider::gamepadInputActivity): * testing/MockGamepadProvider.h: Copied from Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h. (WebCore::MockGamepadProvider::~MockGamepadProvider): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::installMockGamepadProvider): (WebCoreTestSupport::connectMockGamepad): (WebCoreTestSupport::disconnectMockGamepad): (WebCoreTestSupport::setMockGamepadDetails): (WebCoreTestSupport::setMockGamepadAxisValue): (WebCoreTestSupport::setMockGamepadButtonValue): * testing/js/WebCoreTestSupport.h: Source/WebKit2: Reviewed by Alex Christensen. - Teach the UIGamepadProvider to use the default shared provider. - Especially if its the MockGamepadProvider, don't overwrite it. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::encode): (WebKit::GamepadData::decode): (WebKit::GamepadData::loggingString): (WebKit::GamepadData::isNull): Deleted. * Shared/Gamepad/GamepadData.h: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::isNull): (WebKit::GamepadData::index): (WebKit::GamepadData::axisValues): (WebKit::GamepadData::buttonValues): * UIProcess/Gamepad/UIGamepad.h: * UIProcess/Gamepad/UIGamepadProvider.cpp: (WebKit::UIGamepadProvider::UIGamepadProvider): (WebKit::UIGamepadProvider::~UIGamepadProvider): (WebKit::UIGamepadProvider::platformGamepadInputActivity): (WebKit::UIGamepadProvider::startMonitoringGamepads): (WebKit::UIGamepadProvider::stopMonitoringGamepads): (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): * UIProcess/Gamepad/UIGamepadProvider.h: * UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp: (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): (WebKit::UIGamepadProvider::platformStopMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformStopMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformGamepads): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/Gamepad/WebGamepad.cpp: (WebKit::WebGamepad::WebGamepad): (WebKit::WebGamepad::updateValues): * WebProcess/Gamepad/WebGamepad.h: * WebProcess/Gamepad/WebGamepadProvider.cpp: (WebKit::WebGamepadProvider::gamepadConnected): * WebProcess/Gamepad/WebGamepadProvider.h: * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.h: Tools: Reviewed by Alex Christensen. Have the injected bundle expose the MockGamepadProvider to the UI process, which will then feed back into the UIGamepadProvider. Also, fool NSApplication into treating the most recently created "isKeyWindow" of the test windows as the actual keyWindow for the test runner, which will allow the view to get gamepad updates. * WebKitTestRunner/Configurations/WebKitTestRunner.xcconfig: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setMockGamepadDetails): (WTR::TestRunner::setMockGamepadAxisValue): (WTR::TestRunner::setMockGamepadButtonValue): * WebKitTestRunner/PlatformWebView.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): Deleted. * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: * WebKitTestRunner/ios/PlatformWebViewIOS.mm: (-[WebKitTestRunnerWindow initWithFrame:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/ios/TestControllerIOS.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/PlatformWebViewMac.mm: (+[WebKitTestRunnerWindow _WTR_keyWindow]): (-[WebKitTestRunnerWindow initWithContentRect:styleMask:backing:defer:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/mac/TestControllerMac.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/main.mm: LayoutTests: Reviewed by Alex Christensen. * gamepad/gamepad-api-expected.txt: * gamepad/gamepad-api.html: * gamepad/gamepad-out-of-range-crasher-expected.txt: Removed. * gamepad/gamepad-out-of-range-crasher.html: Removed. * gamepad/gamepad-polling-access-expected.txt: * gamepad/gamepad-polling-access.html: * platform/mac/TestExpectations: * platform/mac-wk1/TestExpectations: * platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt: Added. Canonical link: https://commits.webkit.org/179243@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-23 19:41:00 +00:00
log("Axes: " + gp.axes);
var buttonString = "";
for (button in gp.buttons) {
buttonString += gp.buttons[button].pressed + "-" + gp.buttons[button].value + " ";
}
log("Buttons: " + buttonString);
}
function* testSteps() {
addEventListener("gamepadconnected", handleGamepadConnect);
addEventListener("gamepaddisconnected", handleGamepadDisconnect);
log("Initial gamepads length: " + navigator.getGamepads().length);
log("Connecting 20 different gamepads");
for (var i = 0; i < 20; ++i) {
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(i, i, "", i, i);
WK2 Gamepad layout test support. https://bugs.webkit.org/show_bug.cgi?id=134671 Source/WebCore: Reviewed by Alex Christensen. No new tests (Covered by changes to existing tests). Add a MockGamepadProvider and expose it in WebCoreTestSupport. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * Modules/gamepad/Gamepad.cpp: (WebCore::Gamepad::Gamepad): * bindings/generic/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::reset): Deleted. Gamepads should either always be enabled during tests (As in Mac WK2), or never enabled (As in all other platforms). * bindings/generic/RuntimeEnabledFeatures.h: * platform/gamepad/GamepadProvider.h: (WebCore::GamepadProvider::isMockGamepadProvider): * testing/MockGamepad.cpp: Copied from Source/WebKit2/Shared/Gamepad/GamepadData.cpp. (WebCore::MockGamepad::MockGamepad): (WebCore::MockGamepad::updateDetails): (WebCore::MockGamepad::setAxisValue): (WebCore::MockGamepad::setButtonValue): * testing/MockGamepad.h: Copied from Source/WebKit2/UIProcess/Gamepad/UIGamepad.h. * testing/MockGamepadProvider.cpp: Added. (WebCore::MockGamepadProvider::singleton): (WebCore::MockGamepadProvider::MockGamepadProvider): (WebCore::MockGamepadProvider::startMonitoringGamepads): (WebCore::MockGamepadProvider::stopMonitoringGamepads): (WebCore::MockGamepadProvider::setMockGamepadDetails): (WebCore::MockGamepadProvider::connectMockGamepad): (WebCore::MockGamepadProvider::disconnectMockGamepad): (WebCore::MockGamepadProvider::setMockGamepadAxisValue): (WebCore::MockGamepadProvider::setMockGamepadButtonValue): (WebCore::MockGamepadProvider::gamepadInputActivity): * testing/MockGamepadProvider.h: Copied from Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h. (WebCore::MockGamepadProvider::~MockGamepadProvider): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::installMockGamepadProvider): (WebCoreTestSupport::connectMockGamepad): (WebCoreTestSupport::disconnectMockGamepad): (WebCoreTestSupport::setMockGamepadDetails): (WebCoreTestSupport::setMockGamepadAxisValue): (WebCoreTestSupport::setMockGamepadButtonValue): * testing/js/WebCoreTestSupport.h: Source/WebKit2: Reviewed by Alex Christensen. - Teach the UIGamepadProvider to use the default shared provider. - Especially if its the MockGamepadProvider, don't overwrite it. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::encode): (WebKit::GamepadData::decode): (WebKit::GamepadData::loggingString): (WebKit::GamepadData::isNull): Deleted. * Shared/Gamepad/GamepadData.h: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::isNull): (WebKit::GamepadData::index): (WebKit::GamepadData::axisValues): (WebKit::GamepadData::buttonValues): * UIProcess/Gamepad/UIGamepad.h: * UIProcess/Gamepad/UIGamepadProvider.cpp: (WebKit::UIGamepadProvider::UIGamepadProvider): (WebKit::UIGamepadProvider::~UIGamepadProvider): (WebKit::UIGamepadProvider::platformGamepadInputActivity): (WebKit::UIGamepadProvider::startMonitoringGamepads): (WebKit::UIGamepadProvider::stopMonitoringGamepads): (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): * UIProcess/Gamepad/UIGamepadProvider.h: * UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp: (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): (WebKit::UIGamepadProvider::platformStopMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformStopMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformGamepads): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/Gamepad/WebGamepad.cpp: (WebKit::WebGamepad::WebGamepad): (WebKit::WebGamepad::updateValues): * WebProcess/Gamepad/WebGamepad.h: * WebProcess/Gamepad/WebGamepadProvider.cpp: (WebKit::WebGamepadProvider::gamepadConnected): * WebProcess/Gamepad/WebGamepadProvider.h: * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.h: Tools: Reviewed by Alex Christensen. Have the injected bundle expose the MockGamepadProvider to the UI process, which will then feed back into the UIGamepadProvider. Also, fool NSApplication into treating the most recently created "isKeyWindow" of the test windows as the actual keyWindow for the test runner, which will allow the view to get gamepad updates. * WebKitTestRunner/Configurations/WebKitTestRunner.xcconfig: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setMockGamepadDetails): (WTR::TestRunner::setMockGamepadAxisValue): (WTR::TestRunner::setMockGamepadButtonValue): * WebKitTestRunner/PlatformWebView.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): Deleted. * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: * WebKitTestRunner/ios/PlatformWebViewIOS.mm: (-[WebKitTestRunnerWindow initWithFrame:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/ios/TestControllerIOS.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/PlatformWebViewMac.mm: (+[WebKitTestRunnerWindow _WTR_keyWindow]): (-[WebKitTestRunnerWindow initWithContentRect:styleMask:backing:defer:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/mac/TestControllerMac.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/main.mm: LayoutTests: Reviewed by Alex Christensen. * gamepad/gamepad-api-expected.txt: * gamepad/gamepad-api.html: * gamepad/gamepad-out-of-range-crasher-expected.txt: Removed. * gamepad/gamepad-out-of-range-crasher.html: Removed. * gamepad/gamepad-polling-access-expected.txt: * gamepad/gamepad-polling-access.html: * platform/mac/TestExpectations: * platform/mac-wk1/TestExpectations: * platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt: Added. Canonical link: https://commits.webkit.org/179243@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-23 19:41:00 +00:00
testRunner.connectMockGamepad(i);
yield;
}
log("Verifying there are 20 connected gamepads in the set of all gamepads");
var gamepads = navigator.getGamepads();
log(gamepads);
for (i in gamepads) {
logGamepad(gamepads[i]);
Adding gamepad support https://bugs.webkit.org/show_bug.cgi?id=69451 Source/WebCore: Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. Plumb gamepad data access through platform. Test: gamepad/gamepad-polling-access.html * WebCore.gypi: * page/Navigator.cpp: (WebCore::Navigator::webkitGamepads): * page/Navigator.h: * platform/Gamepads.h: Added. * platform/chromium/GamepadsChromium.cpp: Added. (WebCore::sampleGamepads): * platform/chromium/PlatformSupport.h: Source/WebKit/chromium: Add implementation of sampleGamepads in Chromium platform. Retrieves gamepad data from Chromium port and converts to DOM format, i.e. GamepadList. Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. * src/PlatformSupport.cpp: (WebCore::PlatformSupport::sampleGamepads): Tools: Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. Add a 'gamepadController' to Chromium DRT. Allows for setting of mock gamepad data that will be retrieved when JS code pulls via API access. * DumpRenderTree/DumpRenderTree.gypi: * DumpRenderTree/chromium/GamepadController.cpp: Added. (GamepadController::GamepadController): (GamepadController::bindToJavascript): (GamepadController::reset): (GamepadController::connect): (GamepadController::disconnect): (GamepadController::setId): (GamepadController::setButtonCount): (GamepadController::setButtonData): (GamepadController::setAxisCount): (GamepadController::setAxisData): (GamepadController::fallbackCallback): * DumpRenderTree/chromium/GamepadController.h: Added. * DumpRenderTree/chromium/TestShell.cpp: (TestShell::TestShell): (TestShell::resetTestController): (TestShell::bindJSObjectsToWindow): * DumpRenderTree/chromium/TestShell.h: (TestShell::gamepadController): LayoutTests: Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. * fast/dom/script-tests/prototype-inheritance.js: Exclude gamepadController from enumeration. * gamepad/gamepad-polling-access-expected.txt: Added. * gamepad/gamepad-polling-access.html: Added. Canonical link: https://commits.webkit.org/89548@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@101065 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-11-23 12:16:13 +00:00
}
WK2 Gamepad layout test support. https://bugs.webkit.org/show_bug.cgi?id=134671 Source/WebCore: Reviewed by Alex Christensen. No new tests (Covered by changes to existing tests). Add a MockGamepadProvider and expose it in WebCoreTestSupport. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * Modules/gamepad/Gamepad.cpp: (WebCore::Gamepad::Gamepad): * bindings/generic/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::reset): Deleted. Gamepads should either always be enabled during tests (As in Mac WK2), or never enabled (As in all other platforms). * bindings/generic/RuntimeEnabledFeatures.h: * platform/gamepad/GamepadProvider.h: (WebCore::GamepadProvider::isMockGamepadProvider): * testing/MockGamepad.cpp: Copied from Source/WebKit2/Shared/Gamepad/GamepadData.cpp. (WebCore::MockGamepad::MockGamepad): (WebCore::MockGamepad::updateDetails): (WebCore::MockGamepad::setAxisValue): (WebCore::MockGamepad::setButtonValue): * testing/MockGamepad.h: Copied from Source/WebKit2/UIProcess/Gamepad/UIGamepad.h. * testing/MockGamepadProvider.cpp: Added. (WebCore::MockGamepadProvider::singleton): (WebCore::MockGamepadProvider::MockGamepadProvider): (WebCore::MockGamepadProvider::startMonitoringGamepads): (WebCore::MockGamepadProvider::stopMonitoringGamepads): (WebCore::MockGamepadProvider::setMockGamepadDetails): (WebCore::MockGamepadProvider::connectMockGamepad): (WebCore::MockGamepadProvider::disconnectMockGamepad): (WebCore::MockGamepadProvider::setMockGamepadAxisValue): (WebCore::MockGamepadProvider::setMockGamepadButtonValue): (WebCore::MockGamepadProvider::gamepadInputActivity): * testing/MockGamepadProvider.h: Copied from Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h. (WebCore::MockGamepadProvider::~MockGamepadProvider): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::installMockGamepadProvider): (WebCoreTestSupport::connectMockGamepad): (WebCoreTestSupport::disconnectMockGamepad): (WebCoreTestSupport::setMockGamepadDetails): (WebCoreTestSupport::setMockGamepadAxisValue): (WebCoreTestSupport::setMockGamepadButtonValue): * testing/js/WebCoreTestSupport.h: Source/WebKit2: Reviewed by Alex Christensen. - Teach the UIGamepadProvider to use the default shared provider. - Especially if its the MockGamepadProvider, don't overwrite it. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::encode): (WebKit::GamepadData::decode): (WebKit::GamepadData::loggingString): (WebKit::GamepadData::isNull): Deleted. * Shared/Gamepad/GamepadData.h: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::isNull): (WebKit::GamepadData::index): (WebKit::GamepadData::axisValues): (WebKit::GamepadData::buttonValues): * UIProcess/Gamepad/UIGamepad.h: * UIProcess/Gamepad/UIGamepadProvider.cpp: (WebKit::UIGamepadProvider::UIGamepadProvider): (WebKit::UIGamepadProvider::~UIGamepadProvider): (WebKit::UIGamepadProvider::platformGamepadInputActivity): (WebKit::UIGamepadProvider::startMonitoringGamepads): (WebKit::UIGamepadProvider::stopMonitoringGamepads): (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): * UIProcess/Gamepad/UIGamepadProvider.h: * UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp: (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): (WebKit::UIGamepadProvider::platformStopMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformStopMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformGamepads): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/Gamepad/WebGamepad.cpp: (WebKit::WebGamepad::WebGamepad): (WebKit::WebGamepad::updateValues): * WebProcess/Gamepad/WebGamepad.h: * WebProcess/Gamepad/WebGamepadProvider.cpp: (WebKit::WebGamepadProvider::gamepadConnected): * WebProcess/Gamepad/WebGamepadProvider.h: * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.h: Tools: Reviewed by Alex Christensen. Have the injected bundle expose the MockGamepadProvider to the UI process, which will then feed back into the UIGamepadProvider. Also, fool NSApplication into treating the most recently created "isKeyWindow" of the test windows as the actual keyWindow for the test runner, which will allow the view to get gamepad updates. * WebKitTestRunner/Configurations/WebKitTestRunner.xcconfig: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setMockGamepadDetails): (WTR::TestRunner::setMockGamepadAxisValue): (WTR::TestRunner::setMockGamepadButtonValue): * WebKitTestRunner/PlatformWebView.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): Deleted. * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: * WebKitTestRunner/ios/PlatformWebViewIOS.mm: (-[WebKitTestRunnerWindow initWithFrame:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/ios/TestControllerIOS.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/PlatformWebViewMac.mm: (+[WebKitTestRunnerWindow _WTR_keyWindow]): (-[WebKitTestRunnerWindow initWithContentRect:styleMask:backing:defer:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/mac/TestControllerMac.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/main.mm: LayoutTests: Reviewed by Alex Christensen. * gamepad/gamepad-api-expected.txt: * gamepad/gamepad-api.html: * gamepad/gamepad-out-of-range-crasher-expected.txt: Removed. * gamepad/gamepad-out-of-range-crasher.html: Removed. * gamepad/gamepad-polling-access-expected.txt: * gamepad/gamepad-polling-access.html: * platform/mac/TestExpectations: * platform/mac-wk1/TestExpectations: * platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt: Added. Canonical link: https://commits.webkit.org/179243@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-23 19:41:00 +00:00
log("Disconnecting gamepads in reverse order, making sure gamepads array remains as expected");
for (var i = 19; i >= 0; --i) {
testRunner.disconnectMockGamepad(i);
yield;
Adding gamepad support https://bugs.webkit.org/show_bug.cgi?id=69451 Source/WebCore: Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. Plumb gamepad data access through platform. Test: gamepad/gamepad-polling-access.html * WebCore.gypi: * page/Navigator.cpp: (WebCore::Navigator::webkitGamepads): * page/Navigator.h: * platform/Gamepads.h: Added. * platform/chromium/GamepadsChromium.cpp: Added. (WebCore::sampleGamepads): * platform/chromium/PlatformSupport.h: Source/WebKit/chromium: Add implementation of sampleGamepads in Chromium platform. Retrieves gamepad data from Chromium port and converts to DOM format, i.e. GamepadList. Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. * src/PlatformSupport.cpp: (WebCore::PlatformSupport::sampleGamepads): Tools: Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. Add a 'gamepadController' to Chromium DRT. Allows for setting of mock gamepad data that will be retrieved when JS code pulls via API access. * DumpRenderTree/DumpRenderTree.gypi: * DumpRenderTree/chromium/GamepadController.cpp: Added. (GamepadController::GamepadController): (GamepadController::bindToJavascript): (GamepadController::reset): (GamepadController::connect): (GamepadController::disconnect): (GamepadController::setId): (GamepadController::setButtonCount): (GamepadController::setButtonData): (GamepadController::setAxisCount): (GamepadController::setAxisData): (GamepadController::fallbackCallback): * DumpRenderTree/chromium/GamepadController.h: Added. * DumpRenderTree/chromium/TestShell.cpp: (TestShell::TestShell): (TestShell::resetTestController): (TestShell::bindJSObjectsToWindow): * DumpRenderTree/chromium/TestShell.h: (TestShell::gamepadController): LayoutTests: Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. * fast/dom/script-tests/prototype-inheritance.js: Exclude gamepadController from enumeration. * gamepad/gamepad-polling-access-expected.txt: Added. * gamepad/gamepad-polling-access.html: Added. Canonical link: https://commits.webkit.org/89548@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@101065 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-11-23 12:16:13 +00:00
}
WK2 Gamepad layout test support. https://bugs.webkit.org/show_bug.cgi?id=134671 Source/WebCore: Reviewed by Alex Christensen. No new tests (Covered by changes to existing tests). Add a MockGamepadProvider and expose it in WebCoreTestSupport. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * Modules/gamepad/Gamepad.cpp: (WebCore::Gamepad::Gamepad): * bindings/generic/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::reset): Deleted. Gamepads should either always be enabled during tests (As in Mac WK2), or never enabled (As in all other platforms). * bindings/generic/RuntimeEnabledFeatures.h: * platform/gamepad/GamepadProvider.h: (WebCore::GamepadProvider::isMockGamepadProvider): * testing/MockGamepad.cpp: Copied from Source/WebKit2/Shared/Gamepad/GamepadData.cpp. (WebCore::MockGamepad::MockGamepad): (WebCore::MockGamepad::updateDetails): (WebCore::MockGamepad::setAxisValue): (WebCore::MockGamepad::setButtonValue): * testing/MockGamepad.h: Copied from Source/WebKit2/UIProcess/Gamepad/UIGamepad.h. * testing/MockGamepadProvider.cpp: Added. (WebCore::MockGamepadProvider::singleton): (WebCore::MockGamepadProvider::MockGamepadProvider): (WebCore::MockGamepadProvider::startMonitoringGamepads): (WebCore::MockGamepadProvider::stopMonitoringGamepads): (WebCore::MockGamepadProvider::setMockGamepadDetails): (WebCore::MockGamepadProvider::connectMockGamepad): (WebCore::MockGamepadProvider::disconnectMockGamepad): (WebCore::MockGamepadProvider::setMockGamepadAxisValue): (WebCore::MockGamepadProvider::setMockGamepadButtonValue): (WebCore::MockGamepadProvider::gamepadInputActivity): * testing/MockGamepadProvider.h: Copied from Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h. (WebCore::MockGamepadProvider::~MockGamepadProvider): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::installMockGamepadProvider): (WebCoreTestSupport::connectMockGamepad): (WebCoreTestSupport::disconnectMockGamepad): (WebCoreTestSupport::setMockGamepadDetails): (WebCoreTestSupport::setMockGamepadAxisValue): (WebCoreTestSupport::setMockGamepadButtonValue): * testing/js/WebCoreTestSupport.h: Source/WebKit2: Reviewed by Alex Christensen. - Teach the UIGamepadProvider to use the default shared provider. - Especially if its the MockGamepadProvider, don't overwrite it. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::encode): (WebKit::GamepadData::decode): (WebKit::GamepadData::loggingString): (WebKit::GamepadData::isNull): Deleted. * Shared/Gamepad/GamepadData.h: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::isNull): (WebKit::GamepadData::index): (WebKit::GamepadData::axisValues): (WebKit::GamepadData::buttonValues): * UIProcess/Gamepad/UIGamepad.h: * UIProcess/Gamepad/UIGamepadProvider.cpp: (WebKit::UIGamepadProvider::UIGamepadProvider): (WebKit::UIGamepadProvider::~UIGamepadProvider): (WebKit::UIGamepadProvider::platformGamepadInputActivity): (WebKit::UIGamepadProvider::startMonitoringGamepads): (WebKit::UIGamepadProvider::stopMonitoringGamepads): (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): * UIProcess/Gamepad/UIGamepadProvider.h: * UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp: (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): (WebKit::UIGamepadProvider::platformStopMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformStopMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformGamepads): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/Gamepad/WebGamepad.cpp: (WebKit::WebGamepad::WebGamepad): (WebKit::WebGamepad::updateValues): * WebProcess/Gamepad/WebGamepad.h: * WebProcess/Gamepad/WebGamepadProvider.cpp: (WebKit::WebGamepadProvider::gamepadConnected): * WebProcess/Gamepad/WebGamepadProvider.h: * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.h: Tools: Reviewed by Alex Christensen. Have the injected bundle expose the MockGamepadProvider to the UI process, which will then feed back into the UIGamepadProvider. Also, fool NSApplication into treating the most recently created "isKeyWindow" of the test windows as the actual keyWindow for the test runner, which will allow the view to get gamepad updates. * WebKitTestRunner/Configurations/WebKitTestRunner.xcconfig: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setMockGamepadDetails): (WTR::TestRunner::setMockGamepadAxisValue): (WTR::TestRunner::setMockGamepadButtonValue): * WebKitTestRunner/PlatformWebView.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): Deleted. * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: * WebKitTestRunner/ios/PlatformWebViewIOS.mm: (-[WebKitTestRunnerWindow initWithFrame:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/ios/TestControllerIOS.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/PlatformWebViewMac.mm: (+[WebKitTestRunnerWindow _WTR_keyWindow]): (-[WebKitTestRunnerWindow initWithContentRect:styleMask:backing:defer:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/mac/TestControllerMac.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/main.mm: LayoutTests: Reviewed by Alex Christensen. * gamepad/gamepad-api-expected.txt: * gamepad/gamepad-api.html: * gamepad/gamepad-out-of-range-crasher-expected.txt: Removed. * gamepad/gamepad-out-of-range-crasher.html: Removed. * gamepad/gamepad-polling-access-expected.txt: * gamepad/gamepad-polling-access.html: * platform/mac/TestExpectations: * platform/mac-wk1/TestExpectations: * platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt: Added. Canonical link: https://commits.webkit.org/179243@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-23 19:41:00 +00:00
log("Checking non-zero'ed details for a gamepad");
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(10, "Awesome Joystick 5000", "standard", 4, 16);
WK2 Gamepad layout test support. https://bugs.webkit.org/show_bug.cgi?id=134671 Source/WebCore: Reviewed by Alex Christensen. No new tests (Covered by changes to existing tests). Add a MockGamepadProvider and expose it in WebCoreTestSupport. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * Modules/gamepad/Gamepad.cpp: (WebCore::Gamepad::Gamepad): * bindings/generic/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::reset): Deleted. Gamepads should either always be enabled during tests (As in Mac WK2), or never enabled (As in all other platforms). * bindings/generic/RuntimeEnabledFeatures.h: * platform/gamepad/GamepadProvider.h: (WebCore::GamepadProvider::isMockGamepadProvider): * testing/MockGamepad.cpp: Copied from Source/WebKit2/Shared/Gamepad/GamepadData.cpp. (WebCore::MockGamepad::MockGamepad): (WebCore::MockGamepad::updateDetails): (WebCore::MockGamepad::setAxisValue): (WebCore::MockGamepad::setButtonValue): * testing/MockGamepad.h: Copied from Source/WebKit2/UIProcess/Gamepad/UIGamepad.h. * testing/MockGamepadProvider.cpp: Added. (WebCore::MockGamepadProvider::singleton): (WebCore::MockGamepadProvider::MockGamepadProvider): (WebCore::MockGamepadProvider::startMonitoringGamepads): (WebCore::MockGamepadProvider::stopMonitoringGamepads): (WebCore::MockGamepadProvider::setMockGamepadDetails): (WebCore::MockGamepadProvider::connectMockGamepad): (WebCore::MockGamepadProvider::disconnectMockGamepad): (WebCore::MockGamepadProvider::setMockGamepadAxisValue): (WebCore::MockGamepadProvider::setMockGamepadButtonValue): (WebCore::MockGamepadProvider::gamepadInputActivity): * testing/MockGamepadProvider.h: Copied from Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h. (WebCore::MockGamepadProvider::~MockGamepadProvider): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::installMockGamepadProvider): (WebCoreTestSupport::connectMockGamepad): (WebCoreTestSupport::disconnectMockGamepad): (WebCoreTestSupport::setMockGamepadDetails): (WebCoreTestSupport::setMockGamepadAxisValue): (WebCoreTestSupport::setMockGamepadButtonValue): * testing/js/WebCoreTestSupport.h: Source/WebKit2: Reviewed by Alex Christensen. - Teach the UIGamepadProvider to use the default shared provider. - Especially if its the MockGamepadProvider, don't overwrite it. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::encode): (WebKit::GamepadData::decode): (WebKit::GamepadData::loggingString): (WebKit::GamepadData::isNull): Deleted. * Shared/Gamepad/GamepadData.h: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::isNull): (WebKit::GamepadData::index): (WebKit::GamepadData::axisValues): (WebKit::GamepadData::buttonValues): * UIProcess/Gamepad/UIGamepad.h: * UIProcess/Gamepad/UIGamepadProvider.cpp: (WebKit::UIGamepadProvider::UIGamepadProvider): (WebKit::UIGamepadProvider::~UIGamepadProvider): (WebKit::UIGamepadProvider::platformGamepadInputActivity): (WebKit::UIGamepadProvider::startMonitoringGamepads): (WebKit::UIGamepadProvider::stopMonitoringGamepads): (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): * UIProcess/Gamepad/UIGamepadProvider.h: * UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp: (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): (WebKit::UIGamepadProvider::platformStopMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformStopMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformGamepads): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/Gamepad/WebGamepad.cpp: (WebKit::WebGamepad::WebGamepad): (WebKit::WebGamepad::updateValues): * WebProcess/Gamepad/WebGamepad.h: * WebProcess/Gamepad/WebGamepadProvider.cpp: (WebKit::WebGamepadProvider::gamepadConnected): * WebProcess/Gamepad/WebGamepadProvider.h: * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.h: Tools: Reviewed by Alex Christensen. Have the injected bundle expose the MockGamepadProvider to the UI process, which will then feed back into the UIGamepadProvider. Also, fool NSApplication into treating the most recently created "isKeyWindow" of the test windows as the actual keyWindow for the test runner, which will allow the view to get gamepad updates. * WebKitTestRunner/Configurations/WebKitTestRunner.xcconfig: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setMockGamepadDetails): (WTR::TestRunner::setMockGamepadAxisValue): (WTR::TestRunner::setMockGamepadButtonValue): * WebKitTestRunner/PlatformWebView.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): Deleted. * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: * WebKitTestRunner/ios/PlatformWebViewIOS.mm: (-[WebKitTestRunnerWindow initWithFrame:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/ios/TestControllerIOS.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/PlatformWebViewMac.mm: (+[WebKitTestRunnerWindow _WTR_keyWindow]): (-[WebKitTestRunnerWindow initWithContentRect:styleMask:backing:defer:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/mac/TestControllerMac.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/main.mm: LayoutTests: Reviewed by Alex Christensen. * gamepad/gamepad-api-expected.txt: * gamepad/gamepad-api.html: * gamepad/gamepad-out-of-range-crasher-expected.txt: Removed. * gamepad/gamepad-out-of-range-crasher.html: Removed. * gamepad/gamepad-polling-access-expected.txt: * gamepad/gamepad-polling-access.html: * platform/mac/TestExpectations: * platform/mac-wk1/TestExpectations: * platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt: Added. Canonical link: https://commits.webkit.org/179243@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-23 19:41:00 +00:00
testRunner.setMockGamepadAxisValue(10, 0, 0.7);
testRunner.setMockGamepadAxisValue(10, 1, -0.9);
testRunner.setMockGamepadAxisValue(10, 2, 1.0);
testRunner.setMockGamepadAxisValue(10, 3, -1.0);
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
for (var i = 0; i < 16; ++i)
WK2 Gamepad layout test support. https://bugs.webkit.org/show_bug.cgi?id=134671 Source/WebCore: Reviewed by Alex Christensen. No new tests (Covered by changes to existing tests). Add a MockGamepadProvider and expose it in WebCoreTestSupport. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * Modules/gamepad/Gamepad.cpp: (WebCore::Gamepad::Gamepad): * bindings/generic/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::reset): Deleted. Gamepads should either always be enabled during tests (As in Mac WK2), or never enabled (As in all other platforms). * bindings/generic/RuntimeEnabledFeatures.h: * platform/gamepad/GamepadProvider.h: (WebCore::GamepadProvider::isMockGamepadProvider): * testing/MockGamepad.cpp: Copied from Source/WebKit2/Shared/Gamepad/GamepadData.cpp. (WebCore::MockGamepad::MockGamepad): (WebCore::MockGamepad::updateDetails): (WebCore::MockGamepad::setAxisValue): (WebCore::MockGamepad::setButtonValue): * testing/MockGamepad.h: Copied from Source/WebKit2/UIProcess/Gamepad/UIGamepad.h. * testing/MockGamepadProvider.cpp: Added. (WebCore::MockGamepadProvider::singleton): (WebCore::MockGamepadProvider::MockGamepadProvider): (WebCore::MockGamepadProvider::startMonitoringGamepads): (WebCore::MockGamepadProvider::stopMonitoringGamepads): (WebCore::MockGamepadProvider::setMockGamepadDetails): (WebCore::MockGamepadProvider::connectMockGamepad): (WebCore::MockGamepadProvider::disconnectMockGamepad): (WebCore::MockGamepadProvider::setMockGamepadAxisValue): (WebCore::MockGamepadProvider::setMockGamepadButtonValue): (WebCore::MockGamepadProvider::gamepadInputActivity): * testing/MockGamepadProvider.h: Copied from Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h. (WebCore::MockGamepadProvider::~MockGamepadProvider): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::installMockGamepadProvider): (WebCoreTestSupport::connectMockGamepad): (WebCoreTestSupport::disconnectMockGamepad): (WebCoreTestSupport::setMockGamepadDetails): (WebCoreTestSupport::setMockGamepadAxisValue): (WebCoreTestSupport::setMockGamepadButtonValue): * testing/js/WebCoreTestSupport.h: Source/WebKit2: Reviewed by Alex Christensen. - Teach the UIGamepadProvider to use the default shared provider. - Especially if its the MockGamepadProvider, don't overwrite it. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::encode): (WebKit::GamepadData::decode): (WebKit::GamepadData::loggingString): (WebKit::GamepadData::isNull): Deleted. * Shared/Gamepad/GamepadData.h: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::isNull): (WebKit::GamepadData::index): (WebKit::GamepadData::axisValues): (WebKit::GamepadData::buttonValues): * UIProcess/Gamepad/UIGamepad.h: * UIProcess/Gamepad/UIGamepadProvider.cpp: (WebKit::UIGamepadProvider::UIGamepadProvider): (WebKit::UIGamepadProvider::~UIGamepadProvider): (WebKit::UIGamepadProvider::platformGamepadInputActivity): (WebKit::UIGamepadProvider::startMonitoringGamepads): (WebKit::UIGamepadProvider::stopMonitoringGamepads): (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): * UIProcess/Gamepad/UIGamepadProvider.h: * UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp: (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): (WebKit::UIGamepadProvider::platformStopMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformStopMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformGamepads): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/Gamepad/WebGamepad.cpp: (WebKit::WebGamepad::WebGamepad): (WebKit::WebGamepad::updateValues): * WebProcess/Gamepad/WebGamepad.h: * WebProcess/Gamepad/WebGamepadProvider.cpp: (WebKit::WebGamepadProvider::gamepadConnected): * WebProcess/Gamepad/WebGamepadProvider.h: * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.h: Tools: Reviewed by Alex Christensen. Have the injected bundle expose the MockGamepadProvider to the UI process, which will then feed back into the UIGamepadProvider. Also, fool NSApplication into treating the most recently created "isKeyWindow" of the test windows as the actual keyWindow for the test runner, which will allow the view to get gamepad updates. * WebKitTestRunner/Configurations/WebKitTestRunner.xcconfig: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setMockGamepadDetails): (WTR::TestRunner::setMockGamepadAxisValue): (WTR::TestRunner::setMockGamepadButtonValue): * WebKitTestRunner/PlatformWebView.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): Deleted. * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: * WebKitTestRunner/ios/PlatformWebViewIOS.mm: (-[WebKitTestRunnerWindow initWithFrame:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/ios/TestControllerIOS.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/PlatformWebViewMac.mm: (+[WebKitTestRunnerWindow _WTR_keyWindow]): (-[WebKitTestRunnerWindow initWithContentRect:styleMask:backing:defer:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/mac/TestControllerMac.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/main.mm: LayoutTests: Reviewed by Alex Christensen. * gamepad/gamepad-api-expected.txt: * gamepad/gamepad-api.html: * gamepad/gamepad-out-of-range-crasher-expected.txt: Removed. * gamepad/gamepad-out-of-range-crasher.html: Removed. * gamepad/gamepad-polling-access-expected.txt: * gamepad/gamepad-polling-access.html: * platform/mac/TestExpectations: * platform/mac-wk1/TestExpectations: * platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt: Added. Canonical link: https://commits.webkit.org/179243@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-23 19:41:00 +00:00
testRunner.setMockGamepadButtonValue(10, i, 1.0);
testRunner.connectMockGamepad(10);
yield;
finishTest();
}
function runTest()
{
testGenerator = testSteps();
testGenerator.next();
}
Adding gamepad support https://bugs.webkit.org/show_bug.cgi?id=69451 Source/WebCore: Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. Plumb gamepad data access through platform. Test: gamepad/gamepad-polling-access.html * WebCore.gypi: * page/Navigator.cpp: (WebCore::Navigator::webkitGamepads): * page/Navigator.h: * platform/Gamepads.h: Added. * platform/chromium/GamepadsChromium.cpp: Added. (WebCore::sampleGamepads): * platform/chromium/PlatformSupport.h: Source/WebKit/chromium: Add implementation of sampleGamepads in Chromium platform. Retrieves gamepad data from Chromium port and converts to DOM format, i.e. GamepadList. Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. * src/PlatformSupport.cpp: (WebCore::PlatformSupport::sampleGamepads): Tools: Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. Add a 'gamepadController' to Chromium DRT. Allows for setting of mock gamepad data that will be retrieved when JS code pulls via API access. * DumpRenderTree/DumpRenderTree.gypi: * DumpRenderTree/chromium/GamepadController.cpp: Added. (GamepadController::GamepadController): (GamepadController::bindToJavascript): (GamepadController::reset): (GamepadController::connect): (GamepadController::disconnect): (GamepadController::setId): (GamepadController::setButtonCount): (GamepadController::setButtonData): (GamepadController::setAxisCount): (GamepadController::setAxisData): (GamepadController::fallbackCallback): * DumpRenderTree/chromium/GamepadController.h: Added. * DumpRenderTree/chromium/TestShell.cpp: (TestShell::TestShell): (TestShell::resetTestController): (TestShell::bindJSObjectsToWindow): * DumpRenderTree/chromium/TestShell.h: (TestShell::gamepadController): LayoutTests: Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. * fast/dom/script-tests/prototype-inheritance.js: Exclude gamepadController from enumeration. * gamepad/gamepad-polling-access-expected.txt: Added. * gamepad/gamepad-polling-access.html: Added. Canonical link: https://commits.webkit.org/89548@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@101065 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-11-23 12:16:13 +00:00
</script>
WK2 Gamepad layout test support. https://bugs.webkit.org/show_bug.cgi?id=134671 Source/WebCore: Reviewed by Alex Christensen. No new tests (Covered by changes to existing tests). Add a MockGamepadProvider and expose it in WebCoreTestSupport. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * Modules/gamepad/Gamepad.cpp: (WebCore::Gamepad::Gamepad): * bindings/generic/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::reset): Deleted. Gamepads should either always be enabled during tests (As in Mac WK2), or never enabled (As in all other platforms). * bindings/generic/RuntimeEnabledFeatures.h: * platform/gamepad/GamepadProvider.h: (WebCore::GamepadProvider::isMockGamepadProvider): * testing/MockGamepad.cpp: Copied from Source/WebKit2/Shared/Gamepad/GamepadData.cpp. (WebCore::MockGamepad::MockGamepad): (WebCore::MockGamepad::updateDetails): (WebCore::MockGamepad::setAxisValue): (WebCore::MockGamepad::setButtonValue): * testing/MockGamepad.h: Copied from Source/WebKit2/UIProcess/Gamepad/UIGamepad.h. * testing/MockGamepadProvider.cpp: Added. (WebCore::MockGamepadProvider::singleton): (WebCore::MockGamepadProvider::MockGamepadProvider): (WebCore::MockGamepadProvider::startMonitoringGamepads): (WebCore::MockGamepadProvider::stopMonitoringGamepads): (WebCore::MockGamepadProvider::setMockGamepadDetails): (WebCore::MockGamepadProvider::connectMockGamepad): (WebCore::MockGamepadProvider::disconnectMockGamepad): (WebCore::MockGamepadProvider::setMockGamepadAxisValue): (WebCore::MockGamepadProvider::setMockGamepadButtonValue): (WebCore::MockGamepadProvider::gamepadInputActivity): * testing/MockGamepadProvider.h: Copied from Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h. (WebCore::MockGamepadProvider::~MockGamepadProvider): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::installMockGamepadProvider): (WebCoreTestSupport::connectMockGamepad): (WebCoreTestSupport::disconnectMockGamepad): (WebCoreTestSupport::setMockGamepadDetails): (WebCoreTestSupport::setMockGamepadAxisValue): (WebCoreTestSupport::setMockGamepadButtonValue): * testing/js/WebCoreTestSupport.h: Source/WebKit2: Reviewed by Alex Christensen. - Teach the UIGamepadProvider to use the default shared provider. - Especially if its the MockGamepadProvider, don't overwrite it. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::encode): (WebKit::GamepadData::decode): (WebKit::GamepadData::loggingString): (WebKit::GamepadData::isNull): Deleted. * Shared/Gamepad/GamepadData.h: (WebKit::GamepadData::GamepadData): (WebKit::GamepadData::isNull): (WebKit::GamepadData::index): (WebKit::GamepadData::axisValues): (WebKit::GamepadData::buttonValues): * UIProcess/Gamepad/UIGamepad.h: * UIProcess/Gamepad/UIGamepadProvider.cpp: (WebKit::UIGamepadProvider::UIGamepadProvider): (WebKit::UIGamepadProvider::~UIGamepadProvider): (WebKit::UIGamepadProvider::platformGamepadInputActivity): (WebKit::UIGamepadProvider::startMonitoringGamepads): (WebKit::UIGamepadProvider::stopMonitoringGamepads): (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): * UIProcess/Gamepad/UIGamepadProvider.h: * UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp: (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): (WebKit::UIGamepadProvider::platformStopMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformStopMonitoringGamepads): Deleted. (WebKit::UIGamepadProvider::platformGamepads): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/Gamepad/WebGamepad.cpp: (WebKit::WebGamepad::WebGamepad): (WebKit::WebGamepad::updateValues): * WebProcess/Gamepad/WebGamepad.h: * WebProcess/Gamepad/WebGamepadProvider.cpp: (WebKit::WebGamepadProvider::gamepadConnected): * WebProcess/Gamepad/WebGamepadProvider.h: * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.h: Tools: Reviewed by Alex Christensen. Have the injected bundle expose the MockGamepadProvider to the UI process, which will then feed back into the UIGamepadProvider. Also, fool NSApplication into treating the most recently created "isKeyWindow" of the test windows as the actual keyWindow for the test runner, which will allow the view to get gamepad updates. * WebKitTestRunner/Configurations/WebKitTestRunner.xcconfig: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setMockGamepadDetails): (WTR::TestRunner::setMockGamepadAxisValue): (WTR::TestRunner::setMockGamepadButtonValue): * WebKitTestRunner/PlatformWebView.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): Deleted. * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: * WebKitTestRunner/ios/PlatformWebViewIOS.mm: (-[WebKitTestRunnerWindow initWithFrame:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/ios/TestControllerIOS.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/PlatformWebViewMac.mm: (+[WebKitTestRunnerWindow _WTR_keyWindow]): (-[WebKitTestRunnerWindow initWithContentRect:styleMask:backing:defer:]): (-[WebKitTestRunnerWindow dealloc]): (WTR::PlatformWebView::keyWindow): * WebKitTestRunner/mac/TestControllerMac.mm: (WTR::wtr_NSApplication_keyWindow): (WTR::TestController::platformInitialize): * WebKitTestRunner/mac/main.mm: LayoutTests: Reviewed by Alex Christensen. * gamepad/gamepad-api-expected.txt: * gamepad/gamepad-api.html: * gamepad/gamepad-out-of-range-crasher-expected.txt: Removed. * gamepad/gamepad-out-of-range-crasher.html: Removed. * gamepad/gamepad-polling-access-expected.txt: * gamepad/gamepad-polling-access.html: * platform/mac/TestExpectations: * platform/mac-wk1/TestExpectations: * platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt: Added. Canonical link: https://commits.webkit.org/179243@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-23 19:41:00 +00:00
</head>
<body onload="runTest();">
<div id="logger"></div>
Adding gamepad support https://bugs.webkit.org/show_bug.cgi?id=69451 Source/WebCore: Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. Plumb gamepad data access through platform. Test: gamepad/gamepad-polling-access.html * WebCore.gypi: * page/Navigator.cpp: (WebCore::Navigator::webkitGamepads): * page/Navigator.h: * platform/Gamepads.h: Added. * platform/chromium/GamepadsChromium.cpp: Added. (WebCore::sampleGamepads): * platform/chromium/PlatformSupport.h: Source/WebKit/chromium: Add implementation of sampleGamepads in Chromium platform. Retrieves gamepad data from Chromium port and converts to DOM format, i.e. GamepadList. Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. * src/PlatformSupport.cpp: (WebCore::PlatformSupport::sampleGamepads): Tools: Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. Add a 'gamepadController' to Chromium DRT. Allows for setting of mock gamepad data that will be retrieved when JS code pulls via API access. * DumpRenderTree/DumpRenderTree.gypi: * DumpRenderTree/chromium/GamepadController.cpp: Added. (GamepadController::GamepadController): (GamepadController::bindToJavascript): (GamepadController::reset): (GamepadController::connect): (GamepadController::disconnect): (GamepadController::setId): (GamepadController::setButtonCount): (GamepadController::setButtonData): (GamepadController::setAxisCount): (GamepadController::setAxisData): (GamepadController::fallbackCallback): * DumpRenderTree/chromium/GamepadController.h: Added. * DumpRenderTree/chromium/TestShell.cpp: (TestShell::TestShell): (TestShell::resetTestController): (TestShell::bindJSObjectsToWindow): * DumpRenderTree/chromium/TestShell.h: (TestShell::gamepadController): LayoutTests: Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23 Reviewed by Darin Fisher. * fast/dom/script-tests/prototype-inheritance.js: Exclude gamepadController from enumeration. * gamepad/gamepad-polling-access-expected.txt: Added. * gamepad/gamepad-polling-access.html: Added. Canonical link: https://commits.webkit.org/89548@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@101065 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-11-23 12:16:13 +00:00
</body>