Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/canvas/synchronous-create-pattern.html |
| diff --git a/third_party/WebKit/LayoutTests/canvas/synchronous-create-pattern.html b/third_party/WebKit/LayoutTests/canvas/synchronous-create-pattern.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..60af7f4b67d0d684858701b431520636d249996f |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/canvas/synchronous-create-pattern.html |
| @@ -0,0 +1,42 @@ |
| +<!DOCTYPE HTML> |
| +<html> |
| +<script> |
| +var canvas, context, pattern, image; |
| + |
| +function runTest() { |
| + if (window.testRunner) |
| + testRunner.waitUntilDone(); |
| + |
| + canvas = document.getElementById('canvas'); |
| + context = canvas.getContext('2d'); |
| + |
| + // Initialize the canvas with orange. |
| + context.fillStyle = '#FFA500'; |
| + context.fillRect(0, 0, 100, 100); |
| + |
| + image = document.createElement('img'); |
| + image.setAttribute('src', 'resources/green-flash-at-20ms.svg'); |
| + image.onload = function() { |
| + setTimeout(function() { createPattern(); }, 20); |
|
xidachen
2015/12/02 19:38:23
I tried changing 20ms to be 10ms but then it faile
|
| + setTimeout(function() { drawPatternAndFinish(); }, 21); |
| + } |
| +} |
| + |
| +function createPattern() { |
| + pattern = context.createPattern(image, 'repeat'); |
| +} |
| + |
| +function drawPatternAndFinish() { |
| + context.fillStyle = pattern; |
| + context.fillRect(0, 0, 200, 200); |
| + if (window.testRunner) |
| + testRunner.notifyDone(); |
| +} |
| + |
| +</script> |
| +<body onload='runTest()'> |
| + Test for crbug.com/279445: createPattern should synchronously snapshot an animating image.<br/> |
| + This test passes if there is a green square below.<br/> |
| + <canvas id='canvas' width='100' height='100'></canvas> |
| +</body> |
| +</html> |