| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE HTML> | |
| 2 <html> | |
| 3 <script> | |
| 4 var canvas, context, pattern, image; | |
| 5 | |
| 6 function runTest() { | |
| 7 if (window.testRunner) | |
| 8 testRunner.waitUntilDone(); | |
| 9 | |
| 10 canvas = document.getElementById('canvas'); | |
| 11 context = canvas.getContext('2d'); | |
| 12 | |
| 13 // Initialize the canvas with orange. | |
| 14 context.fillStyle = '#FFA500'; | |
| 15 context.fillRect(0, 0, 100, 100); | |
| 16 | |
| 17 image = document.createElement('img'); | |
| 18 image.setAttribute('src', 'resources/35ms-green-flash-at-35ms.svg'); | |
| 19 image.onload = function() { | |
| 20 setTimeout(function() { createPattern(); }, 50); | |
| 21 setTimeout(function() { drawPatternAndFinish(); }, 100); | |
| 22 } | |
| 23 } | |
| 24 | |
| 25 function createPattern() { | |
| 26 pattern = context.createPattern(image, 'repeat'); | |
| 27 } | |
| 28 | |
| 29 function drawPatternAndFinish() { | |
| 30 context.fillStyle = pattern; | |
| 31 context.fillRect(0, 0, 200, 200); | |
| 32 if (window.testRunner) | |
| 33 testRunner.notifyDone(); | |
| 34 } | |
| 35 </script> | |
| 36 <body onload='runTest()'> | |
| 37 Test for crbug.com/279445: createPattern should synchronously snapshot an anim
ating image.<br/> | |
| 38 This test passes if there is a green square below.<br/> | |
| 39 <canvas id='canvas' width='100' height='100'></canvas> | |
| 40 </body> | |
| 41 </html> | |
| 42 | |
| OLD | NEW |