Chromium Code Reviews| Index: lib/unittest/test_controller.js |
| diff --git a/lib/unittest/test_controller.js b/lib/unittest/test_controller.js |
| index 988bfe10fd704039b33116d3ed407854c6d99ca7..d2dabee2139c614be4abb5506422409b91296f45 100644 |
| --- a/lib/unittest/test_controller.js |
| +++ b/lib/unittest/test_controller.js |
| @@ -43,3 +43,33 @@ function onLoad(e) { |
| } |
| window.addEventListener("DOMContentLoaded", onLoad, false); |
| + |
| +// If nobody intercepts the error, finish the test. |
| +window.addEventListener("error", function(e) { |
| + // needed for dartium compilation errors. |
| + if (e && e.message) { |
| + var element = document.createElement('pre'); |
|
Anton Muhin
2012/06/21 14:39:48
It might be worth to refactor failure dealing code
Siggi Cherem (dart-lang)
2012/06/21 15:32:20
Done.
|
| + element.innerHTML = e.message; |
| + document.body.appendChild(element); |
| + } |
| + if (window.layoutTestController) { |
| + window.layoutTestController.notifyDone(); |
| + } |
| +}, false); |
| + |
| +document.onreadystatechange = function() { |
| + if (document.readyState != "loaded") return; |
| + // If 'startedDartTest' is not set, that means that the test did not have |
| + // a chance to load. This will happen when a load error occurs in the VM. |
| + // Give the machine time to start up. |
| + setTimeout(function() { |
| + // A window.postMessage might have been enqueued after this timeout. |
| + // Just sleep another time to give the browser the time to process the |
| + // posted message. |
| + setTimeout(function() { |
| + if (layoutTestController && !layoutTestController.startedDartTest) { |
| + layoutTestController.notifyDone(); |
| + } |
| + }, 0); |
| + }, 50); |
| +}; |