| Index: dart/pkg/unittest/test_controller.js
|
| diff --git a/dart/pkg/unittest/test_controller.js b/dart/pkg/unittest/test_controller.js
|
| index 0f797d0e70ab7b426ac1cf238347b26ce86e1df4..ce7a8f0d469ee10bf7536939d94ac0f251a8dd78 100644
|
| --- a/dart/pkg/unittest/test_controller.js
|
| +++ b/dart/pkg/unittest/test_controller.js
|
| @@ -13,26 +13,13 @@ if (navigator.webkitStartDart) {
|
|
|
| var testRunner = window.testRunner || window.layoutTestController;
|
|
|
| -var waitForDone = false;
|
| -
|
| function processMessage(msg) {
|
| - if (typeof msg != 'string') return;
|
| - if (msg == 'unittest-suite-done') {
|
| - if (testRunner) testRunner.notifyDone();
|
| - } else if (msg == 'unittest-suite-wait-for-done') {
|
| - waitForDone = true;
|
| - if (testRunner) testRunner.startedDartTest = true;
|
| - } else if (msg == 'dart-calling-main') {
|
| - if (testRunner) testRunner.startedDartTest = true;
|
| - } else if (msg == 'dart-main-done') {
|
| - if (!waitForDone) {
|
| - window.postMessage('unittest-suite-success', '*');
|
| + if (testRunner) {
|
| + if (msg == 'unittest-suite-done') {
|
| + testRunner.notifyDone();
|
| + } else if (msg == 'unittest-suite-wait-for-done') {
|
| + testRunner.startedDartTest = true;
|
| }
|
| - } else if (msg == 'unittest-suite-success') {
|
| - document.body.innerHTML += '<pre>PASS</pre>';
|
| - if (testRunner) testRunner.notifyDone();
|
| - } else if (msg == 'unittest-suite-fail') {
|
| - showErrorAndExit('Some tests failed.');
|
| }
|
| }
|
|
|
| @@ -72,7 +59,7 @@ window.addEventListener("error", function(e) {
|
| showErrorAndExit(e && e.message);
|
| }, false);
|
|
|
| -document.addEventListener('readystatechange', function () {
|
| +document.onreadystatechange = function() {
|
| if (document.readyState != "loaded") return;
|
| // If 'startedDartTest' is not set, that means that the test did not have
|
| // a chance to load. This will happen when a load error occurs in the VM.
|
| @@ -87,33 +74,4 @@ document.addEventListener('readystatechange', function () {
|
| }
|
| }, 0);
|
| }, 50);
|
| -});
|
| -
|
| -// dart2js will generate code to call this function to handle the Dart
|
| -// [print] method. The base [Configuration] (config.html) calls
|
| -// [print] with the secret messages "unittest-suite-success" and
|
| -// "unittest-suite-wait-for-done". These messages are then posted so
|
| -// processMessage above will see them.
|
| -function dartPrint(msg) {
|
| - if ((msg === 'unittest-suite-success')
|
| - || (msg === 'unittest-suite-wait-for-done')) {
|
| - window.postMessage(msg, '*');
|
| - return;
|
| - }
|
| - var pre = document.createElement("pre");
|
| - pre.appendChild(document.createTextNode(String(msg)));
|
| - document.body.appendChild(pre);
|
| -}
|
| -
|
| -// dart2js will generate code to call this function instead of calling
|
| -// Dart [main] directly. The argument is a closure that invokes main.
|
| -function dartMainRunner(main) {
|
| - window.postMessage('dart-calling-main', '*');
|
| - try {
|
| - main();
|
| - } catch (e) {
|
| - window.postMessage('unittest-suite-fail', '*');
|
| - return; // Posting 'dart-main-done' signals success.
|
| - }
|
| - window.postMessage('dart-main-done', '*');
|
| -}
|
| +};
|
|
|