summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/compute-pressure/compute_pressure_multiple.tentative.https.window.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/compute-pressure/compute_pressure_multiple.tentative.https.window.js')
-rw-r--r--testing/web-platform/tests/compute-pressure/compute_pressure_multiple.tentative.https.window.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/testing/web-platform/tests/compute-pressure/compute_pressure_multiple.tentative.https.window.js b/testing/web-platform/tests/compute-pressure/compute_pressure_multiple.tentative.https.window.js
new file mode 100644
index 0000000000..6015ae1f81
--- /dev/null
+++ b/testing/web-platform/tests/compute-pressure/compute_pressure_multiple.tentative.https.window.js
@@ -0,0 +1,30 @@
+'use strict';
+
+promise_test(async t => {
+ const changes1_promise = new Promise((resolve, reject) => {
+ const observer = new PressureObserver(resolve, {sampleRate: 1.0});
+ t.add_cleanup(() => observer.disconnect());
+ observer.observe('cpu').catch(reject);
+ });
+
+ const changes2_promise = new Promise((resolve, reject) => {
+ const observer = new PressureObserver(resolve, {sampleRate: 1.0});
+ t.add_cleanup(() => observer.disconnect());
+ observer.observe('cpu').catch(reject);
+ });
+
+ const changes3_promise = new Promise((resolve, reject) => {
+ const observer = new PressureObserver(resolve, {sampleRate: 1.0});
+ t.add_cleanup(() => observer.disconnect());
+ observer.observe('cpu').catch(reject);
+ });
+
+ const [changes1, changes2, changes3] =
+ await Promise.all([changes1_promise, changes2_promise, changes3_promise]);
+
+ for (const changes of [changes1, changes2, changes3]) {
+ assert_in_array(
+ changes[0].state, ['nominal', 'fair', 'serious', 'critical'],
+ 'cpu pressure state');
+ }
+}, 'Three PressureObserver instances receive changes');