commit 2ca3c2426f1395d3939e767ab53f80e406eb6e24 Author: Jeff Gilbert jgilbert@mozilla.com Date: Mon Apr 14 15:43:57 2014 -0700
Bug 892990 - Cap waiting time for wait-for-composite in WebGL reftests. r=bjacob, a=test-only --- content/canvas/test/reftest/webgl-clear-test.html | 2 +- content/canvas/test/reftest/webgl-color-alpha-test.html | 2 +- content/canvas/test/reftest/webgl-color-test.html | 2 +- content/canvas/test/reftest/webgl-disable-test.html | 2 +- content/canvas/test/reftest/webgl-hanging-fb-test.html | 2 +- .../canvas/test/reftest/webgl-hanging-scissor-test.html | 2 +- content/canvas/test/reftest/webgl-orientation-test.html | 2 +- content/canvas/test/reftest/webgl-utils.js | 15 +++++++++++++++ 8 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/content/canvas/test/reftest/webgl-clear-test.html b/content/canvas/test/reftest/webgl-clear-test.html index 5fe4662..0905dea 100644 --- a/content/canvas/test/reftest/webgl-clear-test.html +++ b/content/canvas/test/reftest/webgl-clear-test.html @@ -33,7 +33,7 @@ function runTest() { else renderBackup(canvas);
- rAF(testComplete); + waitForComposite(testComplete); }
function testComplete() { diff --git a/content/canvas/test/reftest/webgl-color-alpha-test.html b/content/canvas/test/reftest/webgl-color-alpha-test.html index 9d568ef..45ab06a 100644 --- a/content/canvas/test/reftest/webgl-color-alpha-test.html +++ b/content/canvas/test/reftest/webgl-color-alpha-test.html @@ -85,7 +85,7 @@ function runTest() { else renderBackup(canvas, value, alpha);
- rAF(testComplete); + waitForComposite(testComplete); }
function testComplete() { diff --git a/content/canvas/test/reftest/webgl-color-test.html b/content/canvas/test/reftest/webgl-color-test.html index 785ef04..5455e49 100644 --- a/content/canvas/test/reftest/webgl-color-test.html +++ b/content/canvas/test/reftest/webgl-color-test.html @@ -69,7 +69,7 @@ function runTest() { else renderBackup(canvas);
- rAF(testComplete); + waitForComposite(testComplete); }
function testComplete() { diff --git a/content/canvas/test/reftest/webgl-disable-test.html b/content/canvas/test/reftest/webgl-disable-test.html index a46dc75..30581ec 100644 --- a/content/canvas/test/reftest/webgl-disable-test.html +++ b/content/canvas/test/reftest/webgl-disable-test.html @@ -44,7 +44,7 @@ function runTest() { else renderBackup(canvas);
- rAF(testComplete); + waitForComposite(testComplete); }
function testComplete() { diff --git a/content/canvas/test/reftest/webgl-hanging-fb-test.html b/content/canvas/test/reftest/webgl-hanging-fb-test.html index 4d589c4..e25356f 100644 --- a/content/canvas/test/reftest/webgl-hanging-fb-test.html +++ b/content/canvas/test/reftest/webgl-hanging-fb-test.html @@ -42,7 +42,7 @@ function runTest() { else renderBackup(canvas);
- rAF(testComplete); + waitForComposite(testComplete); }
function testComplete() { diff --git a/content/canvas/test/reftest/webgl-hanging-scissor-test.html b/content/canvas/test/reftest/webgl-hanging-scissor-test.html index f562447..29d1ecc 100644 --- a/content/canvas/test/reftest/webgl-hanging-scissor-test.html +++ b/content/canvas/test/reftest/webgl-hanging-scissor-test.html @@ -41,7 +41,7 @@ function runTest() { else renderBackup(canvas);
- rAF(testComplete); + waitForComposite(testComplete); }
function testComplete() { diff --git a/content/canvas/test/reftest/webgl-orientation-test.html b/content/canvas/test/reftest/webgl-orientation-test.html index 9e2ed2e..9fb2019 100644 --- a/content/canvas/test/reftest/webgl-orientation-test.html +++ b/content/canvas/test/reftest/webgl-orientation-test.html @@ -44,7 +44,7 @@ function runTest() { else renderBackup(canvas);
- rAF(testComplete); + waitForComposite(testComplete); }
function testComplete() { diff --git a/content/canvas/test/reftest/webgl-utils.js b/content/canvas/test/reftest/webgl-utils.js index 72d4b74..c17c8a1 100644 --- a/content/canvas/test/reftest/webgl-utils.js +++ b/content/canvas/test/reftest/webgl-utils.js @@ -66,3 +66,18 @@ function rAF(func) { var raf = window.requestAnimationFrame || window.mozRequestAnimationFrame; raf(func); } + +var MAX_WAIT_FOR_COMPOSITE_DELAY_MS = 500; + +function waitForComposite(func) { + var isDone = false; + var doneFunc = function () { + if (isDone) + return; + isDone = true; + func(); + }; + + rAF(doneFunc); + setTimeout(doneFunc, MAX_WAIT_FOR_COMPOSITE_DELAY_MS); +}