compute pressure: Convert remaining web tests to test_driver
The purpose of this change is start using WebDriver and remove mock
code. WebDriver commands for Compute Pressure are defined in
https://www.w3.org/TR/compute-pressure/#automation
In general, this involves renaming *.any.js
tests to *.window.js
ones to continue being able to test windows and dedicated workers from
the same file (see README.md for a longer explanation of how this works
around test_driver limitations) as well as replacing the mock
PressureService calls with test_driver ones.
While here, a few other changes had to be made:
- compute_pressure_basic.https.window.js: Stop passing async functions
to Promise constructors. async functions do not make much sense in
this context, and we can just call reject() when some function calls
fail and avoid having to explicitly wait for them because by the time
we reach the PressureObserver callbacks they will by definition have
finished running. - compute_pressure_rate_obfuscation_mitigation_not_triggered.https.window.js:
The promise wrapping the majority of the test has been removed because
it is not necessary. - compute_pressure_rate_obfuscation_mitigation_triggered.https.window.js:
The wrapping promise has been removed for the same reason. The wait
the code was structured also made the entire test exit early when
resolve() was called, and we never got to test the loop conditions and
the final assertion in this case. Now that we do, fix the checks in
the loop (we need an AND, not an OR) and adjust the description of the
final assert_true() call.
Co-authored with juha.j.vainio@intel.com
Bug: 347031400
Change-Id: I289292bd4d35f7f26d4531252e64c0aba571124e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5898734
Reviewed-by: Reilly Grant reillyg@chromium.org
Commit-Queue: Raphael Kubo Da Costa raphael.kubo.da.costa@intel.com
Auto-Submit: Raphael Kubo Da Costa raphael.kubo.da.costa@intel.com
Cr-Commit-Position: refs/heads/main@{#1362281}