https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 169137c80d1fa287e6baebb91fa836fd9af6b6da authored by Geoffrey Sneddon on 13 February 2018, 13:58:10 UTC
Add test for loading the various products
Tip revision: 169137c
worklet-reftest.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 importWorkletAndTerminateTestAfterAsyncPaint(worklet, code) {
    if (typeof worklet == "undefined") {
        takeScreenshot();
    } else {
        var blob = new Blob([code], {type: 'text/javascript'});
        worklet.addModule(URL.createObjectURL(blob)).then(function() {
            requestAnimationFrame(function() {
                requestAnimationFrame(function() {
                    takeScreenshot();
                });
            });
        });
    }
}

back to top