Skip to content

Add some tests related to GPUDevice extending EventTarget #4389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2025

Conversation

greggman
Copy link
Contributor

@greggman greggman commented May 15, 2025

  • Test you can pass Event and CustomEvent through GPUDevice.
  • Test if you override a method on EventTarget it's called when you call the corresponding method on GPUDevice.
  • Test if you can pass GPUUncapturedErrorEvent through an EventTarget that is not GPUDevice

These pass on Chrome, Firefox, and Safari. dawn.node fails these tests though I have a patch that makes it work.

Note: I made Fixture.expect take a function. If function was passed and no msg was provided then it uses the source of the function as the string. This makes it nice for small tests to see what passed/failed. Without this all you get is OK/FAIL and you need to provide a message.

Example:

Screenshot 2025-05-15 at 16 07 56

wdyt?

@greggman greggman requested a review from kainino0x May 15, 2025 08:28
Copy link
Collaborator

@kainino0x kainino0x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I made Fixture.expect take a function. If function was passed and no msg was provided then it uses the source of the function as the string. This makes it nice for small tests to see what passed/failed. Without this all you get is OK/FAIL and you need to provide a message.

doh, that's a good idea! when I was originally bringing up the CTS I really wanted something that would show nicer results for asserts (like https://github.com/power-assert-js/power-assert but that was too hard to integrate). Never thought of this for some reason.

lgtm!

* Test you can pass Event and CustomEvent through GPUDevice.
* Test if you override a method on EventTarget it's called
  when you call the corresponding method on GPUDevice.
* Test if you can pass GPUUncapturedErrorEvent through an
  EventTarget that is not GPUDevice

Note: dawn.node fails these tests. It's not clear if NAPI makes
this possible at all :(
@greggman greggman merged commit 905c7cb into gpuweb:main May 20, 2025
1 check passed
@greggman greggman deleted the dispatchEvent branch May 20, 2025 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants