Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /compute-pressure/observe_return_type.https.any.html - WPT Dashboard Interop Dashboard
- /compute-pressure/observe_return_type.https.any.sharedworker.html - WPT Dashboard Interop Dashboard
- /compute-pressure/observe_return_type.https.any.worker.html - WPT Dashboard Interop Dashboard
// META: script=/resources/test-only-api.js
// META: script=resources/pressure-helpers.js
// META: global=window,dedicatedworker,sharedworker
'use strict';
// Make sure that observe() always returns a Promise.
pressure_test(async (t, mockPressureService) => {
const observer = new PressureObserver(() => {});
t.add_cleanup(() => observer.disconnect());
for (let i = 0; i < 2; i++) {
const promise = observer.observe('cpu');
assert_class_string(promise, 'Promise');
await promise;
}
}, 'PressureObserver.observe() is idempotent');