| 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 * DumpRenderTree. | 7 * DumpRenderTree. |
| 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. |
| 11 if (typeof console == "object" && typeof console.clear == "function") { | 11 if (typeof console == "object" && typeof console.clear == "function") { |
| 12 console.clear(); | 12 console.clear(); |
| 13 } | 13 } |
| 14 // Set window onerror to make sure that we catch test harness errors across all | 14 // Set window onerror to make sure that we catch test harness errors across all |
| 15 // browsers. | 15 // browsers. |
| 16 window.onerror = function (message, url, lineNumber) { | 16 window.onerror = function (message, url, lineNumber) { |
| 17 showErrorAndExit("\n\n" + url + ":" + lineNumber + ":\n" + message + "\n\n"); | 17 if (url) { |
| 18 showErrorAndExit( |
| 19 "\n\n" + url + ":" + lineNumber + ":\n" + message + "\n\n"); |
| 20 } else { |
| 21 showErrorAndExit(message); |
| 22 } |
| 18 window.postMessage('unittest-suite-external-error', '*'); | 23 window.postMessage('unittest-suite-external-error', '*'); |
| 19 }; | 24 }; |
| 20 | 25 |
| 21 if (navigator.webkitStartDart) { | 26 if (navigator.webkitStartDart) { |
| 22 navigator.webkitStartDart(); | 27 navigator.webkitStartDart(); |
| 23 } | 28 } |
| 24 | 29 |
| 25 // testRunner is provided by DRT or WebKit's layout tests. | 30 // testRunner is provided by DRT or WebKit's layout tests. |
| 26 // It is not available in selenium tests. | 31 // It is not available in selenium tests. |
| 27 var testRunner = window.testRunner || window.layoutTestController; | 32 var testRunner = window.testRunner || window.layoutTestController; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 function dartMainRunner(main) { | 128 function dartMainRunner(main) { |
| 124 window.postMessage('dart-calling-main', '*'); | 129 window.postMessage('dart-calling-main', '*'); |
| 125 try { | 130 try { |
| 126 main(); | 131 main(); |
| 127 } catch (e) { | 132 } catch (e) { |
| 128 window.postMessage('unittest-suite-fail', '*'); | 133 window.postMessage('unittest-suite-fail', '*'); |
| 129 return; | 134 return; |
| 130 } | 135 } |
| 131 window.postMessage('dart-main-done', '*'); | 136 window.postMessage('dart-main-done', '*'); |
| 132 } | 137 } |
| OLD | NEW |