Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1849)

Side by Side Diff: pkg/unittest/lib/html_config.dart

Issue 11418075: Dartifying members. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixing menuelement.compact exclusion. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/unittest/lib/html_enhanced_config.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 library unittest_html_config; 8 library unittest_html_config;
9 9
10 import 'dart:html'; 10 import 'dart:html';
11 import 'unittest.dart'; 11 import 'unittest.dart';
12 12
13 /** Creates a table showing tests results in HTML. */ 13 /** Creates a table showing tests results in HTML. */
14 void _showResultsInPage(int passed, int failed, int errors, 14 void _showResultsInPage(int passed, int failed, int errors,
15 List<TestCase> results, bool isLayoutTest, String uncaughtError) { 15 List<TestCase> results, bool isLayoutTest, String uncaughtError) {
16 if (isLayoutTest && (passed == results.length) && uncaughtError == null) { 16 if (isLayoutTest && (passed == results.length) && uncaughtError == null) {
17 document.body.innerHTML = "PASS"; 17 document.body.innerHtml = "PASS";
18 } else { 18 } else {
19 var newBody = new StringBuffer(); 19 var newBody = new StringBuffer();
20 newBody.add("<table class='unittest-table'><tbody>"); 20 newBody.add("<table class='unittest-table'><tbody>");
21 newBody.add(passed == results.length && uncaughtError == null 21 newBody.add(passed == results.length && uncaughtError == null
22 ? "<tr><td colspan='3' class='unittest-pass'>PASS</td></tr>" 22 ? "<tr><td colspan='3' class='unittest-pass'>PASS</td></tr>"
23 : "<tr><td colspan='3' class='unittest-fail'>FAIL</td></tr>"); 23 : "<tr><td colspan='3' class='unittest-fail'>FAIL</td></tr>");
24 24
25 for (final test_ in results) { 25 for (final test_ in results) {
26 newBody.add(_toHtml(test_)); 26 newBody.add(_toHtml(test_));
27 } 27 }
(...skipping 14 matching lines...) Expand all
42 } else { 42 } else {
43 newBody.add(""" 43 newBody.add("""
44 <tr><td colspan='3'>Total 44 <tr><td colspan='3'>Total
45 <span class='unittest-pass'>${passed} passed</span>, 45 <span class='unittest-pass'>${passed} passed</span>,
46 <span class='unittest-fail'>${failed} failed</span> 46 <span class='unittest-fail'>${failed} failed</span>
47 <span class='unittest-error'> 47 <span class='unittest-error'>
48 ${errors + (uncaughtError == null ? 0 : 1)} errors</span> 48 ${errors + (uncaughtError == null ? 0 : 1)} errors</span>
49 </td></tr>"""); 49 </td></tr>""");
50 } 50 }
51 newBody.add("</tbody></table>"); 51 newBody.add("</tbody></table>");
52 document.body.innerHTML = newBody.toString(); 52 document.body.innerHtml = newBody.toString();
53 } 53 }
54 } 54 }
55 55
56 String _toHtml(TestCase test_) { 56 String _toHtml(TestCase test_) {
57 if (!test_.isComplete) { 57 if (!test_.isComplete) {
58 return ''' 58 return '''
59 <tr> 59 <tr>
60 <td>${test_.id}</td> 60 <td>${test_.id}</td>
61 <td class="unittest-error">NO STATUS</td> 61 <td class="unittest-error">NO STATUS</td>
62 <td>Test did not complete</td> 62 <td>Test did not complete</td>
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 _uninstallHandlers(); 139 _uninstallHandlers();
140 _showResultsInPage(passed, failed, errors, results, _isLayoutTest, 140 _showResultsInPage(passed, failed, errors, results, _isLayoutTest,
141 uncaughtError); 141 uncaughtError);
142 window.postMessage('unittest-suite-done', '*'); 142 window.postMessage('unittest-suite-done', '*');
143 } 143 }
144 } 144 }
145 145
146 void useHtmlConfiguration([bool isLayoutTest = false]) { 146 void useHtmlConfiguration([bool isLayoutTest = false]) {
147 configure(new HtmlConfiguration(isLayoutTest)); 147 configure(new HtmlConfiguration(isLayoutTest));
148 } 148 }
OLDNEW
« no previous file with comments | « no previous file | pkg/unittest/lib/html_enhanced_config.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698