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

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

Issue 18052029: Use package:stack_trace in unittest. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review change. Created 7 years, 5 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
« no previous file with comments | « pkg/unittest/lib/compact_vm_config.dart ('k') | 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) 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 library unittest_html_config; 8 library unittest_html_config;
9 9
10 import 'dart:async'; 10 import 'dart:async';
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 74
75 var html = ''' 75 var html = '''
76 <tr> 76 <tr>
77 <td>${test_.id}</td> 77 <td>${test_.id}</td>
78 <td class="unittest-${test_.result}">${test_.result.toUpperCase()}</td> 78 <td class="unittest-${test_.result}">${test_.result.toUpperCase()}</td>
79 <td>Expectation: <a href="#testFilter=${test_.description}">${test_.desc ription}</a>. ${_htmlEscape(test_.message)}</td> 79 <td>Expectation: <a href="#testFilter=${test_.description}">${test_.desc ription}</a>. ${_htmlEscape(test_.message)}</td>
80 </tr>'''; 80 </tr>''';
81 81
82 if (test_.stackTrace != null) { 82 if (test_.stackTrace != null) {
83 html = '$html<tr><td></td><td colspan="2"><pre>${_htmlEscape(test_.stackTrac e)}</pre></td></tr>'; 83 html = '$html<tr><td></td><td colspan="2"><pre>' +
84 _htmlEscape(test_.stackTrace.toString()) +
85 '</pre></td></tr>';
84 } 86 }
85 87
86 return html; 88 return html;
87 } 89 }
88 90
89 //TODO(pquitslund): Move to a common lib 91 //TODO(pquitslund): Move to a common lib
90 String _htmlEscape(String string) { 92 String _htmlEscape(String string) {
91 return string.replaceAll('&', '&amp;') 93 return string.replaceAll('&', '&amp;')
92 .replaceAll('<','&lt;') 94 .replaceAll('<','&lt;')
93 .replaceAll('>','&gt;'); 95 .replaceAll('>','&gt;');
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 window.postMessage('unittest-suite-done', '*'); 164 window.postMessage('unittest-suite-done', '*');
163 } 165 }
164 } 166 }
165 167
166 void useHtmlConfiguration([bool isLayoutTest = false]) { 168 void useHtmlConfiguration([bool isLayoutTest = false]) {
167 unittestConfiguration = isLayoutTest ? _singletonLayout : _singletonNotLayout; 169 unittestConfiguration = isLayoutTest ? _singletonLayout : _singletonNotLayout;
168 } 170 }
169 171
170 final _singletonLayout = new HtmlConfiguration(true); 172 final _singletonLayout = new HtmlConfiguration(true);
171 final _singletonNotLayout = new HtmlConfiguration(false); 173 final _singletonNotLayout = new HtmlConfiguration(false);
OLDNEW
« no previous file with comments | « pkg/unittest/lib/compact_vm_config.dart ('k') | pkg/unittest/lib/html_enhanced_config.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698