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 25 matching lines...) Expand all Loading... | |
| 36 if (window.compilationError) { | 36 if (window.compilationError) { |
| 37 var element = document.createElement('pre'); | 37 var element = document.createElement('pre'); |
| 38 element.innerHTML = window.compilationError; | 38 element.innerHTML = window.compilationError; |
| 39 document.body.appendChild(element); | 39 document.body.appendChild(element); |
| 40 window.layoutTestController.notifyDone(); | 40 window.layoutTestController.notifyDone(); |
| 41 return; | 41 return; |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 window.addEventListener("DOMContentLoaded", onLoad, false); | 45 window.addEventListener("DOMContentLoaded", onLoad, false); |
| 46 | |
| 47 // If nobody intercepts the error, finish the test. | |
| 48 window.addEventListener("error", function(e) { | |
| 49 // needed for dartium compilation errors. | |
| 50 if (e && e.message) { | |
| 51 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.
| |
| 52 element.innerHTML = e.message; | |
| 53 document.body.appendChild(element); | |
| 54 } | |
| 55 if (window.layoutTestController) { | |
| 56 window.layoutTestController.notifyDone(); | |
| 57 } | |
| 58 }, false); | |
| 59 | |
| 60 document.onreadystatechange = function() { | |
| 61 if (document.readyState != "loaded") return; | |
| 62 // If 'startedDartTest' is not set, that means that the test did not have | |
| 63 // a chance to load. This will happen when a load error occurs in the VM. | |
| 64 // Give the machine time to start up. | |
| 65 setTimeout(function() { | |
| 66 // A window.postMessage might have been enqueued after this timeout. | |
| 67 // Just sleep another time to give the browser the time to process the | |
| 68 // posted message. | |
| 69 setTimeout(function() { | |
| 70 if (layoutTestController && !layoutTestController.startedDartTest) { | |
| 71 layoutTestController.notifyDone(); | |
| 72 } | |
| 73 }, 0); | |
| 74 }, 50); | |
| 75 }; | |
| OLD | NEW |