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 * conent shell. | 7 * conent shell. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 // Clear the console before every test run - this is Firebug specific code. | 10 // Clear the console before every test run - this is Firebug specific code. |
| 11 if (typeof console == "object" && typeof console.clear == "function") { | 11 if (typeof console == "object" && typeof console.clear == "function") { |
| 12 console.clear(); | 12 console.clear(); |
| 13 } | 13 } |
| 14 // Set window onerror to make sure that we catch test harness errors across all | 14 // Set window onerror to make sure that we catch test harness errors across all |
| 15 // browsers. | 15 // browsers. |
| 16 window.onerror = function (message, url, lineNumber) { | 16 window.onerror = function (message, url, lineNumber) { |
| 17 if (url) { | 17 if (url) { |
| 18 showErrorAndExit( | 18 showErrorAndExit( |
| 19 "\n\n" + url + ":" + lineNumber + ":\n" + message + "\n\n"); | 19 "\n\n" + url + ":" + lineNumber + ":\n" + message + "\n\n"); |
| 20 } else { | 20 } else { |
| 21 showErrorAndExit(message); | 21 showErrorAndExit(message); |
| 22 } | 22 } |
| 23 window.postMessage('unittest-suite-external-error', '*'); | 23 window.postMessage('unittest-suite-external-error', '*'); |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 if (navigator.webkitStartDart) { | 26 // Start Dartium/content_shell, unless we are waiting for HTML Imports to load. |
| 27 if (navigator.webkitStartDart && !window.HTMLImports) { | |
|
Siggi Cherem (dart-lang)
2013/08/28 19:46:51
mmm. I worry there might be cases where people use
Jennifer Messerly
2013/08/28 19:56:04
Chatted in person ... we should really move some o
| |
| 27 navigator.webkitStartDart(); | 28 navigator.webkitStartDart(); |
| 28 } | 29 } |
| 29 | 30 |
| 30 // testRunner is provided by content shell. | 31 // testRunner is provided by content shell. |
| 31 // It is not available in selenium tests. | 32 // It is not available in selenium tests. |
| 32 var testRunner = window.testRunner || window.layoutTestController; | 33 var testRunner = window.testRunner || window.layoutTestController; |
| 33 | 34 |
| 34 var waitForDone = false; | 35 var waitForDone = false; |
| 35 | 36 |
| 36 // Returns the driving window object if available | 37 // Returns the driving window object if available |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 try { | 165 try { |
| 165 main(); | 166 main(); |
| 166 } catch (e) { | 167 } catch (e) { |
| 167 dartPrint(e); | 168 dartPrint(e); |
| 168 if (e.stack) dartPrint(e.stack); | 169 if (e.stack) dartPrint(e.stack); |
| 169 window.postMessage('unittest-suite-fail', '*'); | 170 window.postMessage('unittest-suite-fail', '*'); |
| 170 return; | 171 return; |
| 171 } | 172 } |
| 172 window.postMessage('dart-main-done', '*'); | 173 window.postMessage('dart-main-done', '*'); |
| 173 } | 174 } |
| OLD | NEW |