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

Side by Side Diff: client/testing/unittest/unittest.dart

Issue 9537001: Generate dart:html bindings for Dartium as well as Frog. All unittests now pass (or are disabled fo… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 months 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
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"); 8 #library("unittest");
9 9
10 #import("dart:dom"); 10 #import("dart:dom");
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 newBody.add("<table class='unittest-table'><tbody>"); 54 newBody.add("<table class='unittest-table'><tbody>");
55 newBody.add(testsPassed == _tests.length 55 newBody.add(testsPassed == _tests.length
56 ? "<tr><td colspan='3' class='unittest-pass'>PASS</td></tr>" 56 ? "<tr><td colspan='3' class='unittest-pass'>PASS</td></tr>"
57 : "<tr><td colspan='3' class='unittest-fail'>FAIL</td></tr>"); 57 : "<tr><td colspan='3' class='unittest-fail'>FAIL</td></tr>");
58 58
59 for (final test_ in _tests) { 59 for (final test_ in _tests) {
60 newBody.add(_toHtml(test_)); 60 newBody.add(_toHtml(test_));
61 } 61 }
62 62
63 if (testsPassed == _tests.length) { 63 if (testsPassed == _tests.length) {
64 newBody.add("<tr><td colspan='3' class='unittest-pass'>All " 64 newBody.add("""
65 + testsPassed + " tests passed</td></tr>"); 65 <tr><td colspan='3' class='unittest-pass'>
66 All ${testsPassed} tests passed
67 </td></tr>""");
66 } else { 68 } else {
67 newBody.add(""" 69 newBody.add("""
68 <tr><td colspan='3'>Total 70 <tr><td colspan='3'>Total
69 <span class='unittest-pass'>${testsPassed} passed</span>, 71 <span class='unittest-pass'>${testsPassed} passed</span>,
70 <span class='unittest-fail'>${testsFailed} failed</span> 72 <span class='unittest-fail'>${testsFailed} failed</span>
71 <span class='unittest-error'>${testsErrors} errors</span> 73 <span class='unittest-error'>${testsErrors} errors</span>
72 </td></tr>"""); 74 </td></tr>""");
73 } 75 }
74 newBody.add("</tbody></table>"); 76 newBody.add("</tbody></table>");
75 document.body.innerHTML = newBody.toString(); 77 document.body.innerHTML = newBody.toString();
(...skipping 26 matching lines...) Expand all
102 104
103 return html; 105 return html;
104 } 106 }
105 107
106 //TODO(pquitslund): Move to a common lib 108 //TODO(pquitslund): Move to a common lib
107 String _htmlEscape(String string) { 109 String _htmlEscape(String string) {
108 return string.replaceAll('&', '&amp;') 110 return string.replaceAll('&', '&amp;')
109 .replaceAll('<','&lt;') 111 .replaceAll('<','&lt;')
110 .replaceAll('>','&gt;'); 112 .replaceAll('>','&gt;');
111 } 113 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698