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

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

Issue 145403005: pkg/unittest: formatter spin (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: review nits Created 6 years, 10 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 | « 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) 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 12 matching lines...) Expand all
23 newBody.write("<table class='unittest-table'><tbody>"); 23 newBody.write("<table class='unittest-table'><tbody>");
24 newBody.write(passed == results.length && uncaughtError == null 24 newBody.write(passed == results.length && uncaughtError == null
25 ? "<tr><td colspan='3' class='unittest-pass'>PASS</td></tr>" 25 ? "<tr><td colspan='3' class='unittest-pass'>PASS</td></tr>"
26 : "<tr><td colspan='3' class='unittest-fail'>FAIL</td></tr>"); 26 : "<tr><td colspan='3' class='unittest-fail'>FAIL</td></tr>");
27 27
28 for (final test_ in results) { 28 for (final test_ in results) {
29 newBody.write(_toHtml(test_)); 29 newBody.write(_toHtml(test_));
30 } 30 }
31 31
32 if (uncaughtError != null) { 32 if (uncaughtError != null) {
33 newBody.write('''<tr> 33 newBody.write('''<tr>
34 <td>--</td> 34 <td>--</td>
35 <td class="unittest-error">ERROR</td> 35 <td class="unittest-error">ERROR</td>
36 <td>Uncaught error: $uncaughtError</td> 36 <td>Uncaught error: $uncaughtError</td>
37 </tr>'''); 37 </tr>''');
38 } 38 }
39 39
40 if (passed == results.length && uncaughtError == null) { 40 if (passed == results.length && uncaughtError == null) {
41 newBody.write(""" 41 newBody.write("""
42 <tr><td colspan='3' class='unittest-pass'> 42 <tr><td colspan='3' class='unittest-pass'>
43 All ${passed} tests passed 43 All ${passed} tests passed
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 if ('unittest-suite-external-error' == e.data) { 129 if ('unittest-suite-external-error' == e.data) {
130 handleExternalError('<unknown>', '(external error detected)'); 130 handleExternalError('<unknown>', '(external error detected)');
131 } 131 }
132 } 132 }
133 133
134 void onInit() { 134 void onInit() {
135 // For Dart internal tests, we want to turn off stack frame 135 // For Dart internal tests, we want to turn off stack frame
136 // filtering, which we do with this meta-header. 136 // filtering, which we do with this meta-header.
137 var meta = query('meta[name="dart.unittest"]'); 137 var meta = query('meta[name="dart.unittest"]');
138 filterStacks = meta == null ? true : 138 filterStacks = meta == null ? true :
139 !meta.content.contains('full-stack-traces'); 139 !meta.content.contains('full-stack-traces');
140 _installHandlers(); 140 _installHandlers();
141 window.postMessage('unittest-suite-wait-for-done', '*'); 141 window.postMessage('unittest-suite-wait-for-done', '*');
142 } 142 }
143 143
144 void onStart() { 144 void onStart() {
145 // If the URL has a #testFilter=testName then filter tests to that. 145 // If the URL has a #testFilter=testName then filter tests to that.
146 // This is used to make it easy to run a single test- but is only intended 146 // This is used to make it easy to run a single test- but is only intended
147 // for interactive debugging scenarios. 147 // for interactive debugging scenarios.
148 var hash = window.location.hash; 148 var hash = window.location.hash;
149 if (hash != null && hash.length > 1) { 149 if (hash != null && hash.length > 1) {
(...skipping 19 matching lines...) Expand all
169 window.postMessage('unittest-suite-done', '*'); 169 window.postMessage('unittest-suite-done', '*');
170 } 170 }
171 } 171 }
172 172
173 void useHtmlConfiguration([bool isLayoutTest = false]) { 173 void useHtmlConfiguration([bool isLayoutTest = false]) {
174 unittestConfiguration = isLayoutTest ? _singletonLayout : _singletonNotLayout; 174 unittestConfiguration = isLayoutTest ? _singletonLayout : _singletonNotLayout;
175 } 175 }
176 176
177 final _singletonLayout = new HtmlConfiguration(true); 177 final _singletonLayout = new HtmlConfiguration(true);
178 final _singletonNotLayout = new HtmlConfiguration(false); 178 final _singletonNotLayout = new HtmlConfiguration(false);
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