Bug 1193526 - Update conformance path and remove unused file. r=jgilbert

The folder name "webgl-conformance" is too long. Rename it to
"webgl-conf".

MozReview-Commit-ID: FPpYn7MkjFN

--HG--
rename : dom/canvas/test/webgl-conformance/always-fail.html => dom/canvas/test/webgl-conf/always-fail.html
rename : dom/canvas/test/webgl-conformance/generate-wrappers-and-manifest.py => dom/canvas/test/webgl-conf/generate-wrappers-and-manifest.py
rename : dom/canvas/test/webgl-conformance/mochi-single.html => dom/canvas/test/webgl-conf/mochi-single.html
rename : dom/canvas/test/webgl-conformance/mochi-wrapper.html.template => dom/canvas/test/webgl-conf/mochi-wrapper.html.template
rename : dom/canvas/test/webgl-conformance/mochitest-errata.ini => dom/canvas/test/webgl-conf/mochitest-errata.ini
rename : dom/canvas/test/webgl-conformance/mochitest.ini.template => dom/canvas/test/webgl-conf/mochitest.ini.template
This commit is contained in:
Morris Tseng 2016-04-27 11:55:41 +08:00
parent 6f5966c383
commit 7387ca5b1d
15 changed files with 0 additions and 2167 deletions

View File

@ -1,30 +0,0 @@
This is a local copy of the WebGL conformance suite, version 1.0.1, SVN revision 17794 (on the 1.0.1 branch, not on trunk)
The canonical location for this 1.0.1 test suite is:
https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/conformance-suites/1.0.1
The canonical location of the development tree is:
https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests
All files and directories in this directory, with the exceptions listed below, come from
upstream and should not be modified without corresponding upstream fixes and/or a
patch file in this directory. The exceptions (the Mozilla-specific files) are:
* README.mozilla (this file)
* failing_tests_*.txt
* moz.build
* writemanifest.py
* *.patch files, if any
How to do an update:
1. unapply local patches (the .patch files here)
2. perform the update:
* method A: apply diff with new version
* method B: erase all files here, import copy of new version.
3. edit CONFORMANCE_TEST_VERSION in test_webgl_conformance_test_suite.html. That's what
determines with tests to run, as some tests are only enabled in some not-yet-released
version.
4. reapply local patches.
5. update this readme and the .patch files.
6. run writemanifest.py to update test manifest.

View File

@ -1,33 +0,0 @@
Welcome to the WebGL Conformance Test Suite
===========================================
This is the initial release of the WebGL conformance test suite.
NOTE TO USERS: Unless you are a WebGL implementor, there is no need to submit
a conformance result using this process. Should you discover bugs in your
browser's WebGL implementation, either via this test suite or otherwise,
please report them through your browser vendor's bug tracking system.
FOR WEBGL IMPLEMENTORS: Please follow the instructions below to create
a formal conformance submission.
1) Open webgl-conformance-tests.html in your target browser
2) Press the "run tests" button
3) At the end of the run, press "display text summary"
4) Verify that the User Agent and WebGL renderer strings identify your browser and target correctly.
5) Copy the contents of the text summary (starting with "WebGL Conformance Test Results") and send via email to
webgl_conformance_submissions@khronos.org
Please see CONFORMANCE_RULES.txt in this directory for guidelines
about what constitutes a conformant WebGL implementation.
- Version 1.0.0
- February 24, 2011
- Version 1.0.1
- February 23, 2012

File diff suppressed because one or more lines are too long

View File

