blob: 37ed35b90ef0a769568a46464301ba8759f9be4f [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src = "../resources/runner.js"></script>
<script>
var canvas_idle = null;
var isDone = false;
function createCanvas4k(canvas_id) {
var myCanvas = document.createElement("canvas");
myCanvas.id = canvas_id;
myCanvas.width = 4000;
myCanvas.height = 4000;
myCanvas.getContext("2d").fillStyle = "rgba(0, 255, 0, 0.5)";
myCanvas.getContext("2d").fillRect(0, 0, myCanvas.width, myCanvas.height);
return myCanvas;
}
function invokeToBlobJpg(myCanvas) {
var startTime = PerfTestRunner.now();
myCanvas.toBlob(function(blob){
PerfTestRunner.measureValueAsync(PerfTestRunner.now() - startTime);
if (!isDone) {
PerfTestRunner.gc();
runTest(myCanvas);
}
}, "image/jpeg");
}
function runTest(myCanvas) {
invokeToBlobJpg(myCanvas);
}
window.onload = function () {
canvas_idle = createCanvas4k("canvas_idle");
PerfTestRunner.startMeasureValuesAsync({
unit: 'ms',
done: function () {
isDone = true;
},
run: function() {
runTest(canvas_idle);
},
description: "Measures performance of canvas."
});
};
</script>
</body>
</html>