| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } | 82 } |
| 83 // To support in browser launching of tests we post back start and result | 83 // To support in browser launching of tests we post back start and result |
| 84 // messages to the window.opener. | 84 // messages to the window.opener. |
| 85 var driver = getDriverWindow(); | 85 var driver = getDriverWindow(); |
| 86 if (driver) { | 86 if (driver) { |
| 87 driver.postMessage(window.document.body.innerHTML, "*"); | 87 driver.postMessage(window.document.body.innerHTML, "*"); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 function processMessage(msg) { | 91 function processMessage(msg) { |
| 92 if (typeof msg != 'string') return; |
| 92 // TODO(ricow): REMOVE, debug info, see issue 13292 | 93 // TODO(ricow): REMOVE, debug info, see issue 13292 |
| 93 if (!testRunner) { | 94 if (!testRunner) { |
| 94 printMessage('processMessage(): ' + msg); | 95 // Filter out ShadowDOM polyfill messages which are random floats. |
| 96 if (msg != parseFloat(msg)) { |
| 97 printMessage('processMessage(): ' + msg); |
| 98 } |
| 95 } | 99 } |
| 96 if (typeof msg != 'string') return; | |
| 97 if (msg == 'unittest-suite-done') { | 100 if (msg == 'unittest-suite-done') { |
| 98 notifyDone(); | 101 notifyDone(); |
| 99 } else if (msg == 'unittest-suite-wait-for-done') { | 102 } else if (msg == 'unittest-suite-wait-for-done') { |
| 100 waitForDone = true; | 103 waitForDone = true; |
| 101 if (testRunner) { | 104 if (testRunner) { |
| 102 testRunner.startedDartTest = true; | 105 testRunner.startedDartTest = true; |
| 103 } | 106 } |
| 104 } else if (msg == 'dart-calling-main') { | 107 } else if (msg == 'dart-calling-main') { |
| 105 if (testRunner) { | 108 if (testRunner) { |
| 106 testRunner.startedDartTest = true; | 109 testRunner.startedDartTest = true; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 try { | 224 try { |
| 222 main(); | 225 main(); |
| 223 } catch (e) { | 226 } catch (e) { |
| 224 dartPrint(e); | 227 dartPrint(e); |
| 225 if (e.stack) dartPrint(e.stack); | 228 if (e.stack) dartPrint(e.stack); |
| 226 window.postMessage('unittest-suite-fail', '*'); | 229 window.postMessage('unittest-suite-fail', '*'); |
| 227 return; | 230 return; |
| 228 } | 231 } |
| 229 dartPrint('dart-main-done'); | 232 dartPrint('dart-main-done'); |
| 230 } | 233 } |
| OLD | NEW |