| Index: LayoutTests/fast/canvas/webgl/webgl-composite-modes-tabswitching.html
|
| diff --git a/LayoutTests/fast/canvas/webgl/webgl-composite-modes-repaint.html b/LayoutTests/fast/canvas/webgl/webgl-composite-modes-tabswitching.html
|
| similarity index 80%
|
| copy from LayoutTests/fast/canvas/webgl/webgl-composite-modes-repaint.html
|
| copy to LayoutTests/fast/canvas/webgl/webgl-composite-modes-tabswitching.html
|
| index 13d07d02efd3ac8a80ce386ca20f5d0ac19ea317..eb95b4954ec1f32f09b2681fe4e4af2c4d0770d0 100644
|
| --- a/LayoutTests/fast/canvas/webgl/webgl-composite-modes-repaint.html
|
| +++ b/LayoutTests/fast/canvas/webgl/webgl-composite-modes-tabswitching.html
|
| @@ -2,7 +2,7 @@
|
| <body onload="runRepaintTest()">
|
| <span id="description" style="color: white">
|
| This test is only useful as a pixel test. You should see two rows with 4 canvases in each. The top row of canvases should have a black background, the bottom row should have a dark blue background.
|
| -The canvases in the first two rows should have a single triangle. The canvases on the left should have two triangles superimposed on top of each other.
|
| +The canvases in the first two rows should have a single triangle. The canvases on the left should have three triangles superimposed on top of each other.
|
| If multisampling is supported, the odd columns should have smooth edges instead of jagged stair-stepping.
|
| </span>
|
| <br>
|
| @@ -113,21 +113,41 @@ function drawAll(offset) {
|
| draw(ctxs[i], offset);
|
| }
|
|
|
| -drawAll(0);
|
| -
|
| -function repaintTest() {
|
| - drawAll(50);
|
| +function repaintOnVisiblePage() {
|
| + // Check if WebGL draws this frame correctly, because WebGL implementation
|
| + // clears temporary cache when page is hidden.
|
| + drawAll(60);
|
| if (window.testRunner) {
|
| testRunner.notifyDone();
|
| }
|
| }
|
|
|
| +function setPageVisible() {
|
| + if (window.testRunner) {
|
| + testRunner.setPageVisibility("visible");
|
| + testRunner.displayAsyncThen(repaintOnVisiblePage);
|
| + } else {
|
| + setTimeout(repaintOnVisiblePage, 50);
|
| + }
|
| +}
|
| +
|
| +function repaintOnHiddenPage() {
|
| + if (window.testRunner) {
|
| + testRunner.setPageVisibility("hidden");
|
| + }
|
| + // Although page is hidden, WebGL must draw this frame.
|
| + drawAll(30);
|
| + // testRunner.displayAsyncThen doesn't work when page is hidden.
|
| + setTimeout(setPageVisible, 50);
|
| +}
|
| +
|
| function runRepaintTest() {
|
| + drawAll(0);
|
| if (window.testRunner) {
|
| testRunner.waitUntilDone();
|
| - testRunner.displayAsyncThen(repaintTest);
|
| + testRunner.displayAsyncThen(repaintOnHiddenPage);
|
| } else {
|
| - setTimeout(repaintTest, 100);
|
| + setTimeout(repaintOnHiddenPage, 50);
|
| }
|
| }
|
| </script>
|
|
|