https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 1ea17fc1edda1c4cd0eb3915dc98ae8185e50d80 authored by James Graham on 22 August 2017, 14:43:51 UTC
Consolidate logic for multi-global tests.
Tip revision: 1ea17fc
css-paint-tests.js
// To make sure that we take the snapshot at the right time, we do double
// requestAnimationFrame. In the second frame, we take a screenshot, that makes
// sure that we already have a full frame.
function importPaintWorkletAndTerminateTestAfterAsyncPaint(code) {
    if (typeof paintWorklet == "undefined") {
        takeScreenshot();
    } else {
        var blob = new Blob([code], {type: 'text/javascript'});
        paintWorklet.addModule(URL.createObjectURL(blob)).then(function() {
            requestAnimationFrame(function() {
                requestAnimationFrame(function() {
                    takeScreenshot();
                });
            });
        });
    }
}

back to top