| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Test controller logic - used by unit test harness to embed tests in | 6 * Test controller logic - used by unit test harness to embed tests in |
| 7 * conent shell. | 7 * conent shell. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 // Clear the console before every test run - this is Firebug specific code. | 10 // Clear the console before every test run - this is Firebug specific code. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 function processMessage(msg) { | 91 function processMessage(msg) { |
| 92 // TODO(ricow): REMOVE, debug info, see issue 13292 | 92 // TODO(ricow): REMOVE, debug info, see issue 13292 |
| 93 if (!testRunner) { | 93 if (!testRunner) { |
| 94 printMessage('processMessage(): ' + msg); | 94 printMessage('processMessage(): ' + msg); |
| 95 } | 95 } |
| 96 if (typeof msg != 'string') return; | 96 if (typeof msg != 'string') return; |
| 97 if (msg == 'unittest-suite-done') { | 97 if (msg == 'unittest-suite-done') { |
| 98 notifyDone(); | 98 notifyDone(); |
| 99 } else if (msg == 'unittest-suite-wait-for-done') { | 99 } else if (msg == 'unittest-suite-wait-for-done') { |
| 100 waitForDone = true; | 100 waitForDone = true; |
| 101 if (testRunner) testRunner.startedDartTest = true; | 101 if (testRunner) { |
| 102 testRunner.startedDartTest = true; |
| 103 } |
| 102 } else if (msg == 'dart-calling-main') { | 104 } else if (msg == 'dart-calling-main') { |
| 103 if (testRunner) testRunner.startedDartTest = true; | 105 if (testRunner) { |
| 106 testRunner.startedDartTest = true; |
| 107 } |
| 104 } else if (msg == 'dart-main-done') { | 108 } else if (msg == 'dart-main-done') { |
| 105 if (!waitForDone) { | 109 if (!waitForDone) { |
| 106 window.postMessage('unittest-suite-success', '*'); | 110 printMessage('PASS'); |
| 111 notifyDone(); |
| 107 } | 112 } |
| 108 } else if (msg == 'unittest-suite-success') { | 113 } else if (msg == 'unittest-suite-success') { |
| 109 printMessage('PASS'); | 114 printMessage('PASS'); |
| 110 notifyDone(); | 115 notifyDone(); |
| 111 } else if (msg == 'unittest-suite-fail') { | 116 } else if (msg == 'unittest-suite-fail') { |
| 112 showErrorAndExit('Some tests failed.'); | 117 showErrorAndExit('Some tests failed.'); |
| 113 } | 118 } |
| 114 } | 119 } |
| 115 | 120 |
| 116 function onReceive(e) { | 121 function onReceive(e) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 try { | 221 try { |
| 217 main(); | 222 main(); |
| 218 } catch (e) { | 223 } catch (e) { |
| 219 dartPrint(e); | 224 dartPrint(e); |
| 220 if (e.stack) dartPrint(e.stack); | 225 if (e.stack) dartPrint(e.stack); |
| 221 window.postMessage('unittest-suite-fail', '*'); | 226 window.postMessage('unittest-suite-fail', '*'); |
| 222 return; | 227 return; |
| 223 } | 228 } |
| 224 dartPrint('dart-main-done'); | 229 dartPrint('dart-main-done'); |
| 225 } | 230 } |
| OLD | NEW |