Automatic update from web-platform-tests cpu_performance: Add prototype implementation This CL adds a prototype implementation for a new Web API that exposes some information about how powerful the user device is, targeting applications that will use this information to provide an improved user experience. It is currently implemented behind the runtime flag --enable-features=CpuPerformance. The API exposes navigator.cpuPerformance, which is a small integer number corresponding to the user device's "performance tier" (similarly to navigator.deviceMemory). The prototype implementation simply classifies user devices in five tiers (1-4, denoting increasing performance; 0 for unknown), based on the number of CPU cores. The plan is to allow embedders to override this default with more complicated, implementation-specific behaviour (to be implemented in a subsequent CL). Chrome Status entry: https://chromestatus.com/feature/5189864286978048 Explainer: https://github.com/explainers-by-googlers/cpu-performance Change-Id: Ie711d0de89c44ee621c72271f5a98a0a32d64365 Bug: 449760252 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6780564 Commit-Queue: Nikolaos Papaspyrou <nikolaos@chromium.org> Reviewed-by: Dominic Farolino <dom@chromium.org> Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/main@{#1527714} -- wpt-commits: 6cdc155f1d15000fb6e25dcc6d555f0f01e278dd wpt-pr: 55309
9 lines
419 B
JavaScript
9 lines
419 B
JavaScript
test(function () {
|
|
assert_equals(typeof navigator.cpuPerformance, "number",
|
|
"navigator.cpuPerformance returns a number");
|
|
assert_true(Number.isInteger(navigator.cpuPerformance),
|
|
"navigator.cpuPerformance returns an integer value");
|
|
assert_true(navigator.cpuPerformance >= 0,
|
|
"navigator.cpuPerformance returns a non-negative value");
|
|
}, "navigator.cpuPerformance is valid, if the feature is enabled");
|