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 if (navigator.webkitStartDart) { | 10 if (navigator.webkitStartDart) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 // A window.postMessage might have been enqueued after this timeout. | 68 // A window.postMessage might have been enqueued after this timeout. |
| 69 // Just sleep another time to give the browser the time to process the | 69 // Just sleep another time to give the browser the time to process the |
| 70 // posted message. | 70 // posted message. |
| 71 setTimeout(function() { | 71 setTimeout(function() { |
| 72 if (testRunner && !testRunner.startedDartTest) { | 72 if (testRunner && !testRunner.startedDartTest) { |
| 73 testRunner.notifyDone(); | 73 testRunner.notifyDone(); |
| 74 } | 74 } |
| 75 }, 0); | 75 }, 0); |
| 76 }, 50); | 76 }, 50); |
| 77 }; | 77 }; |
| 78 | |
| 79 function dartMainRunner(main) { | |
| 80 var caughtError; | |
| 81 function handleError(e) { caughtError = e; } | |
| 82 | |
| 83 window.postMessage('unittest-suite-wait-for-done', '*'); | |
| 84 window.addEventListener('error', handleError, false); | |
| 85 main(); | |
|
kasperl
2012/09/06 10:29:29
We have had issues with uncaught JavaScript except
ahe
2012/09/08 13:32:32
I think that is handled by 'window.addEventListene
| |
| 86 window.removeEventListener('error', handleError, false); | |
| 87 if (typeof caughtError != 'undefined') { | |
| 88 document.body.innerHTML = String(caughtError); | |
| 89 } else { | |
| 90 document.body.innerHTML = "PASS"; | |
| 91 } | |
| 92 window.postMessage('unittest-suite-done', '*'); | |
| 93 } | |
| OLD | NEW |