WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
214188
Add Gamepad tests that exercise the native frameworks
https://bugs.webkit.org/show_bug.cgi?id=214188
Summary
Add Gamepad tests that exercise the native frameworks
Brady Eidson
Reported
2020-07-10 09:01:08 PDT
Add Gamepad tests that exercise the native frameworks We need to directly drive GCF (and probably IOHID) framework functionality to test gamepads.
Attachments
Patch
(37.52 KB, patch)
2020-07-22 14:59 PDT
,
Brady Eidson
no flags
Details
Formatted Diff
Diff
Patch
(37.29 KB, patch)
2020-07-22 15:06 PDT
,
Brady Eidson
no flags
Details
Formatted Diff
Diff
Patch
(37.30 KB, patch)
2020-07-22 15:16 PDT
,
Brady Eidson
no flags
Details
Formatted Diff
Diff
Patch
(36.61 KB, patch)
2020-07-22 15:46 PDT
,
Brady Eidson
no flags
Details
Formatted Diff
Diff
Patch
(36.63 KB, patch)
2020-07-22 15:59 PDT
,
Brady Eidson
no flags
Details
Formatted Diff
Diff
Patch
(39.74 KB, patch)
2020-07-22 18:33 PDT
,
Brady Eidson
no flags
Details
Formatted Diff
Diff
Patch
(39.73 KB, patch)
2020-07-22 18:39 PDT
,
Brady Eidson
no flags
Details
Formatted Diff
Diff
Patch
(41.06 KB, patch)
2020-07-22 20:01 PDT
,
Brady Eidson
thorton
: review+
Details
Formatted Diff
Diff
PFL
(41.59 KB, patch)
2020-07-22 23:31 PDT
,
Brady Eidson
no flags
Details
Formatted Diff
Diff
Show Obsolete
(7)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2020-07-10 09:01:25 PDT
<
rdar://problem/65343674
>
Brady Eidson
Comment 2
2020-07-22 14:59:27 PDT
Created
attachment 404972
[details]
Patch
Brady Eidson
Comment 3
2020-07-22 15:06:09 PDT
Created
attachment 404976
[details]
Patch
Brady Eidson
Comment 4
2020-07-22 15:16:34 PDT
Created
attachment 404979
[details]
Patch
Brady Eidson
Comment 5
2020-07-22 15:46:38 PDT
Created
attachment 404987
[details]
Patch
Brady Eidson
Comment 6
2020-07-22 15:59:44 PDT
Created
attachment 404991
[details]
Patch
Tim Horton
Comment 7
2020-07-22 16:26:21 PDT
Comment on
attachment 404991
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=404991&action=review
> Source/WebKit/UIProcess/Gamepad/UIGamepadProvider.h:60 > + size_t numberOfConnectedGamepads() { return m_gamepads.size(); }
`const`
> Tools/TestWebKitAPI/mac/VirtualGamepad.mm:29 > +#if PLATFORM(MAC) && USE(APPLE_INTERNAL_SDK)
internal-SDK-only tests are quite unusual. is there any reason a combination of SPI headers + stuff is insufficient?
Brady Eidson
Comment 8
2020-07-22 18:33:50 PDT
Created
attachment 405007
[details]
Patch
Brady Eidson
Comment 9
2020-07-22 18:39:38 PDT
Created
attachment 405008
[details]
Patch
Brady Eidson
Comment 10
2020-07-22 20:01:34 PDT
Created
attachment 405012
[details]
Patch
Brady Eidson
Comment 11
2020-07-22 20:02:38 PDT
(In reply to Tim Horton from
comment #7
)
> Comment on
attachment 404991
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=404991&action=review
> > > Source/WebKit/UIProcess/Gamepad/UIGamepadProvider.h:60 > > + size_t numberOfConnectedGamepads() { return m_gamepads.size(); } > > `const` > > > Tools/TestWebKitAPI/mac/VirtualGamepad.mm:29 > > +#if PLATFORM(MAC) && USE(APPLE_INTERNAL_SDK) > > internal-SDK-only tests are quite unusual. is there any reason a combination > of SPI headers + stuff is insufficient?
ChangeLog covers it - Need an entitlement we can currently only sign in internal builds.
Tim Horton
Comment 12
2020-07-22 22:54:52 PDT
Comment on
attachment 405012
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=405012&action=review
> Tools/TestWebKitAPI/Tests/mac/HIDGamepads.mm:98 > + [[webView window] resignKeyWindow]; > + [[webView window] makeKeyWindow];
This could use a comment (also I think it's technically working around a bug? but I'm not sure what component the bug is in?)
> Tools/TestWebKitAPI/mac/VirtualGamepad.h:35 > +@class NSString; > +@class HIDDevice; > +@class HIDUserDevice;
Sort it! Also, any chance of this header ending up in C++ code? Maybe OBJC_CLASS? (the rest of it seems C++-clean at a glance).
> Tools/TestWebKitAPI/mac/VirtualGamepad.mm:45 > +const uint8_t NimbusDescriptor[] = {
This all hurts a bit. Are there not constants for this? Also, I think everything inside the {} should be indented.
> Tools/TestWebKitAPI/mac/VirtualGamepad.mm:130 > + m_dispatchQueue = adoptNS(dispatch_queue_create(0, DISPATCH_QUEUE_SERIAL));
I think this should be OSObjectPtr/adoptOSObject? But not 100%, and it may not matter.
> Tools/TestWebKitAPI/mac/VirtualGamepad.mm:133 > + auto uuid = adoptNS([[NSUUID alloc] init]); > + m_uniqueID = [uuid UUIDString];
I think NSUUID.UUID.UUIDString instead of these two
Brady Eidson
Comment 13
2020-07-22 23:20:16 PDT
(In reply to Tim Horton from
comment #12
)
> Comment on
attachment 405012
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=405012&action=review
> > > Tools/TestWebKitAPI/Tests/mac/HIDGamepads.mm:98 > > + [[webView window] resignKeyWindow]; > > + [[webView window] makeKeyWindow]; > > This could use a comment (also I think it's technically working around a > bug? but I'm not sure what component the bug is in?)
It's not a bug, but rather a really intentional quirky behavior... comment added.
> > Tools/TestWebKitAPI/mac/VirtualGamepad.h:35 > > +@class NSString; > > +@class HIDDevice; > > +@class HIDUserDevice; > > Sort it! Also, any chance of this header ending up in C++ code? Maybe > OBJC_CLASS? (the rest of it seems C++-clean at a glance).
It probably won't ever be in non-objc code, but I changed it anyways.
> > Tools/TestWebKitAPI/mac/VirtualGamepad.mm:45 > > +const uint8_t NimbusDescriptor[] = { > > This all hurts a bit. Are there not constants for this? Also, I think > everything inside the {} should be indented.
This (and future descriptors that I'll be adding for testing) are actual raw dumps from devices. Normally you literally just see an unformatted string of hex digits. This formatting is how HID descriptors are generally denoted as a term of art - In the USB HID spec and whatever tooling you might find to help work with them. I'll actually add a link to the web-based tool I used to turn the raw descriptor into this "human readable" formatting" As for the bytes themselves, there certainly are not constants for them. Some are "common and constant" but many are actually bitfield options put together. Think of the bytes as the machine code, and the "human readable" descriptions as the assembly code.
> > Tools/TestWebKitAPI/mac/VirtualGamepad.mm:130 > > + m_dispatchQueue = adoptNS(dispatch_queue_create(0, DISPATCH_QUEUE_SERIAL)); > > I think this should be OSObjectPtr/adoptOSObject? But not 100%, and it may > not matter.
Never (that I remember) used those, will take a look!
> > Tools/TestWebKitAPI/mac/VirtualGamepad.mm:133 > > + auto uuid = adoptNS([[NSUUID alloc] init]); > > + m_uniqueID = [uuid UUIDString]; > > I think NSUUID.UUID.UUIDString instead of these two
Indeed.
Brady Eidson
Comment 14
2020-07-22 23:31:44 PDT
Created
attachment 405018
[details]
PFL
Darin Adler
Comment 15
2020-07-23 09:01:57 PDT
Comment on
attachment 405012
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=405012&action=review
>>> Tools/TestWebKitAPI/mac/VirtualGamepad.mm:130 >>> + m_dispatchQueue = adoptNS(dispatch_queue_create(0, DISPATCH_QUEUE_SERIAL)); >> >> I think this should be OSObjectPtr/adoptOSObject? But not 100%, and it may not matter. > > Never (that I remember) used those, will take a look!
I wonder if we can make this subtle mistake a compile-time error.
EWS
Comment 16
2020-07-23 09:36:19 PDT
Committed
r264769
: <
https://trac.webkit.org/changeset/264769
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 405018
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug