summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/compute-pressure/resources/compute-pressure-allowed-by-permissions-policy-worker.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/compute-pressure/resources/compute-pressure-allowed-by-permissions-policy-worker.js')
-rw-r--r--testing/web-platform/tests/compute-pressure/resources/compute-pressure-allowed-by-permissions-policy-worker.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/testing/web-platform/tests/compute-pressure/resources/compute-pressure-allowed-by-permissions-policy-worker.js b/testing/web-platform/tests/compute-pressure/resources/compute-pressure-allowed-by-permissions-policy-worker.js
new file mode 100644
index 0000000000..590ac52cfd
--- /dev/null
+++ b/testing/web-platform/tests/compute-pressure/resources/compute-pressure-allowed-by-permissions-policy-worker.js
@@ -0,0 +1,22 @@
+'use strict';
+
+importScripts('/resources/testharness.js');
+
+const header = 'permissions policy header "compute-pressure=*"';
+let workerType;
+
+if (typeof postMessage === 'function') {
+ workerType = 'dedicated';
+}
+
+promise_test(async () => {
+ try {
+ const observer = new PressureObserver(() => {});
+ await observer.observe('cpu');
+ observer.disconnect();
+ } catch (e) {
+ assert_unreached('expected promise to resolve.');
+ }
+}, `$Inherited ${header} allows ${workerType} workers.`);
+
+done();