Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 description("Test the behavior of canvas recovery after a gpu context loss"); | |
| 2 | |
| 3 if (window.internals && window.testRunner) { | |
| 4 window.testRunner.dumpAsText(); | |
| 5 var ctx = document.createElement('canvas').getContext('2d'); | |
| 6 document.body.appendChild(ctx.canvas); | |
| 7 ctx.fillStyle = '#f00'; | |
| 8 ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height); | |
| 9 // context loss is a no-op when not gpu-acelerated, which is fine for this t est | |
| 10 window.internals.loseSharedGraphicsContext3D(); | |
|
Stephen White
2013/06/18 18:06:57
I wonder if we should do this four times, to test
| |
| 11 //Verify that buffer automatically recovers to a usable state | |
| 12 ctx.fillStyle = '#0f0'; | |
| 13 ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height); | |
| 14 imageData = ctx.getImageData(0, 0, 1, 1); | |
| 15 imgdata = imageData.data; | |
| 16 shouldBe("imgdata[0]", "0"); | |
| 17 shouldBe("imgdata[1]", "255"); | |
| 18 shouldBe("imgdata[2]", "0"); | |
| 19 shouldBe("imgdata[3]", "255"); | |
| 20 } else { | |
| 21 testFailed('This test requires window.internals and window.testRunner.'); | |
| 22 } | |
| OLD | NEW |