@ -1,197 +0,0 @@
# HG changeset patch
# Parent b21ff47f08bc84b2f4b76348421f9144661da44f
diff --git a/dom/canvas/test/webgl/conformance/extensions/00_test_list.txt b/dom/canvas/test/webgl/conformance/extensions/00_test_list.txt
--- a/dom/canvas/test/webgl/conformance/extensions/00_test_list.txt
+++ b/dom/canvas/test/webgl/conformance/extensions/00_test_list.txt
@@ -1,7 +1,8 @@
oes-standard-derivatives.html
+ext-texture-filter-anisotropic.html
oes-texture-float.html
oes-vertex-array-object.html
webgl-debug-renderer-info.html
webgl-debug-shaders.html
--min-version 1.0.2 webgl-compressed-texture-s3tc.html
diff --git a/dom/canvas/test/webgl/conformance/extensions/ext-texture-filter-anisotropic.html b/dom/canvas/test/webgl/conformance/extensions/ext-texture-filter-anisotropic.html
new file mode 100644
--- /dev/null
+++ b/dom/canvas/test/webgl/conformance/extensions/ext-texture-filter-anisotropic.html
@@ -0,0 +1,177 @@
+<!--
+Copyright (c) 2012 Florian Boesch <pyalot@gmail.com>. All rights reserved.
+Use of this source code is governed by a BSD-style license that can be
+found in the LICENSE file.
+ -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL EXT_texture_filter_anisotropic Conformance Tests</title>
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/webgl-test.js"></script>
+<script src="../resources/webgl-test-utils.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<canvas id="canvas" style="width: 50px; height: 50px;"> </canvas>
+<div id="console"></div>
+
+<script>
+description("This test verifies the functionality of the EXT_texture_filter_anisotropic extension, if it is available.");
+
+debug("");
+
+var wtu = WebGLTestUtils;
+var canvas = document.getElementById("canvas");
+var gl = create3DContext(canvas);
+var ext = null;
+
+var getExtension = function(){
+ ext = gl.getExtension("MOZ_EXT_texture_filter_anisotropic");
+ if(ext) return;
+
+ ext = gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic");
+ if(ext) return;
+
+ ext = gl.getExtension("EXT_texture_filter_anisotropic");
+ if(ext) return;
+}
+
+var listsExtension = function(){
+ var supported = gl.getSupportedExtensions();
+ if(supported.indexOf("MOZ_EXT_texture_filter_anisotropic") >= 0) return true;
+ if(supported.indexOf("WEBKIT_EXT_texture_filter_anisotropic") >= 0) return true;
+ if(supported.indexOf("EXT_texture_filter_anisotropic") >= 0) return true;
+
+ return false;
+}
+
+if (!gl) {
+ testFailed("WebGL context does not exist");
+} else {
+ testPassed("WebGL context exists");
+
+ // Run tests with extension disabled
+ runHintTestDisabled();
+
+ // Query the extension and store globally so shouldBe can access it
+ getExtension();
+
+ if (!ext) {
+ testPassed("No EXT_texture_filter_anisotropic support -- this is legal");
+
+ runSupportedTest(false);
+ } else {
+ testPassed("Successfully enabled EXT_texture_filter_anisotropic extension");
+
+ runSupportedTest(true);
+ runHintTestEnabled();
+ }
+}
+
+function runSupportedTest(extensionEnabled) {
+ if (listsExtension()) {
+ if (extensionEnabled) {
+ testPassed("EXT_texture_filter_anisotropic listed as supported and getExtension succeeded");
+ } else {
+ testFailed("EXT_texture_filter_anisotropic listed as supported but getExtension failed");
+ }
+ } else {
+ if (extensionEnabled) {
+ testFailed("EXT_texture_filter_anisotropic not listed as supported but getExtension succeeded");
+ } else {
+ testPassed("EXT_texture_filter_anisotropic not listed as supported and getExtension failed -- this is legal");
+ }
+ }
+}
+
+function runHintTestDisabled() {
+ debug("Testing MAX_TEXTURE_MAX_ANISOTROPY_EXT with extension disabled");
+
+ var MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
+ gl.getParameter(MAX_TEXTURE_MAX_ANISOTROPY_EXT);
+ glErrorShouldBe(gl, gl.INVALID_ENUM, "MAX_TEXTURE_MAX_ANISOTROPY_EXT should not be queryable if extension is disabled");
+
+ debug("Testing TEXTURE_MAX_ANISOTROPY_EXT with extension disabled");
+ var TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE;
+ var texture = gl.createTexture();
+ gl.bindTexture(gl.TEXTURE_2D, texture);
+
+ gl.getTexParameter(gl.TEXTURE_2D, TEXTURE_MAX_ANISOTROPY_EXT);
+ glErrorShouldBe(gl, gl.INVALID_ENUM, "TEXTURE_MAX_ANISOTROPY_EXT should not be queryable if extension is disabled");
+
+ gl.texParameterf(gl.TEXTURE_2D, TEXTURE_MAX_ANISOTROPY_EXT, 1);
+ glErrorShouldBe(gl, gl.INVALID_ENUM, "TEXTURE_MAX_ANISOTROPY_EXT should not be settable if extension is disabled");
+
+ gl.texParameteri(gl.TEXTURE_2D, TEXTURE_MAX_ANISOTROPY_EXT, 1);
+ glErrorShouldBe(gl, gl.INVALID_ENUM, "TEXTURE_MAX_ANISOTROPY_EXT should not be settable if extension is disabled");
+
+ gl.deleteTexture(texture);
+}
+
+function runHintTestEnabled() {
+ debug("Testing MAX_TEXTURE_MAX_ANISOTROPY_EXT with extension enabled");
+
+ shouldBe("ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT", "0x84FF");
+
+ var max_anisotropy = gl.getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT);
+ glErrorShouldBe(gl, gl.NO_ERROR, "MAX_TEXTURE_MAX_ANISOTROPY_EXT query should succeed if extension is enabled");
+
+ if(max_anisotropy >= 2){
+ testPassed("Minimum value of MAX_TEXTURE_MAX_ANISOTROPY_EXT is 2.0");
+ }
+ else{
+ testFailed("Minimum value of MAX_TEXTURE_MAX_ANISOTROPY_EXT is 2.0, returned values was: " + max_anisotropy);
+ }
+
+ // TODO make a texture and verify initial value == 1 and setting to less than 1 is invalid value
+
+ debug("Testing TEXTURE_MAX_ANISOTROPY_EXT with extension disabled");
+ shouldBe("ext.TEXTURE_MAX_ANISOTROPY_EXT", "0x84FE");
+
+ var texture = gl.createTexture();
+ gl.bindTexture(gl.TEXTURE_2D, texture);
+
+ var queried_value = gl.getTexParameter(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT);
+ glErrorShouldBe(gl, gl.NO_ERROR, "TEXTURE_MAX_ANISOTROPY_EXT query should succeed if extension is enabled");
+
+ if(queried_value == 1){
+ testPassed("Initial value of TEXTURE_MAX_ANISOTROPY_EXT is 1.0");
+ }
+ else{
+ testFailed("Initial value of TEXTURE_MAX_ANISOTROPY_EXT should be 1.0, returned value was: " + queried_value);
+ }
+
+ gl.texParameterf(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, 0);
+ glErrorShouldBe(gl, gl.INVALID_VALUE, "texParameterf TEXTURE_MAX_ANISOTROPY_EXT set to < 1 should be an invalid value");
+
+ gl.texParameteri(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, 0);
+ glErrorShouldBe(gl, gl.INVALID_VALUE, "texParameteri TEXTURE_MAX_ANISOTROPY_EXT set to < 1 should be an invalid value");
+
+ gl.texParameterf(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy);
+ glErrorShouldBe(gl, gl.NO_ERROR, "texParameterf TEXTURE_MAX_ANISOTROPY_EXT set to >= 2 should should succeed");
+
+ gl.texParameteri(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy);
+ glErrorShouldBe(gl, gl.NO_ERROR, "texParameteri TEXTURE_MAX_ANISOTROPY_EXT set to >= 2 should should succeed");
+
+ var queried_value = gl.getTexParameter(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT);
+ if(queried_value == max_anisotropy){
+ testPassed("Set value of TEXTURE_MAX_ANISOTROPY_EXT matches expecation");
+ }
+ else{
+ testFailed("Set value of TEXTURE_MAX_ANISOTROPY_EXT should be: " + max_anisotropy + " , returned value was: " + queried_value);
+ }
+
+ gl.deleteTexture(texture);
+}
+
+debug("");
+successfullyParsed = true;
+</script>
+<script>finishTest();</script>
+
+</body>
+</html>

