Index: LayoutTests/fast/canvas/webgl/draw-webgl-to-canvas-2d.html |
diff --git a/LayoutTests/fast/canvas/webgl/draw-webgl-to-canvas-2d.html b/LayoutTests/fast/canvas/webgl/draw-webgl-to-canvas-2d.html |
index 4fbcd2287a372bb330706410a5ed2bf2a1418ad8..72aa06fedf1cf7e3cd2ad576f9e8545abba09c93 100644 |
--- a/LayoutTests/fast/canvas/webgl/draw-webgl-to-canvas-2d.html |
+++ b/LayoutTests/fast/canvas/webgl/draw-webgl-to-canvas-2d.html |
@@ -86,7 +86,15 @@ function drawWebGLToCanvas2D(ctx2D, canvas3D, isDrawingBufferUndefined) { |
testRunner.notifyDone(); |
} |
-window.onload = function () { |
+function asyncTest() { |
+ debug("Check for drawing webgl to canvas 2d several frames after drawing webgl contents.") |
+ debug("1) when drawingBuffer is preserved.") |
+ drawWebGLToCanvas2D(preserve_ctx2D, preserve_canvas3D, false); |
+ debug("2) when drawingBuffer is not preserved. It leads to undefined behavior.") |
+ drawWebGLToCanvas2D(nonpreserve_ctx2D, nonpreserve_canvas3D, true); |
+} |
+ |
+function startTestAfterFirstPaint() { |
// create both canvas 2d and webgl contexts. |
createContexts(); |
// prepare webgl contents. |
@@ -99,13 +107,16 @@ window.onload = function () { |
debug("2) when drawingBuffer is not preserved.") |
drawWebGLToCanvas2D(nonpreserve_ctx2D, nonpreserve_canvas3D, false); |
- setTimeout(function () { |
- debug("Check for drawing webgl to canvas 2d several frames after drawing webgl contents.") |
- debug("1) when drawingBuffer is preserved.") |
- drawWebGLToCanvas2D(preserve_ctx2D, preserve_canvas3D, false); |
- debug("2) when drawingBuffer is not preserved. It leads to undefined behavior.") |
- drawWebGLToCanvas2D(nonpreserve_ctx2D, nonpreserve_canvas3D, true); |
- }, 50); |
+ if (window.testRunner) { |
+ testRunner.waitUntilDone(); |
+ testRunner.displayAsyncThen(asyncTest); |
+ } else { |
+ window.requestAnimationFrame(asyncTest); |
+ } |
+} |
+ |
+window.onload = function () { |
+ window.requestAnimationFrame(startTestAfterFirstPaint); |
} |
</script> |