| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 window.postMessage('unittest-suite-wait-for-done', '*'); | 69 window.postMessage('unittest-suite-wait-for-done', '*'); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void onStart() { | 72 void onStart() { |
| 73 // Listen for uncaught errors. | 73 // Listen for uncaught errors. |
| 74 window.on.error.add(_onErrorClosure); | 74 window.on.error.add(_onErrorClosure); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void onTestResult(TestCase testCase) {} | 77 void onTestResult(TestCase testCase) {} |
| 78 | 78 |
| 79 void onDone(int passed, int failed, int errors, List<TestCase> results, | 79 void onSummary(int passed, int failed, int errors, List<TestCase> results, |
| 80 String uncaughtError) { | 80 String uncaughtError) { |
| 81 _uninstallHandlers(); | |
| 82 | |
| 83 _showInteractiveResultsInPage(passed, failed, errors, results, | 81 _showInteractiveResultsInPage(passed, failed, errors, results, |
| 84 _isLayoutTest, uncaughtError); | 82 _isLayoutTest, uncaughtError); |
| 83 } |
| 85 | 84 |
| 85 void onDone(bool success) { |
| 86 _uninstallHandlers(); |
| 86 window.postMessage('unittest-suite-done', '*'); | 87 window.postMessage('unittest-suite-done', '*'); |
| 87 } | 88 } |
| 88 | 89 |
| 89 void _showInteractiveResultsInPage(int passed, int failed, int errors, | 90 void _showInteractiveResultsInPage(int passed, int failed, int errors, |
| 90 List<TestCase> results, bool isLayoutTest, String uncaughtError) { | 91 List<TestCase> results, bool isLayoutTest, String uncaughtError) { |
| 91 if (isLayoutTest && passed == results.length) { | 92 if (isLayoutTest && passed == results.length) { |
| 92 document.body.innerHtml = "PASS"; | 93 document.body.innerHtml = "PASS"; |
| 93 } else { | 94 } else { |
| 94 // changed the StringBuffer to an Element fragment | 95 // changed the StringBuffer to an Element fragment |
| 95 Element te = new Element.html('<div class="unittest-table"></div>'); | 96 Element te = new Element.html('<div class="unittest-table"></div>'); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 .unittest-row-description | 407 .unittest-row-description |
| 407 { | 408 { |
| 408 } | 409 } |
| 409 | 410 |
| 410 '''; | 411 '''; |
| 411 } | 412 } |
| 412 | 413 |
| 413 void useHtmlEnhancedConfiguration([bool isLayoutTest = false]) { | 414 void useHtmlEnhancedConfiguration([bool isLayoutTest = false]) { |
| 414 configure(new HtmlEnhancedConfiguration(isLayoutTest)); | 415 configure(new HtmlEnhancedConfiguration(isLayoutTest)); |
| 415 } | 416 } |
| OLD | NEW |