View File

@ -1,22 +0,0 @@
diff --git a/dom/canvas/test/webgl/resources/webgl-test-harness.js b/dom/canvas/test/webgl/resources/webgl-test-harness.js
--- a/dom/canvas/test/webgl/resources/webgl-test-harness.js
+++ b/dom/canvas/test/webgl/resources/webgl-test-harness.js
@@ -362,18 +362,16 @@ TestHarness.prototype.addFiles_ = functi
}
log("total files: " + files.length);
for (var ii = 0; ii < files.length; ++ii) {
log("" + ii + ": " + files[ii]);
this.files.push(new TestFile(files[ii]));
this.reportFunc(TestHarness.reportType.ADD_PAGE, files[ii], undefined);
}
this.reportFunc(TestHarness.reportType.READY, undefined, undefined);
- this.nextFileIndex = files.length;
- this.lastFileIndex = files.length;
}
TestHarness.prototype.runTests = function(opt_start, opt_count) {
var count = opt_count || this.files.length;
this.nextFileIndex = opt_start || 0;
this.lastFileIndex = this.nextFileIndex + count;
this.startNextFile();
};

View File

@ -1,155 +0,0 @@
# HG changeset patch
# Parent f9585cefcf568dbc2a6ce81f16a2048365af7ed2
diff --git a/dom/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html b/dom/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
--- a/dom/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
+++ b/dom/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
@@ -337,42 +337,21 @@ function runOutputTests() {
setupBuffers(1.0, 0.5, 0.5, 0.0);
wtu.drawQuad(gl);
expectResult([3, 3, 5, 255],
"Draw 4 (variation in x & y) returned the correct data",
"Draw 4 (variation in x & y) returned incorrect data");
}
-function attemptToForceGC()
-{
- var holderArray = [];
- var tempArray;
- window.tempArray = holderArray;
- for (var i = 0; i < 12; ++i) {
- tempArray = [];
- for (var j = 0; j < 1024 * 1024; ++j) {
- tempArray.push(0);
- }
- holderArray.push(tempArray);
- }
- window.tempArray = null;
-}
-
function runUniqueObjectTest()
{
debug("Testing that getExtension() returns the same object each time");
gl.getExtension("OES_standard_derivatives").myProperty = 2;
- if (window.GCController) {
- window.GCController.collect();
- } else if (window.opera && window.opera.collect) {
- window.opera.collect();
- } else {
- attemptToForceGC();
- }
+ gc();
shouldBe('gl.getExtension("OES_standard_derivatives").myProperty', '2');
}
function runReferenceCycleTest()
{
// create some reference cycles. The goal is to see if they cause leaks. The point is that
// some browser test runners have instrumentation to detect leaked refcounted objects.
diff --git a/dom/canvas/test/webgl/conformance/extensions/oes-texture-float.html b/dom/canvas/test/webgl/conformance/extensions/oes-texture-float.html
--- a/dom/canvas/test/webgl/conformance/extensions/oes-texture-float.html
+++ b/dom/canvas/test/webgl/conformance/extensions/oes-texture-float.html
@@ -178,42 +178,21 @@ function runRenderTargetTest(testProgram
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.useProgram(testProgram);
gl.uniform1i(gl.getUniformLocation(testProgram, "tex"), 0);
wtu.drawQuad(gl);
glErrorShouldBe(gl, gl.NO_ERROR, "rendering from floating-point texture should succeed");
checkRenderingResults();
}
-function attemptToForceGC()
-{
- var holderArray = [];
- var tempArray;
- window.tempArray = holderArray;
- for (var i = 0; i < 12; ++i) {
- tempArray = [];
- for (var j = 0; j < 1024 * 1024; ++j) {
- tempArray.push(0);
- }
- holderArray.push(tempArray);
- }
- window.tempArray = null;
-}
-
function runUniqueObjectTest()
{
debug("Testing that getExtension() returns the same object each time");
gl.getExtension("OES_texture_float").myProperty = 2;
- if (window.GCController) {
- window.GCController.collect();
- } else if (window.opera && window.opera.collect) {
- window.opera.collect();
- } else {
- attemptToForceGC();
- }
+ gc();
shouldBe('gl.getExtension("OES_texture_float").myProperty', '2');
}
function runReferenceCycleTest()
{
// create some reference cycles. The goal is to see if they cause leaks. The point is that
// some browser test runners have instrumentation to detect leaked refcounted objects.
diff --git a/dom/canvas/test/webgl/resources/js-test-pre.js b/dom/canvas/test/webgl/resources/js-test-pre.js
--- a/dom/canvas/test/webgl/resources/js-test-pre.js
+++ b/dom/canvas/test/webgl/resources/js-test-pre.js
@@ -435,29 +435,42 @@ function assertMsg(assertion, msg) {
if (assertion) {
testPassed(msg);
} else {
testFailed(msg);
}
}
function gc() {
- if (typeof GCController !== "undefined")
- GCController.collect();
- else {
- function gcRec(n) {
- if (n < 1)
- return {};
- var temp = {i: "ab" + i + (i / 100000)};
- temp += "foo";
- gcRec(n-1);
- }
- for (var i = 0; i < 1000; i++)
- gcRec(10)
+ if (window.GCController) {
+ window.GCController.collect();
+ return;
}
+
+ if (window.opera && window.opera.collect) {
+ window.opera.collect();
+ return;
+ }
+
+ try {
+ window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+ .getInterface(Components.interfaces.nsIDOMWindowUtils)
+ .garbageCollect();
+ return;
+ } catch(e) {}
+
+ function gcRec(n) {
+ if (n < 1)
+ return {};
+ var temp = {i: "ab" + i + (i / 100000)};
+ temp += "foo";
+ gcRec(n-1);
+ }
+ for (var i = 0; i < 1000; i++)
+ gcRec(10);
}
function finishTest() {
successfullyParsed = true;
var epilogue = document.createElement("script");
epilogue.onload = function() {
if (window.nonKhronosFrameworkNotifyDone) {
window.nonKhronosFrameworkNotifyDone();

View File

@ -1,32 +0,0 @@
IFrameAutoresize = (function(){
var IFRAME_BODY_MARGIN = 8;
var UPDATE_INTERVAL = 300; // ms
var MIN_HEIGHT = 100;
function Start(elem, hasMargin) {
var fnResize = function() {
var frameBody = elem.contentWindow.document.body;
if (frameBody) {
var frameHeight = frameBody.scrollHeight;
if (hasMargin) {
frameHeight += 2*IFRAME_BODY_MARGIN;
}
elem.height = Math.max(MIN_HEIGHT, frameHeight);
}
setTimeout(fnResize, UPDATE_INTERVAL);
}
fnResize();
}
function StartById(id, hasMargin) {
var elem = document.getElementById(id);
Start(elem, hasMargin);
}
return {
Start: Start,
StartById: StartById,
};
})();

View File

@ -1,174 +0,0 @@
# HG changeset patch
# Parent 9294c812b3ebf3a2684b081886a65fa0cd0420b3
diff --git a/dom/canvas/test/webgl/conformance/glsl/misc/glsl-function-nodes.html b/dom/canvas/test/webgl/conformance/glsl/misc/glsl-function-nodes.html
--- a/dom/canvas/test/webgl/conformance/glsl/misc/glsl-function-nodes.html
+++ b/dom/canvas/test/webgl/conformance/glsl/misc/glsl-function-nodes.html
@@ -118,17 +118,18 @@ function init()
var bufFunction = new Uint8Array(width * height * 4);
var bufMacro = new Uint8Array(width * height * 4);
if (drawAndRead("canvasFunction", "vshaderFunction", bufFunction) == false ||
drawAndRead("canvasMacro", "vshaderMacro", bufMacro) == false) {
testFailed("Setup failed");
} else {
if (compareRendering(bufFunction, bufMacro, 4) == false)
- testFailed("Rendering results are different");
+ testFailedRender("Rendering results are different", bufMacro,
+ bufFunction, width, height);
else
testPassed("Rendering results are the same");
}
}
init();
successfullyParsed = true;
</script>
diff --git a/dom/canvas/test/webgl/conformance/misc/uninitialized-test.html b/dom/canvas/test/webgl/conformance/misc/uninitialized-test.html
--- a/dom/canvas/test/webgl/conformance/misc/uninitialized-test.html
+++ b/dom/canvas/test/webgl/conformance/misc/uninitialized-test.html
@@ -57,17 +57,19 @@ function checkNonZeroPixels(texture, tex
gl.readPixels(0, 0, texWidth, texHeight, gl.RGBA, gl.UNSIGNED_BYTE, data);
var k = 0;
for (var y = 0; y < texHeight; ++y) {
for (var x = 0; x < texWidth; ++x) {
var index = (y * texWidth + x) * 4;
if (x >= skipX && x < skipX + skipWidth && y >= skipY && y < skipY + skipHeight) {
if (data[index] != skipR || data[index + 1] != skipG || data[index + 2] != skipB || data[index + 3] != skipA) {
- testFailed("non-zero pixel values are wrong");
+ testFailed("non-zero pixel values are wrong at (" + x + ", " + y + "), data was (" +
+ data[index] + "," + data[index + 1] + "," + data[index + 2] + "," + data[index + 3] +
+ ") should have been (" + skipR + "," + skipG + "," + skipB + "," + skipA + ")");
return;
}
} else {
for (var i = 0; i < 4; ++i) {
if (data[index + i] != 0)
k++;
}
}
diff --git a/dom/canvas/test/webgl/conformance/resources/webgl-test-utils.js b/dom/canvas/test/webgl/conformance/resources/webgl-test-utils.js
--- a/dom/canvas/test/webgl/conformance/resources/webgl-test-utils.js
+++ b/dom/canvas/test/webgl/conformance/resources/webgl-test-utils.js
@@ -445,21 +445,29 @@ var drawQuad = function(gl, opt_color) {
var checkCanvasRect = function(gl, x, y, width, height, color, msg, errorRange) {
errorRange = errorRange || 0;
var buf = new Uint8Array(width * height * 4);
gl.readPixels(x, y, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf);
for (var i = 0; i < width * height; ++i) {
var offset = i * 4;
for (var j = 0; j < color.length; ++j) {
if (Math.abs(buf[offset + j] - color[j]) > errorRange) {
- testFailed(msg);
var was = buf[offset + 0].toString();
for (j = 1; j < color.length; ++j) {
was += "," + buf[offset + j];
}
+
+ var cv = document.createElement('canvas');
+ cv.height = height;
+ cv.width = width;
+ var ctx = cv.getContext('2d');
+ ctx.fillStyle="rgba(" + color[0] + ", " + color[1] + ", " + color[2] + ", 255)";
+ ctx.fillRect(0, 0, width, height);
+ testFailedRender(msg, ctx, buf, width, height);
+
debug('at (' + (i % width) + ', ' + Math.floor(i / width) +
') expected: ' + color + ' was ' + was);
return;
}
}
}
testPassed(msg);
};
diff --git a/dom/canvas/test/webgl/resources/js-test-pre.js b/dom/canvas/test/webgl/resources/js-test-pre.js
--- a/dom/canvas/test/webgl/resources/js-test-pre.js
+++ b/dom/canvas/test/webgl/resources/js-test-pre.js
@@ -81,16 +81,87 @@ function testPassed(msg)
reportTestResultsToHarness(true, msg);
debug('<span><span class="pass">PASS</span> ' + escapeHTML(msg) + '</span>');
}
function testFailed(msg)
{
reportTestResultsToHarness(false, msg);
debug('<span><span class="fail">FAIL</span> ' + escapeHTML(msg) + '</span>');
+ dump('FAIL: ' + msg + '\n');
+
+ var stack = (new Error).stack.split('\n');
+ if (!stack.length) {
+ return;
+ }
+
+ dump('STACK TRACE: \n');
+
+ stack.pop();
+ var index = 0, frame, messages = new Array();
+ // Match all .html files and print out the line in them.
+ while (stack.length && index != -1) {
+ frame = stack.pop();
+ index = frame.indexOf(".html:");
+ if (index != -1) {
+ messages.unshift(frame);
+ }
+ }
+
+ // Print out the first stack frame in JS and then stop.
+ if (stack.length) {
+ messages.unshift(stack.pop());
+ }
+
+ for (message in messages) {
+ dump(messages[message] + '\n');
+ }
+}
+
+function testFailedRender(msg, ref, test, width, height)
+{
+ var refData;
+ if (typeof ref.getImageData == 'function') {
+ refData = ref.canvas.toDataURL();
+ } else {
+ refData = arrayToURLData(ref, width, height);
+ }
+
+ var testData;
+ if (typeof test.getImageData == 'function') {
+ testData = test.canvas.toDataURL();
+ } else {
+ testData = arrayToURLData(test, width, height);
+ }
+
+ testFailed(msg);
+
+ var data = 'REFTEST TEST-DEBUG-INFO | ' + msg + ' | image comparison (==)\n' +
+ 'REFTEST IMAGE 1 (TEST): ' + testData + '\n' +
+ 'REFTEST IMAGE 2 (REFERENCE): ' + refData;
+ dump('FAIL: ' + data + '\n');
+ dump('To view the differences between these image renderings, go to the following link: https://hg.mozilla.org/mozilla-central/raw-file/tip/layout/tools/reftest/reftest-analyzer.xhtml#log=' +
+ encodeURIComponent(encodeURIComponent(data)) + '\n');
+}
+
+function arrayToURLData(buf, width, height)
+{
+ var cv = document.createElement('canvas');
+ cv.height = height;
+ cv.width = width;
+ var ctx = cv.getContext('2d');
+ var imgd = ctx.getImageData(0, 0, width, height);
+ for (i = 0; i < height * width; ++i) {
+ offset = i * 4;
+ for (j = 0; j < 4; j++) {
+ imgd.data[offset + j] = buf[offset + j];
+ }
+ }
+ ctx.putImageData(imgd, 0, 0);
+ return cv.toDataURL();
}
function areArraysEqual(_a, _b)
{
try {
if (_a.length !== _b.length)
return false;
for (var i = 0; i < _a.length; i++)

View File

@ -1,107 +0,0 @@
# HG changeset patch
# Parent fae4a63127468bd6447453495c82b9f6713888fb
diff --git a/dom/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html b/dom/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
--- a/dom/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
+++ b/dom/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
@@ -116,16 +116,17 @@ if (!gl) {
testPassed("Successfully enabled OES_standard_derivatives extension");
runSupportedTest(true);
runHintTestEnabled();
runShaderTests(true);
runOutputTests();
runUniqueObjectTest();
+ runReferenceCycleTest();
}
}
function runSupportedTest(extensionEnabled) {
var supported = gl.getSupportedExtensions();
if (supported.indexOf("OES_standard_derivatives") >= 0) {
if (extensionEnabled) {
testPassed("OES_standard_derivatives listed as supported and getExtension succeeded");
@@ -365,16 +366,30 @@ function runUniqueObjectTest()
} else if (window.opera && window.opera.collect) {
window.opera.collect();
} else {
attemptToForceGC();
}
shouldBe('gl.getExtension("OES_standard_derivatives").myProperty', '2');
}
+function runReferenceCycleTest()
+{
+ // create some reference cycles. The goal is to see if they cause leaks. The point is that
+ // some browser test runners have instrumentation to detect leaked refcounted objects.
+
+ debug("Testing reference cycles between context and extension objects");
+ var ext = gl.getExtension("OES_standard_derivatives");
+
+ // create cycle between extension and context, since the context has to hold a reference to the extension
+ ext.context = gl;
+
+ // create a self-cycle on the extension object
+ ext.ext = ext;
+}
debug("");
successfullyParsed = true;
</script>
<script>finishTest();</script>
</body>
</html>
diff --git a/dom/canvas/test/webgl/conformance/extensions/oes-texture-float.html b/dom/canvas/test/webgl/conformance/extensions/oes-texture-float.html
--- a/dom/canvas/test/webgl/conformance/extensions/oes-texture-float.html
+++ b/dom/canvas/test/webgl/conformance/extensions/oes-texture-float.html
@@ -81,16 +81,17 @@ if (!gl) {
if (!gl.getExtension("OES_texture_float")) {
testPassed("No OES_texture_float support -- this is legal");
} else {
testPassed("Successfully enabled OES_texture_float extension");
runTextureCreationTest(testProgram, true);
runRenderTargetTest(testProgram);
runUniqueObjectTest();
+ runReferenceCycleTest();
}
}
// Needs to be global for shouldBe to see it.
var pixels;
function allocateTexture()
{
@@ -206,16 +207,30 @@ function runUniqueObjectTest()
} else if (window.opera && window.opera.collect) {
window.opera.collect();
} else {
attemptToForceGC();
}
shouldBe('gl.getExtension("OES_texture_float").myProperty', '2');
}
+function runReferenceCycleTest()
+{
+ // create some reference cycles. The goal is to see if they cause leaks. The point is that
+ // some browser test runners have instrumentation to detect leaked refcounted objects.
+
+ debug("Testing reference cycles between context and extension objects");
+ var ext = gl.getExtension("OES_texture_float");
+
+ // create cycle between extension and context, since the context has to hold a reference to the extension
+ ext.context = gl;
+
+ // create a self-cycle on the extension object
+ ext.ext = ext;
+}
debug("");
successfullyParsed = true;
</script>
<script>finishTest();</script>
</body>
</html>