diff --git a/test/harness/helper.js b/test/harness/helper.js index 28d340501604d0e3d0e0fb5b939f7c75987762ed..fb3d044283459046907fe0555101a3bd94793779 100644 --- a/test/harness/helper.js +++ b/test/harness/helper.js @@ -289,9 +289,9 @@ function Presenter() { renderCurrentSection(); } - this.finished = function() { + this.finished = function(elapsed) { $('.button-start').attr('src', 'resources/images/start.png'); - activityBar.text(''); + activityBar.text('Overall Execution Time: ' + elapsed + ' minutes'); } /* Refresh display of the report */ diff --git a/test/harness/sta.js b/test/harness/sta.js index 90a8c6e0c1ecb1127e48eae81294f978bb3aab0f..fd3873438a1a107b0478900ecd51ec0e09d68865 100644 --- a/test/harness/sta.js +++ b/test/harness/sta.js @@ -38,7 +38,7 @@ function compareArray(aExpected, aActual) { } return true; } -SimpleTestAPIs.append(compareArray); +SimpleTestAPIs.push(compareArray); //----------------------------------------------------------------------------- function arrayContains(arr, expected) { @@ -57,7 +57,7 @@ function arrayContains(arr, expected) { } return true; } -SimpleTestAPIs.append(arrayContains); +SimpleTestAPIs.push(arrayContains); //----------------------------------------------------------------------------- var supportsArrayIndexGettersOnArrays = undefined; @@ -81,7 +81,7 @@ function fnSupportsArrayIndexGettersOnArrays() { return supportsArrayIndexGettersOnArrays; } -SimpleTestAPIs.append(fnSupportsArrayIndexGettersOnArrays); +SimpleTestAPIs.push(fnSupportsArrayIndexGettersOnArrays); //----------------------------------------------------------------------------- var supportsArrayIndexGettersOnObjects = undefined; @@ -104,13 +104,13 @@ function fnSupportsArrayIndexGettersOnObjects() { return supportsArrayIndexGettersOnObjects; } -SimpleTestAPIs.append(fnSupportsArrayIndexGettersOnObjects); +SimpleTestAPIs.push(fnSupportsArrayIndexGettersOnObjects); //----------------------------------------------------------------------------- function ConvertToFileUrl(pathStr) { return "file:" + pathStr.replace(/\\/g, "/"); } -SimpleTestAPIs.append(ConvertToFileUrl); +SimpleTestAPIs.push(ConvertToFileUrl); //----------------------------------------------------------------------------- function fnExists(/*arguments*/) { @@ -119,7 +119,7 @@ function fnExists(/*arguments*/) { } return true; } -SimpleTestAPIs.append(fnExists); +SimpleTestAPIs.push(fnExists); //----------------------------------------------------------------------------- var supportsStrict = undefined; @@ -137,13 +137,13 @@ function fnSupportsStrict() { } return supportsStrict; } -SimpleTestAPIs.append(fnSupportsStrict); +SimpleTestAPIs.push(fnSupportsStrict); //----------------------------------------------------------------------------- function fnGlobalObject() { return (function() { return this }).call(null); } -SimpleTestAPIs.append(fnGlobalObject); +SimpleTestAPIs.push(fnGlobalObject); //----------------------------------------------------------------------------- //Verify all attributes specified data property of given object: value, writable, enumerable, configurable @@ -207,7 +207,7 @@ function dataPropertyAttributesAreCorrect(obj, name, value, writable, enumerable return attributesCorrect; } -SimpleTestAPIs.append(dataPropertyAttributesAreCorrect); +SimpleTestAPIs.push(dataPropertyAttributesAreCorrect); //----------------------------------------------------------------------------- //Verify all attributes specified accessor property of given object: get, set, enumerable, configurable @@ -273,4 +273,6 @@ function accessorPropertyAttributesAreCorrect(obj, name, get, set, setVerifyHelp return attributesCorrect; } -SimpleTestAPIs.append(accessorPropertyAttributesAreCorrect); \ No newline at end of file +SimpleTestAPIs.push(accessorPropertyAttributesAreCorrect); +//----------------------------------------------------------------------------- +var PickledSimpleTestAPIs = SimpleTestAPIs.join(" "); \ No newline at end of file diff --git a/test/harness/sth.js b/test/harness/sth.js index 35729e70a591a2d8bab7f8bb849617f1673a274b..40bd303bdc36d339f4cef9f6c36bfcf2798057e1 100644 --- a/test/harness/sth.js +++ b/test/harness/sth.js @@ -91,20 +91,12 @@ function BrowserRunner() { // Set up some globals. win.testRun = testRun; win.testFinished = testFinished; - win.fnSupportsStrict = fnSupportsStrict; - win.fnExists = fnExists; - win.ConvertToFileUrl = ConvertToFileUrl; - win.fnSupportsArrayIndexGettersOnObjects = fnSupportsArrayIndexGettersOnObjects; - win.fnSupportsArrayIndexGettersOnArrays = fnSupportsArrayIndexGettersOnArrays; - win.arrayContains = arrayContains; - win.compareArray = compareArray; + //TODO: these should be moved to sta.js win.SputnikError = SputnikError; win.$ERROR = $ERROR; win.$FAIL = $FAIL; win.$PRINT = function () {}; win.$INCLUDE = function() {}; - win.dataPropertyAttributesAreCorrect = dataPropertyAttributesAreCorrect; - win.accessorPropertyAttributesAreCorrect = accessorPropertyAttributesAreCorrect; if(includes !== null) { // We have some includes, so loop through each include and pull in the dependencies. @@ -125,6 +117,10 @@ function BrowserRunner() { } } + //Write out all of our helper functions + doc.writeln("<script type='text/javascript'>" + PickledSimpleTestAPIs + "</script>"); + + // Write ES5Harness.registerTest and fnGlobalObject, which returns the global object, and the testFinished call. doc.writeln("<script type='text/javascript'>ES5Harness = {};" + "function fnGlobalObject() { return window; }" + @@ -243,6 +239,8 @@ function Controller() { var runner = new BrowserRunner(); var loader = new TestLoader(); var controller = this; + var startTime; + var elapsed = 0; runner.onComplete = function(test) { presenter.addTestResult(test); @@ -268,21 +266,28 @@ function Controller() { loader.onTestsExhausted = function() { state = 'stopped'; - presenter.finished(); + elapsed += new Date() - startTime; + elapsed = elapsed/(1000*60); //minutes + elapsed = elapsed.toFixed(1); + presenter.finished(elapsed); } this.start = function() { state = 'running'; + startTime = new Date(); loader.getNextTest(); presenter.started(); } this.pause = function() { + elapsed += new Date() - startTime; state = 'paused'; presenter.paused(); } this.reset = function() { + startTime = new Date(); + elapsed = 0; loader.reset(); presenter.reset(); } diff --git a/website/resources/scripts/global/helper.js b/website/resources/scripts/global/helper.js index 28d340501604d0e3d0e0fb5b939f7c75987762ed..fb3d044283459046907fe0555101a3bd94793779 100644 --- a/website/resources/scripts/global/helper.js +++ b/website/resources/scripts/global/helper.js @@ -289,9 +289,9 @@ function Presenter() { renderCurrentSection(); } - this.finished = function() { + this.finished = function(elapsed) { $('.button-start').attr('src', 'resources/images/start.png'); - activityBar.text(''); + activityBar.text('Overall Execution Time: ' + elapsed + ' minutes'); } /* Refresh display of the report */ diff --git a/website/resources/scripts/global/sta.js b/website/resources/scripts/global/sta.js index 90a8c6e0c1ecb1127e48eae81294f978bb3aab0f..fd3873438a1a107b0478900ecd51ec0e09d68865 100644 --- a/website/resources/scripts/global/sta.js +++ b/website/resources/scripts/global/sta.js @@ -38,7 +38,7 @@ function compareArray(aExpected, aActual) { } return true; } -SimpleTestAPIs.append(compareArray); +SimpleTestAPIs.push(compareArray); //----------------------------------------------------------------------------- function arrayContains(arr, expected) { @@ -57,7 +57,7 @@ function arrayContains(arr, expected) { } return true; } -SimpleTestAPIs.append(arrayContains); +SimpleTestAPIs.push(arrayContains); //----------------------------------------------------------------------------- var supportsArrayIndexGettersOnArrays = undefined; @@ -81,7 +81,7 @@ function fnSupportsArrayIndexGettersOnArrays() { return supportsArrayIndexGettersOnArrays; } -SimpleTestAPIs.append(fnSupportsArrayIndexGettersOnArrays); +SimpleTestAPIs.push(fnSupportsArrayIndexGettersOnArrays); //----------------------------------------------------------------------------- var supportsArrayIndexGettersOnObjects = undefined; @@ -104,13 +104,13 @@ function fnSupportsArrayIndexGettersOnObjects() { return supportsArrayIndexGettersOnObjects; } -SimpleTestAPIs.append(fnSupportsArrayIndexGettersOnObjects); +SimpleTestAPIs.push(fnSupportsArrayIndexGettersOnObjects); //----------------------------------------------------------------------------- function ConvertToFileUrl(pathStr) { return "file:" + pathStr.replace(/\\/g, "/"); } -SimpleTestAPIs.append(ConvertToFileUrl); +SimpleTestAPIs.push(ConvertToFileUrl); //----------------------------------------------------------------------------- function fnExists(/*arguments*/) { @@ -119,7 +119,7 @@ function fnExists(/*arguments*/) { } return true; } -SimpleTestAPIs.append(fnExists); +SimpleTestAPIs.push(fnExists); //----------------------------------------------------------------------------- var supportsStrict = undefined; @@ -137,13 +137,13 @@ function fnSupportsStrict() { } return supportsStrict; } -SimpleTestAPIs.append(fnSupportsStrict); +SimpleTestAPIs.push(fnSupportsStrict); //----------------------------------------------------------------------------- function fnGlobalObject() { return (function() { return this }).call(null); } -SimpleTestAPIs.append(fnGlobalObject); +SimpleTestAPIs.push(fnGlobalObject); //----------------------------------------------------------------------------- //Verify all attributes specified data property of given object: value, writable, enumerable, configurable @@ -207,7 +207,7 @@ function dataPropertyAttributesAreCorrect(obj, name, value, writable, enumerable return attributesCorrect; } -SimpleTestAPIs.append(dataPropertyAttributesAreCorrect); +SimpleTestAPIs.push(dataPropertyAttributesAreCorrect); //----------------------------------------------------------------------------- //Verify all attributes specified accessor property of given object: get, set, enumerable, configurable @@ -273,4 +273,6 @@ function accessorPropertyAttributesAreCorrect(obj, name, get, set, setVerifyHelp return attributesCorrect; } -SimpleTestAPIs.append(accessorPropertyAttributesAreCorrect); \ No newline at end of file +SimpleTestAPIs.push(accessorPropertyAttributesAreCorrect); +//----------------------------------------------------------------------------- +var PickledSimpleTestAPIs = SimpleTestAPIs.join(" "); \ No newline at end of file diff --git a/website/resources/scripts/global/sth.js b/website/resources/scripts/global/sth.js index 35729e70a591a2d8bab7f8bb849617f1673a274b..40bd303bdc36d339f4cef9f6c36bfcf2798057e1 100644 --- a/website/resources/scripts/global/sth.js +++ b/website/resources/scripts/global/sth.js @@ -91,20 +91,12 @@ function BrowserRunner() { // Set up some globals. win.testRun = testRun; win.testFinished = testFinished; - win.fnSupportsStrict = fnSupportsStrict; - win.fnExists = fnExists; - win.ConvertToFileUrl = ConvertToFileUrl; - win.fnSupportsArrayIndexGettersOnObjects = fnSupportsArrayIndexGettersOnObjects; - win.fnSupportsArrayIndexGettersOnArrays = fnSupportsArrayIndexGettersOnArrays; - win.arrayContains = arrayContains; - win.compareArray = compareArray; + //TODO: these should be moved to sta.js win.SputnikError = SputnikError; win.$ERROR = $ERROR; win.$FAIL = $FAIL; win.$PRINT = function () {}; win.$INCLUDE = function() {}; - win.dataPropertyAttributesAreCorrect = dataPropertyAttributesAreCorrect; - win.accessorPropertyAttributesAreCorrect = accessorPropertyAttributesAreCorrect; if(includes !== null) { // We have some includes, so loop through each include and pull in the dependencies. @@ -125,6 +117,10 @@ function BrowserRunner() { } } + //Write out all of our helper functions + doc.writeln("<script type='text/javascript'>" + PickledSimpleTestAPIs + "</script>"); + + // Write ES5Harness.registerTest and fnGlobalObject, which returns the global object, and the testFinished call. doc.writeln("<script type='text/javascript'>ES5Harness = {};" + "function fnGlobalObject() { return window; }" + @@ -243,6 +239,8 @@ function Controller() { var runner = new BrowserRunner(); var loader = new TestLoader(); var controller = this; + var startTime; + var elapsed = 0; runner.onComplete = function(test) { presenter.addTestResult(test); @@ -268,21 +266,28 @@ function Controller() { loader.onTestsExhausted = function() { state = 'stopped'; - presenter.finished(); + elapsed += new Date() - startTime; + elapsed = elapsed/(1000*60); //minutes + elapsed = elapsed.toFixed(1); + presenter.finished(elapsed); } this.start = function() { state = 'running'; + startTime = new Date(); loader.getNextTest(); presenter.started(); } this.pause = function() { + elapsed += new Date() - startTime; state = 'paused'; presenter.paused(); } this.reset = function() { + startTime = new Date(); + elapsed = 0; loader.reset(); presenter.reset(); }