| OLD | NEW |
| 1 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex
t + pixel results | 1 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex
t + pixel results |
| 2 if (self.testRunner) { | 2 if (self.testRunner) { |
| 3 if (self.enablePixelTesting) | 3 if (self.enablePixelTesting) |
| 4 testRunner.dumpAsTextWithPixelResults(); | 4 testRunner.dumpAsTextWithPixelResults(); |
| 5 else | 5 else |
| 6 testRunner.dumpAsText(); | 6 testRunner.dumpAsText(); |
| 7 } | 7 } |
| 8 | 8 |
| 9 var description, debug, successfullyParsed, errorMessage; | 9 var description, debug, successfullyParsed, errorMessage; |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 "font-family: monospace;" + | 66 "font-family: monospace;" + |
| 67 "}"; | 67 "}"; |
| 68 | 68 |
| 69 function insertStyleSheet() | 69 function insertStyleSheet() |
| 70 { | 70 { |
| 71 var styleElement = document.createElement("style"); | 71 var styleElement = document.createElement("style"); |
| 72 styleElement.textContent = css; | 72 styleElement.textContent = css; |
| 73 (document.head || document.documentElement).appendChild(styleElement); | 73 (document.head || document.documentElement).appendChild(styleElement); |
| 74 } | 74 } |
| 75 | 75 |
| 76 function setupFinishHandler() | 76 function handleTestFinished() |
| 77 { | 77 { |
| 78 wasFinishHandlerSetup = true; | 78 // FIXME: Get rid of this boolean. |
| 79 wasPostTestScriptParsed = true; |
| 79 if (window.jsTestIsAsync) { | 80 if (window.jsTestIsAsync) { |
| 80 if (window.testRunner) | 81 if (window.testRunner) |
| 81 testRunner.waitUntilDone(); | 82 testRunner.waitUntilDone(); |
| 82 if (window.wasFinishJSTestCalled) | 83 if (window.wasFinishJSTestCalled) |
| 83 finishJSTest(); | 84 finishJSTest(); |
| 84 } else { | 85 } else |
| 85 // Some tests override the window prototype. | 86 finishJSTest(); |
| 86 if (window.addEventListener) | |
| 87 window.addEventListener('load', finishJSTest, false); | |
| 88 else | |
| 89 finishJSTest(); | |
| 90 } | |
| 91 } | 87 } |
| 92 | 88 |
| 93 if (!isWorker()) { | 89 if (!isWorker()) { |
| 94 // FIXME: Move this to be on the load event so that tests can set jsTest
IsAsync after DOMContentLoaded. | 90 window.addEventListener('DOMContentLoaded', handleTestFinished, false); |
| 95 window.addEventListener('DOMContentLoaded', setupFinishHandler, false); | |
| 96 insertStyleSheet(); | 91 insertStyleSheet(); |
| 97 } | 92 } |
| 98 | 93 |
| 99 if (!self.isOnErrorTest) { | 94 if (!self.isOnErrorTest) { |
| 100 self.onerror = function(message) | 95 self.onerror = function(message) |
| 101 { | 96 { |
| 102 errorMessage = message; | 97 errorMessage = message; |
| 103 }; | 98 }; |
| 104 } | 99 } |
| 105 })(); | 100 })(); |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 function minorGC() { | 587 function minorGC() { |
| 593 if (typeof GCController !== "undefined") | 588 if (typeof GCController !== "undefined") |
| 594 GCController.minorCollect(); | 589 GCController.minorCollect(); |
| 595 else | 590 else |
| 596 testFailed("Minor GC is available only when you enable the --expose-gc o
ption in V8."); | 591 testFailed("Minor GC is available only when you enable the --expose-gc o
ption in V8."); |
| 597 } | 592 } |
| 598 | 593 |
| 599 function isSuccessfullyParsed() | 594 function isSuccessfullyParsed() |
| 600 { | 595 { |
| 601 // FIXME: Remove this and only report unexpected syntax errors. | 596 // FIXME: Remove this and only report unexpected syntax errors. |
| 602 successfullyParsed = !errorMessage; | 597 if (!errorMessage) |
| 598 successfullyParsed = true; |
| 603 shouldBeTrue("successfullyParsed"); | 599 shouldBeTrue("successfullyParsed"); |
| 604 debug('<br /><span class="pass">TEST COMPLETE</span>'); | 600 debug('<br /><span class="pass">TEST COMPLETE</span>'); |
| 605 } | 601 } |
| 606 | 602 |
| 607 // It's possible for an async test to call finishJSTest() before js-test-post.js | 603 // It's possible for an async test to call finishJSTest() before js-test-post.js |
| 608 // has been parsed. | 604 // has been parsed. |
| 609 function finishJSTest() | 605 function finishJSTest() |
| 610 { | 606 { |
| 611 wasFinishJSTestCalled = true; | 607 wasFinishJSTestCalled = true; |
| 612 if (!self.wasFinishHandlerSetup) | 608 if (!self.wasPostTestScriptParsed) |
| 613 return; | 609 return; |
| 614 isSuccessfullyParsed(); | 610 isSuccessfullyParsed(); |
| 615 if (self.jsTestIsAsync && self.testRunner) | 611 if (self.jsTestIsAsync && self.testRunner) |
| 616 testRunner.notifyDone(); | 612 testRunner.notifyDone(); |
| 617 } | 613 } |
| 618 | 614 |
| 619 function startWorker(testScriptURL, shared) | 615 function startWorker(testScriptURL, shared) |
| 620 { | 616 { |
| 621 self.jsTestIsAsync = true; | 617 self.jsTestIsAsync = true; |
| 622 debug('Starting worker: ' + testScriptURL); | 618 debug('Starting worker: ' + testScriptURL); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 testPassed = function(msg) { | 685 testPassed = function(msg) { |
| 690 workerPort.postMessage('PASS:' + msg); | 686 workerPort.postMessage('PASS:' + msg); |
| 691 } | 687 } |
| 692 finishJSTest = function() { | 688 finishJSTest = function() { |
| 693 workerPort.postMessage('DONE:'); | 689 workerPort.postMessage('DONE:'); |
| 694 } | 690 } |
| 695 debug = function(msg) { | 691 debug = function(msg) { |
| 696 workerPort.postMessage(msg); | 692 workerPort.postMessage(msg); |
| 697 } | 693 } |
| 698 } | 694 } |
| OLD | NEW |