[WPT] [CSP] Fix flakiness of CSPEE tests
This CL rewrites part of the core logic of the tests inside
external/wpt/content-security-policy/embedded-enforcement/ to make
them more resilient and less flaky.
One likely reason of flakiness before was that the tests where waiting
for several async conditions to be checked before succeeding, but they
were depending on the non-deterministic order of some of those
conditions. This CL fixes that by using one promise per each condition
and waiting for all promises to resolve.
Another problem with the tests is that they were checking for a loaded
iframe to be cross-origin by asserting a SecurityError exception when
accessing the iframe after exactly 500ms. That is now replaced with a
t.step_wait_func which retries for 5s every 500ms.
Bug: 40250883
Change-Id: I36d0bb3fabd4b0612fc70047cb995292131fb7a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5637037
Commit-Queue: Antonio Sartori antoniosartori@chromium.org
Reviewed-by: Arthur Sonzogni arthursonzogni@chromium.org
Cr-Commit-Position: refs/heads/main@{#1317885}