diff --git a/conformance-suites/2.0.0/js/js-test-pre.js b/conformance-suites/2.0.0/js/js-test-pre.js index df30a6f..7ca8559 100644 --- a/conformance-suites/2.0.0/js/js-test-pre.js +++ b/conformance-suites/2.0.0/js/js-test-pre.js @@ -111,11 +111,25 @@ function nonKhronosFrameworkNotifyDone() { } } -function reportTestResultsToHarness(success, msg) { - if (window.parent.webglTestHarness) { - window.parent.webglTestHarness.reportResults(window.location.pathname, success, msg); - } -} +(function() { + var WPT_TEST_ID = 0; + + // Store the current WPT test harness `test` function + // if found, since it's overriden by some tests. + var wpt_test = window.test; + var wpt_assert_true = window.assert_true; + var wt_async_test = window.async_test; + + window.reportTestResultsToHarness = function reportTestResultsToHarness(success, msg) { + if (window.parent.webglTestHarness) { + window.parent.webglTestHarness.reportResults(window.location.pathname, success, msg); + } else if (wpt_test) { // WPT test harness + wpt_test(function () { + wpt_assert_true(success, msg); + }, "WebGL test #" + (WPT_TEST_ID++) + ": " + msg); + } + } + }()) function reportSkippedTestResultsToHarness(success, msg) { if (window.parent.webglTestHarness) { @@ -132,6 +146,12 @@ function notifyFinishedToHarness() { } } +(function() { + var oldNotify = notifyFinishedToHarness; + var t = async_test("Overall test"); + window.notifyFinishedToHarness = t.step_func_done(oldNotify); +}()) + var _bufferedConsoleLogs = []; function _bufferedLogToConsole(msg) @@ -162,7 +182,7 @@ function _flushBufferedLogsToConsole() } } -var _jsTestPreVerboseLogging = false; +var _jsTestPreVerboseLogging = true; function enableJSTestPreVerboseLogging() { @@ -175,24 +195,12 @@ function description(msg) if (msg === undefined) { msg = document.title; } - // For MSIE 6 compatibility - var span = document.createElement("span"); - span.innerHTML = '
' + msg + '
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
'; - var description = document.getElementById("description"); - if (description.firstChild) - description.replaceChild(span, description.firstChild); - else - description.appendChild(span); - if (_jsTestPreVerboseLogging) { - _bufferedLogToConsole(msg); - } + + _bufferedLogToConsole("DESCRIPTION: " +msg); } function _addSpan(contents) { - var span = document.createElement("span"); - document.getElementById("console").appendChild(span); // insert it first so XHTML knows the namespace - span.innerHTML = contents + '