| 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 * A simple unit test library for running tests in a browser. | 6 * A simple unit test library for running tests in a browser. |
| 7 * | 7 * |
| 8 * Provides enhanced HTML output with collapsible group headers | 8 * Provides enhanced HTML output with collapsible group headers |
| 9 * and other at-a-glance information about the test results. | 9 * and other at-a-glance information about the test results. |
| 10 */ | 10 */ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 var cssElement = document.head.query('#${_CSSID}'); | 29 var cssElement = document.head.query('#${_CSSID}'); |
| 30 if (cssElement == null){ | 30 if (cssElement == null){ |
| 31 document.head.elements.add(new Element.html( | 31 document.head.elements.add(new Element.html( |
| 32 '<style id="${_CSSID}"></style>')); | 32 '<style id="${_CSSID}"></style>')); |
| 33 cssElement = document.head.query('#${_CSSID}'); | 33 cssElement = document.head.query('#${_CSSID}'); |
| 34 } | 34 } |
| 35 | 35 |
| 36 cssElement.innerHTML = _htmlTestCSS; | 36 cssElement.innerHTML = _htmlTestCSS; |
| 37 | 37 |
| 38 _onErrorClosure = (e) { | 38 _onErrorClosure = |
| 39 // TODO(vsm): figure out how to expose the stack trace here | 39 (e) => handleExternalError(e, '(DOM callback has errors)'); |
| 40 // Currently e.message works in dartium, but not in dartc. | |
| 41 reportTestError('(DOM callback has errors) Caught ${e}', ''); | |
| 42 }; | |
| 43 } | 40 } |
| 44 | 41 |
| 45 void onStart() { | 42 void onStart() { |
| 46 window.postMessage('unittest-suite-wait-for-done', '*'); | 43 window.postMessage('unittest-suite-wait-for-done', '*'); |
| 47 // Listen for uncaught errors. | 44 // Listen for uncaught errors. |
| 48 window.on.error.add(_onErrorClosure); | 45 window.on.error.add(_onErrorClosure); |
| 49 } | 46 } |
| 50 | 47 |
| 51 void onTestResult(TestCase testCase) {} | 48 void onTestResult(TestCase testCase) {} |
| 52 | 49 |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 .unittest-row-description | 361 .unittest-row-description |
| 365 { | 362 { |
| 366 } | 363 } |
| 367 | 364 |
| 368 '''; | 365 '''; |
| 369 } | 366 } |
| 370 | 367 |
| 371 void useHtmlEnhancedConfiguration([bool isLayoutTest = false]) { | 368 void useHtmlEnhancedConfiguration([bool isLayoutTest = false]) { |
| 372 configure(new HtmlEnhancedConfiguration(isLayoutTest)); | 369 configure(new HtmlEnhancedConfiguration(isLayoutTest)); |
| 373 } | 370 } |
| OLD | NEW |