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
Tests for structuredClone #9218
Conversation
I’m not sure to what extend I need to test the functionality of What’s the procedure here? |
Build PASSEDStarted: 2018-03-21 15:18:58 Failing Jobs
View more information about this build on: |
Ideally we find existing |
Note to self: Look at tests below and create set of tests that can be imported into other API tests
Corner-cases:
|
I’m back from vacation and continuing now to work on this. The plan in the most recent commit is to create a battery of tests for the structured clone algorithm that can be reused by all APIs that use the algorithm. Before I start porting a large number of tests and including this setup everywhere, I wanted to get a review if I am doing something stupid or re-inventing the wheel. PTAL :) |
You want to remove the I wonder a bit what all the infrastructure is needed for, but I'm guessing you have a plan of sorts. @jeremyroman @bakulf @wanderview might have some thoughts on a good framework here as well. |
}; | ||
runner = Object.assign({}, defaultRunner, runner); | ||
|
||
await runner.setup(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this setup
function completes asynchronously, it is not guaranteed to happen before the page finishes loading. If promise_test
doesn't run by then, I don't think the test will run correctly. (Not super experienced with WPT; let me know if there's some sneaky way this is safe.)
Instead, you could have each promise_test
await the setup promise. (Redundantly awaiting the setup doesn't seem problematic.)
I'd suggest structuredCloneBatteryOfTests
being a non-async function to reduce the risk of unexpectedly awaiting before test registration in general. The only interesting waiting that happens here seems to be between waiting for all tests to finish and tearing down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL!
I like your suggestion, will implement it that way.
}, test.description); | ||
}).catch(_ => {}); | ||
}); | ||
await Promise.all(allTests); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this appears to be the only interesting awaiting here, we could make the outer function non-async and just do:
Promise.all(allTests).then(() => runner.teardown());
@annevk I might very well be over-engineering. But considering I have to accommodate for workers to be set up and would like this setup to be future proof as well, it seems like a decent middle ground. Definitely open to other suggestions. |
Yes, that will be added once I get there 😄 Wanna ensure this rig is acceptable to y’all first. |
I pulled in all structured clone-specific bits of @zcorpan’s worker test-suite and made it reusable. I still need to write tests for the transferable bit, tho. |
293ac7c
to
7f943ba
Compare
@surma the original tests do assertions in the worker and then pass the object back and do assertions again. I think this skips the middle part, right? Is that what we want? It seems your |
Maybe it can help to share what we have in gecko. For gecko tests (mochitests) I wrote this test: Here the idea is to have separate tests for the different 'contexts' (for instance BroadcastChannel, window-to-window, workers, etc) but with a common core where clonable an transferable objects are tested. |
Thanks @bakulf. I think that's the case with @surma's setup as well, right? @surma can you remove the I see that you fixed |
Can do.
What exactly do you mean?
My plan was to add a separate “battery of tests” that involve transferables. Should we punt on that for a separate PR as well? (Also I’m currently busy with Google I/O, so won’t be able to actually do anything until after next week) |
I mean removing workers/semantics/structured-clone/dedicated.html and workers/semantics/structured-clone/shared.html and their dependencies that are no longer used by your test. I'm not in a rush, but would be nice to land something that fixes the old tests as they're currently disabled. |
@surma friendly ping :) |
Sorry for the delay. Now back from I/O, planning on working on this tomorrow :) |
There’s only 2 very minimal tests for transferables, but I‘d prefer to finally land this and augment it in a separate PR (potentially with the help of others). |
Thanks! |
Can you squash and rewrite the commit message to reflect the current state? |
@zcorpan done |
🎉 |
https://bugs.webkit.org/show_bug.cgi?id=185773 Reviewed by Youenn Fablet. LayoutTests/imported/w3c: Re-sync workers/semantics/structured-clone WPT tests after: web-platform-tests/wpt#9218 * web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests-harness.js: Added. (runStructuredCloneBatteryOfTests): * web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests-with-transferables.js: Added. (structuredCloneBatteryOfTests.push.async.f): * web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests.js: Renamed from LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/common.js. (async.compare_Blob): (get_canvas_1x1_transparent_black): (get_canvas_1x1_non_transparent_non_black): (compare_ImageBitmap): (structuredCloneBatteryOfTests.push.async.f): * web-platform-tests/html/webappapis/structured-clone/w3c-import.log: Copied from LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/w3c-import.log. * web-platform-tests/workers/semantics/structured-clone/dedicated-expected.txt: * web-platform-tests/workers/semantics/structured-clone/dedicated.html: * web-platform-tests/workers/semantics/structured-clone/dedicated.js: Removed. * web-platform-tests/workers/semantics/structured-clone/shared-expected.txt: * web-platform-tests/workers/semantics/structured-clone/shared.html: * web-platform-tests/workers/semantics/structured-clone/shared.js: Removed. * web-platform-tests/workers/semantics/structured-clone/w3c-import.log: * web-platform-tests/workers/semantics/structured-clone/worker-common.js: Removed. Source/WebCore: Update our implementation for the stuctured serialization of a File to include its lastModified attribute, as per: - https://w3c.github.io/FileAPI/#file-section No new tests, rebaselined existing test. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::write): (WebCore::CloneDeserializer::readFile): * fileapi/File.cpp: (WebCore::File::File): * fileapi/File.h: LayoutTests: Unskip structured serialization tests that no longer fail / time out. * TestExpectations: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@232030 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=185773 Reviewed by Youenn Fablet. LayoutTests/imported/w3c: Re-sync workers/semantics/structured-clone WPT tests after: web-platform-tests/wpt#9218 * web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests-harness.js: Added. (runStructuredCloneBatteryOfTests): * web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests-with-transferables.js: Added. (structuredCloneBatteryOfTests.push.async.f): * web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests.js: Renamed from LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/common.js. (async.compare_Blob): (get_canvas_1x1_transparent_black): (get_canvas_1x1_non_transparent_non_black): (compare_ImageBitmap): (structuredCloneBatteryOfTests.push.async.f): * web-platform-tests/html/webappapis/structured-clone/w3c-import.log: Copied from LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/w3c-import.log. * web-platform-tests/workers/semantics/structured-clone/dedicated-expected.txt: * web-platform-tests/workers/semantics/structured-clone/dedicated.html: * web-platform-tests/workers/semantics/structured-clone/dedicated.js: Removed. * web-platform-tests/workers/semantics/structured-clone/shared-expected.txt: * web-platform-tests/workers/semantics/structured-clone/shared.html: * web-platform-tests/workers/semantics/structured-clone/shared.js: Removed. * web-platform-tests/workers/semantics/structured-clone/w3c-import.log: * web-platform-tests/workers/semantics/structured-clone/worker-common.js: Removed. Source/WebCore: Update our implementation for the stuctured serialization of a File to include its lastModified attribute, as per: - https://w3c.github.io/FileAPI/#file-section No new tests, rebaselined existing test. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::write): (WebCore::CloneDeserializer::readFile): * fileapi/File.cpp: (WebCore::File::File): * fileapi/File.h: LayoutTests: Unskip structured serialization tests that no longer fail / time out. * TestExpectations: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@232043 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=185773 Reviewed by Youenn Fablet. LayoutTests/imported/w3c: Re-sync workers/semantics/structured-clone WPT tests after: web-platform-tests/wpt#9218 * web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests-harness.js: Added. (runStructuredCloneBatteryOfTests): * web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests-with-transferables.js: Added. (structuredCloneBatteryOfTests.push.async.f): * web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests.js: Renamed from LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/common.js. (async.compare_Blob): (get_canvas_1x1_transparent_black): (get_canvas_1x1_non_transparent_non_black): (compare_ImageBitmap): (structuredCloneBatteryOfTests.push.async.f): * web-platform-tests/html/webappapis/structured-clone/w3c-import.log: Copied from LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/w3c-import.log. * web-platform-tests/workers/semantics/structured-clone/dedicated-expected.txt: * web-platform-tests/workers/semantics/structured-clone/dedicated.html: * web-platform-tests/workers/semantics/structured-clone/dedicated.js: Removed. * web-platform-tests/workers/semantics/structured-clone/shared-expected.txt: * web-platform-tests/workers/semantics/structured-clone/shared.html: * web-platform-tests/workers/semantics/structured-clone/shared.js: Removed. * web-platform-tests/workers/semantics/structured-clone/w3c-import.log: * web-platform-tests/workers/semantics/structured-clone/worker-common.js: Removed. Source/WebCore: Update our implementation for the stuctured serialization of a File to include its lastModified attribute, as per: - https://w3c.github.io/FileAPI/#file-section No new tests, rebaselined existing test. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::write): (WebCore::CloneDeserializer::readFile): * fileapi/File.cpp: (WebCore::File::File): * fileapi/File.h: LayoutTests: Unskip structured serialization tests that no longer fail / time out. * TestExpectations: Canonical link: https://commits.webkit.org/201289@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232030 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=185773 Reviewed by Youenn Fablet. LayoutTests/imported/w3c: Re-sync workers/semantics/structured-clone WPT tests after: web-platform-tests/wpt#9218 * web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests-harness.js: Added. (runStructuredCloneBatteryOfTests): * web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests-with-transferables.js: Added. (structuredCloneBatteryOfTests.push.async.f): * web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests.js: Renamed from LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/common.js. (async.compare_Blob): (get_canvas_1x1_transparent_black): (get_canvas_1x1_non_transparent_non_black): (compare_ImageBitmap): (structuredCloneBatteryOfTests.push.async.f): * web-platform-tests/html/webappapis/structured-clone/w3c-import.log: Copied from LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/w3c-import.log. * web-platform-tests/workers/semantics/structured-clone/dedicated-expected.txt: * web-platform-tests/workers/semantics/structured-clone/dedicated.html: * web-platform-tests/workers/semantics/structured-clone/dedicated.js: Removed. * web-platform-tests/workers/semantics/structured-clone/shared-expected.txt: * web-platform-tests/workers/semantics/structured-clone/shared.html: * web-platform-tests/workers/semantics/structured-clone/shared.js: Removed. * web-platform-tests/workers/semantics/structured-clone/w3c-import.log: * web-platform-tests/workers/semantics/structured-clone/worker-common.js: Removed. Source/WebCore: Update our implementation for the stuctured serialization of a File to include its lastModified attribute, as per: - https://w3c.github.io/FileAPI/#file-section No new tests, rebaselined existing test. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::write): (WebCore::CloneDeserializer::readFile): * fileapi/File.cpp: (WebCore::File::File): * fileapi/File.h: LayoutTests: Unskip structured serialization tests that no longer fail / time out. * TestExpectations: Canonical link: https://commits.webkit.org/201299@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232043 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Edit: This PR got side-tracked into refactoring the testing setup for algorithms that use structured clonging. The PR for adding tests for
structuredClone
(whatwg/html#3414) now lives in #11069.This is in connection to whatwg/html#3414.Do not merge. This still requires interest/agreement from other browser vendors.