diff options
Diffstat (limited to 'dom/webgpu/tests/cts/checkout/src/common/util/wpt_reftest_wait.ts')
-rw-r--r-- | dom/webgpu/tests/cts/checkout/src/common/util/wpt_reftest_wait.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/dom/webgpu/tests/cts/checkout/src/common/util/wpt_reftest_wait.ts b/dom/webgpu/tests/cts/checkout/src/common/util/wpt_reftest_wait.ts new file mode 100644 index 0000000000..7d10520bcb --- /dev/null +++ b/dom/webgpu/tests/cts/checkout/src/common/util/wpt_reftest_wait.ts @@ -0,0 +1,24 @@ +import { timeout } from './timeout.js'; + +// Copied from https://github.com/web-platform-tests/wpt/blob/master/common/reftest-wait.js + +/** + * Remove the `reftest-wait` class on the document element. + * The reftest runner will wait with taking a screenshot while + * this class is present. + * + * See https://web-platform-tests.org/writing-tests/reftests.html#controlling-when-comparison-occurs + */ +export function takeScreenshot() { + document.documentElement.classList.remove('reftest-wait'); +} + +/** + * Call `takeScreenshot()` after a delay of at least `ms` milliseconds. + * @param {number} ms - milliseconds + */ +export function takeScreenshotDelayed(ms: number) { + timeout(() => { + takeScreenshot(); + }, ms); +} |