Chromium Code Reviews| 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. | |
| 11 if (typeof console == "object" && typeof console.clear == "function") { | |
| 12 console.clear(); | |
|
ahe
2012/10/30 09:48:51
Unfortunately, I only think this works in Firebug.
| |
| 13 } | |
| 14 | |
| 15 // Set window onerror to make sure that we catch test harness errors across all | |
| 16 // browsers. | |
| 17 window.onerror = function (message, url, lineNumber) { | |
| 18 showErrorAndExit("\n\n" + url + ":" + lineNumber + ":\n" + message + "\n\n"); | |
| 19 window.postMessage('unittest-suite-external-error', '*'); | |
| 20 }; | |
| 21 | |
| 10 if (navigator.webkitStartDart) { | 22 if (navigator.webkitStartDart) { |
| 11 navigator.webkitStartDart(); | 23 navigator.webkitStartDart(); |
| 12 } | 24 } |
| 13 | 25 |
| 14 // testRunner is provided by DRT or WebKit's layout tests. | 26 // testRunner is provided by DRT or WebKit's layout tests. |
| 15 // It is not available in selenium tests. | 27 // It is not available in selenium tests. |
| 16 var testRunner = window.testRunner || window.layoutTestController; | 28 var testRunner = window.testRunner || window.layoutTestController; |
| 17 | 29 |
| 18 var waitForDone = false; | 30 var waitForDone = false; |
| 19 | 31 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 function dartMainRunner(main) { | 124 function dartMainRunner(main) { |
| 113 window.postMessage('dart-calling-main', '*'); | 125 window.postMessage('dart-calling-main', '*'); |
| 114 try { | 126 try { |
| 115 main(); | 127 main(); |
| 116 } catch (e) { | 128 } catch (e) { |
| 117 window.postMessage('unittest-suite-fail', '*'); | 129 window.postMessage('unittest-suite-fail', '*'); |
| 118 return; | 130 return; |
| 119 } | 131 } |
| 120 window.postMessage('dart-main-done', '*'); | 132 window.postMessage('dart-main-done', '*'); |
| 121 } | 133 } |
| OLD | NEW |