Skip to content

Commit

Permalink
compute pressure: Adding supportedSources to API
Browse files Browse the repository at this point in the history
To match existing observers API, supportedSources read-only property has been
added to the Compute Pressure interface.

https://wicg.github.io/compute-pressure/#the-supportedsources-attribute

It returns an array of supportedSource values supported by the user agent.
As the list of supported sources may vary per browser and will be evolving,
this property allows web developers to check which are available.

This patch doesn't affect the functionality of compute pressure.

Bug: 1292466
Change-Id: Ie1822dd90dcc4027624fc56d80424e6ea5484da1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3424278
Reviewed-by: Kentaro Hara <[email protected]>
Reviewed-by: Fr <[email protected]>
Reviewed-by: Raphael Kubo Da Costa <[email protected]>
Reviewed-by: Joshua Bell <[email protected]>
Commit-Queue: Arnaud Mandy <[email protected]>
Cr-Commit-Position: refs/heads/main@{#984321}
  • Loading branch information
arskama authored and chromium-wpt-export-bot committed Mar 23, 2022
1 parent 42fb98d commit f987e74
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

test(() => {
// Compute Pressure should support at least "cpu"
const sources = ComputePressureObserver.supportedSources;
assert_in_array('cpu', sources);
}, 'ComputePressureObserver should support at least "cpu"');

test(() => {
// Compute Pressure should be frozen array
const sources = ComputePressureObserver.supportedSources;
assert_equals(sources, ComputePressureObserver.supportedSources);
}, 'ComputePressureObserver must return always the same array');

test(() => {
// Compute Pressure should be frozen array
let sources = ComputePressureObserver.supportedSources;
assert_equals(Object.isFrozen(), true);
}, 'ComputePressureObserver must return a frozen array');

0 comments on commit f987e74

Please sign in to comment.