haikuwebkit/WebKitLibraries/WebKitPrivateFrameworkStubs/Mac
Brady Eidson 25429e2ff7 Add Gamepad tests that exercise the native frameworks
<rdar://problem/65343674> and https://bugs.webkit.org/show_bug.cgi?id=214188

Reviewed by Tim Horton.

Source/WebCore:

* platform/gamepad/mac/MultiGamepadProvider.h:
(WebCore::MultiGamepadProvider::setUsesOnlyHIDGamepadProvider):
* platform/gamepad/mac/MultiGamepadProvider.mm:
(WebCore::MultiGamepadProvider::startMonitoringGamepads):
(WebCore::MultiGamepadProvider::stopMonitoringGamepads):

Source/WebKit:

Add some testing-only SPI for TestWebKitAPI.

* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _numberOfConnectedGamepadsForTesting]):
(-[WKProcessPool _setUsesOnlyHIDGamepadProviderForTesting:]):
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:

* UIProcess/Gamepad/UIGamepadProvider.h:
(WebKit::UIGamepadProvider::numberOfConnectedGamepads const):

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::numberOfConnectedGamepadsForTesting):
(WebKit::WebProcessPool::setUsesOnlyHIDGamepadProviderForTesting):
* UIProcess/WebProcessPool.h:

Source/WTF:

* wtf/PlatformHave.h:

Tools:

For Internal builds, we can create HID devices that exercise the native gamepad providers.
E.g. Actually exercise the IOHID gamepad provider codepath.

Give the Internal TestWebKitAPI build some entitlements:
* TestWebKitAPI/Configurations/TestWebKitAPI-macOS-internal.entitlements: Added.
* TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:

Add a very basic test that connects a device, presses a button, and verifies the web page sees it:
* TestWebKitAPI/Tests/mac/HIDGamepads.mm: Added.
(-[GamepadMessageHandler userContentController:didReceiveScriptMessage:]):
(TestWebKitAPI::handleGamepadConnect):

Add the beginnings of a VirtualGamepad device that reads in a HID descriptor (just like real gamepads):
* TestWebKitAPI/mac/VirtualGamepad.h: Added.
* TestWebKitAPI/mac/VirtualGamepad.mm: Added.
(TestWebKitAPI::VirtualGamepad::makeVirtualNimbus):
(TestWebKitAPI::VirtualGamepad::VirtualGamepad):
(TestWebKitAPI::VirtualGamepad::~VirtualGamepad):
(TestWebKitAPI::VirtualGamepad::setButtonValue):
(TestWebKitAPI::VirtualGamepad::setAxisValue):
(TestWebKitAPI::VirtualGamepad::publishReport):

WebKitLibraries:

* WebKitPrivateFrameworkStubs/Mac/101500/HID.framework/HID.tbd: Added.
* WebKitPrivateFrameworkStubs/Mac/101600/HID.framework/HID.tbd: Added.
* WebKitPrivateFrameworkStubs/Mac/110000/HID.framework/HID.tbd: Added.


Canonical link: https://commits.webkit.org/227505@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@264769 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-07-23 16:36:15 +00:00
..
101500 Add Gamepad tests that exercise the native frameworks 2020-07-23 16:36:15 +00:00
101600 Add Gamepad tests that exercise the native frameworks 2020-07-23 16:36:15 +00:00
110000 Add Gamepad tests that exercise the native frameworks 2020-07-23 16:36:15 +00:00