| 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 function processMessage(msg) { | 10 function processMessage(msg) { |
| 11 if (window.layoutTestController) { | 11 if (window.layoutTestController) { |
| 12 if (msg == 'unittest-suite-done') { | 12 if (msg == 'unittest-suite-done') { |
| 13 window.layoutTestController.notifyDone(); | 13 window.layoutTestController.notifyDone(); |
| 14 } else if (msg == 'unittest-suite-start') { | 14 } else if (msg == 'unittest-suite-wait-for-done') { |
| 15 window.layoutTestController.startedDartTest = true; | 15 window.layoutTestController.startedDartTest = true; |
| 16 } | 16 } |
| 17 } | 17 } |
| 18 } | 18 } |
| 19 | 19 |
| 20 function onReceive(e) { | 20 function onReceive(e) { |
| 21 processMessage(e.data); | 21 processMessage(e.data); |
| 22 } | 22 } |
| 23 | 23 |
| 24 if (window.layoutTestController) { | 24 if (window.layoutTestController) { |
| 25 window.layoutTestController.dumpAsText(); | 25 window.layoutTestController.dumpAsText(); |
| 26 window.layoutTestController.waitUntilDone(); | 26 window.layoutTestController.waitUntilDone(); |
| 27 } | 27 } |
| 28 window.addEventListener("message", onReceive, false); | 28 window.addEventListener("message", onReceive, false); |
| 29 | 29 |
| 30 function onLoad(e) { | 30 function onLoad(e) { |
| 31 // needed for dartium compilation errors. | 31 // needed for dartium compilation errors. |
| 32 if (window.compilationError) { | 32 if (window.compilationError) { |
| 33 var element = document.createElement('pre'); | 33 var element = document.createElement('pre'); |
| 34 element.innerHTML = window.compilationError; | 34 element.innerHTML = window.compilationError; |
| 35 document.body.appendChild(element); | 35 document.body.appendChild(element); |
| 36 window.layoutTestController.notifyDone(); | 36 window.layoutTestController.notifyDone(); |
| 37 return; | 37 return; |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 | 40 |
| 41 window.addEventListener("DOMContentLoaded", onLoad, false); | 41 window.addEventListener("DOMContentLoaded", onLoad, false); |
| OLD | NEW |