diff options
Diffstat (limited to 'tests/wpt/web-platform-tests/webgpu/framework/util/index.js')
-rw-r--r-- | tests/wpt/web-platform-tests/webgpu/framework/util/index.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/wpt/web-platform-tests/webgpu/framework/util/index.js b/tests/wpt/web-platform-tests/webgpu/framework/util/index.js index 8d0fe0e5b48..32aea98dea7 100644 --- a/tests/wpt/web-platform-tests/webgpu/framework/util/index.js +++ b/tests/wpt/web-platform-tests/webgpu/framework/util/index.js @@ -2,12 +2,20 @@ * AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts **/ +import { timeout } from './timeout.js'; export * from './stack.js'; // performance.now() is available in all browsers, but not in scope by default in Node. const perf = typeof performance !== 'undefined' ? performance : require('perf_hooks').performance; export function now() { return perf.now(); } +export function rejectOnTimeout(ms, msg) { + return new Promise((resolve, reject) => { + timeout(() => { + reject(new Error(msg)); + }, ms); + }); +} export function objectEquals(x, y) { if (typeof x !== 'object' || typeof y !== 'object') return x === y; if (x === null || y === null) return x === y; @@ -24,4 +32,7 @@ export function objectEquals(x, y) { const p = Object.keys(x); return Object.keys(y).every(i => p.indexOf(i) !== -1) && p.every(i => objectEquals(x1[i], y1[i])); } +export function range(n, fn) { + return [...new Array(n)].map((_, i) => fn(i)); +} //# sourceMappingURL=index.js.map
\ No newline at end of file |