[pus] add first wpt_test and test utility #55700
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since prerender-until-script pages cannot execute scripts, the existing
test utilities cannot help test this case. More specifically,
prerender-until-script pages cannot tell the initiator pages that they
are ready for activation.
This CL introduces a server-side handler (pus-handler.py) to coordinate
the test.
Workflows:
The initiator page (pus-initiator-page-template.html)
triggers the prerender and simultaneously fetches a signal_url. This
fetch is designed to hang on the server.
The prerendered page (pus-page-template.html) is allowed to fetch an
async script (which also hits the signal_url, but with
isprerendering=True).
When the server receives the request from the prerendered page, it
puts a token in its stash, which in turn unblocks the initiator's
hanging fetch.
The .then() block of the initiator's fetch then runs, navigating to
the prerendered page and causing activation.
The (previously blocked) inline script on the prerendered page then
executes, verifying that document.prerendering is false and sending the
result back to the main test page.
Bug: 428500219
Change-Id: I5e1098a6adbf7abfd02f692eb32e93c9093fd501
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7082540
Reviewed-by: Hiroki Nakagawa <[email protected]>
Commit-Queue: Lingqi Chi <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1536464}