Bug 883364 - Allow tests to fail gracefully. r=dzbarsky
☠☠ backed out by 91b9edd45d8f ☠ ☠
authorJeff Gilbert <jgilbert@mozilla.com>
Tue, 30 Jul 2013 20:47:26 -0700
changeset 152974 85109095dd715ffb62c57379194412f1677c7f86
parent 152973 5a8a8ee17ab52fb280de05409c25be5a4e0887a7
child 152975 f10f7c79846c7d9912b370048ef7eecbc34d9974
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdzbarsky
bugs883364
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 883364 - Allow tests to fail gracefully. r=dzbarsky
content/canvas/test/reftest/webgl-clear-test.html
content/canvas/test/reftest/webgl-color-alpha-test.html
content/canvas/test/reftest/webgl-color-test.html
content/canvas/test/reftest/webgl-hanging-fb-test.html
content/canvas/test/reftest/webgl-hanging-scissor-test.html
content/canvas/test/reftest/webgl-orientation-test.html
--- a/content/canvas/test/reftest/webgl-clear-test.html
+++ b/content/canvas/test/reftest/webgl-clear-test.html
@@ -13,31 +13,38 @@
 "use strict";
 
 function renderGL(gl) {
   gl.clearColor(0.0, 1.0, 0.0, 1.0);
   gl.clear(gl.COLOR_BUFFER_BIT);
   gl.finish();
 }
 
+function renderFailure(canvas) {
+  // This will also trigger RAF for us.
+  var context = canvas.getContext("2d");
+  context.fillText('WebGL failed.', 64, 64);
+}
+
 function runTest() {
   var canvas = document.getElementById("canvas");
   var gl = initGL(canvas);
 
   if (gl)
     renderGL(gl);
   else
-    document.write("Failed to get WebGL context.");
+    renderFailure(canvas);
 
   rAF(testComplete);
 }
 
 function testComplete() {
   document.documentElement.removeAttribute("class");
 }
+
 </script>
 </head>
 
 <body onload="rAF(runTest);">
   <canvas id="canvas" width="256" height="256"></canvas>
 </body>
 
 </html>
--- a/content/canvas/test/reftest/webgl-color-alpha-test.html
+++ b/content/canvas/test/reftest/webgl-color-alpha-test.html
@@ -42,27 +42,33 @@ function renderGL(gl, value, alpha) {
 
   gl.scissor(128, 0, 128, 128);
   gl.clearColor(value, value, value, alpha);
   gl.clear(gl.COLOR_BUFFER_BIT);
 
   gl.finish();
 }
 
+function renderFailure(canvas) {
+  // This will also trigger RAF for us.
+  var context = canvas.getContext("2d");
+  context.fillText('WebGL failed.', 64, 64);
+}
+
 function runTest() {
   var canvas = document.getElementById("canvas");
   var gl = initGL(canvas);
 
   var value = arg("colorVal");
   var alpha = arg("alphaVal");
 
   if (gl)
     renderGL(gl, value, alpha);
   else
-    document.write("Failed to get WebGL context.");
+    renderFailure(canvas);
 
   rAF(testComplete);
 }
 
 function testComplete() {
   document.documentElement.removeAttribute("class");
 }
 </script>
--- a/content/canvas/test/reftest/webgl-color-test.html
+++ b/content/canvas/test/reftest/webgl-color-test.html
@@ -40,24 +40,30 @@ function renderGL(gl) {
 
   gl.scissor(128, 0, 128, 128);
   gl.clearColor(1.0, 1.0, 1.0, 1.0);
   gl.clear(gl.COLOR_BUFFER_BIT);
 
   gl.finish();
 }
 
+function renderFailure(canvas) {
+  // This will also trigger RAF for us.
+  var context = canvas.getContext("2d");
+  context.fillText('WebGL failed.', 64, 64);
+}
+
 function runTest() {
   var canvas = document.getElementById("canvas");
   var gl = initGL(canvas);
 
   if (gl)
     renderGL(gl);
   else
-    document.write("Failed to get WebGL context.");
+    renderFailure(canvas);
 
   rAF(testComplete);
 }
 
 function testComplete() {
   document.documentElement.removeAttribute("class");
 }
 </script>
--- a/content/canvas/test/reftest/webgl-hanging-fb-test.html
+++ b/content/canvas/test/reftest/webgl-hanging-fb-test.html
@@ -22,24 +22,30 @@ function renderGL(gl) {
   gl.clear(gl.COLOR_BUFFER_BIT);
 
   var fb = gl.createFramebuffer();
   gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
 
   gl.finish();
 }
 
+function renderFailure(canvas) {
+  // This will also trigger RAF for us.
+  var context = canvas.getContext("2d");
+  context.fillText('WebGL failed.', 64, 64);
+}
+
 function runTest() {
   var canvas = document.getElementById("canvas");
   var gl = initGL(canvas);
 
   if (gl)
     renderGL(gl);
   else
-    document.write("Failed to get WebGL context.");
+    renderFailure(canvas);
 
   rAF(testComplete);
 }
 
 function testComplete() {
   document.documentElement.removeAttribute("class");
 }
 </script>
--- a/content/canvas/test/reftest/webgl-hanging-scissor-test.html
+++ b/content/canvas/test/reftest/webgl-hanging-scissor-test.html
@@ -21,24 +21,30 @@ function renderGL(gl) {
   gl.clear(gl.COLOR_BUFFER_BIT);
 
   gl.enable(gl.SCISSOR_TEST);
   gl.scissor(0, 128, 128, 128);
 
   gl.finish();
 }
 
+function renderFailure(canvas) {
+  // This will also trigger RAF for us.
+  var context = canvas.getContext("2d");
+  context.fillText('WebGL failed.', 64, 64);
+}
+
 function runTest() {
   var canvas = document.getElementById("canvas");
   var gl = initGL(canvas);
 
   if (gl)
     renderGL(gl);
   else
-    document.write("Failed to get WebGL context.");
+    renderFailure(canvas);
 
   rAF(testComplete);
 }
 
 function testComplete() {
   document.documentElement.removeAttribute("class");
 }
 </script>
--- a/content/canvas/test/reftest/webgl-orientation-test.html
+++ b/content/canvas/test/reftest/webgl-orientation-test.html
@@ -21,24 +21,30 @@ function renderGL(gl) {
   gl.enable(gl.SCISSOR_TEST);
   gl.scissor(0, 128, 128, 128);
   gl.clearColor(1.0, 1.0, 1.0, 1.0);
   gl.clear(gl.COLOR_BUFFER_BIT);
 
   gl.finish();
 }
 
+function renderFailure(canvas) {
+  // This will also trigger RAF for us.
+  var context = canvas.getContext("2d");
+  context.fillText('WebGL failed.', 64, 64);
+}
+
 function runTest() {
   var canvas = document.getElementById("canvas");
   var gl = initGL(canvas);
 
   if (gl)
     renderGL(gl);
   else
-    document.write("Failed to get WebGL context.");
+    renderFailure(canvas);
 
   rAF(testComplete);
 }
 
 function testComplete() {
   document.documentElement.removeAttribute("class");
 }
 </script>