OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 84 } |
85 | 85 |
86 void onSummary(int passed, int failed, int errors, List<TestCase> results, | 86 void onSummary(int passed, int failed, int errors, List<TestCase> results, |
87 String uncaughtError) { | 87 String uncaughtError) { |
88 _showInteractiveResultsInPage(passed, failed, errors, results, | 88 _showInteractiveResultsInPage(passed, failed, errors, results, |
89 _isLayoutTest, uncaughtError); | 89 _isLayoutTest, uncaughtError); |
90 } | 90 } |
91 | 91 |
92 void onDone(bool success) { | 92 void onDone(bool success) { |
93 _uninstallHandlers(); | 93 _uninstallHandlers(); |
94 window.postMessage('unittest-suite-done', '*'); | 94 if (success) { |
| 95 window.postMessage('unittest-suite-success', '*'); |
| 96 } else { |
| 97 window.postMessage('unittest-suite-fail', '*'); |
| 98 } |
95 } | 99 } |
96 | 100 |
97 void _showInteractiveResultsInPage(int passed, int failed, int errors, | 101 void _showInteractiveResultsInPage(int passed, int failed, int errors, |
98 List<TestCase> results, bool isLayoutTest, String uncaughtError) { | 102 List<TestCase> results, bool isLayoutTest, String uncaughtError) { |
99 if (isLayoutTest && passed == results.length) { | 103 if (isLayoutTest && passed == results.length) { |
100 document.body.innerHtml = "PASS"; | 104 document.body.innerHtml = "PASS"; |
101 } else { | 105 } else { |
102 // changed the StringBuffer to an Element fragment | 106 // changed the StringBuffer to an Element fragment |
103 Element te = new Element.html('<div class="unittest-table"></div>'); | 107 Element te = new Element.html('<div class="unittest-table"></div>'); |
104 | 108 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 | 414 |
411 '''; | 415 '''; |
412 } | 416 } |
413 | 417 |
414 void useHtmlEnhancedConfiguration([bool isLayoutTest = false]) { | 418 void useHtmlEnhancedConfiguration([bool isLayoutTest = false]) { |
415 unittestConfiguration = isLayoutTest ? _singletonLayout : _singletonNotLayout; | 419 unittestConfiguration = isLayoutTest ? _singletonLayout : _singletonNotLayout; |
416 } | 420 } |
417 | 421 |
418 final _singletonLayout = new HtmlEnhancedConfiguration(true); | 422 final _singletonLayout = new HtmlEnhancedConfiguration(true); |
419 final _singletonNotLayout = new HtmlEnhancedConfiguration(false); | 423 final _singletonNotLayout = new HtmlEnhancedConfiguration(false); |
OLD | NEW |