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

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

Issue 208273009: pkg/unittest: Removed references to expectAsync[Until]X in docs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 6 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
« 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 /// A simple unit test library for running tests in a browser.
6 * A simple unit test library for running tests in a browser.
7 */
8 library unittest.html_config; 6 library unittest.html_config;
9 7
10 import 'dart:async'; 8 import 'dart:async';
11 import 'dart:convert'; 9 import 'dart:convert';
12 import 'dart:html'; 10 import 'dart:html';
13 import 'dart:js' as js; 11 import 'dart:js' as js;
14 import 'unittest.dart'; 12 import 'unittest.dart';
15 13
16 /** Creates a table showing tests results in HTML. */ 14 /// Creates a table showing tests results in HTML.
17 void _showResultsInPage(int passed, int failed, int errors, 15 void _showResultsInPage(int passed, int failed, int errors,
18 List<TestCase> results, bool isLayoutTest, String uncaughtError) { 16 List<TestCase> results, bool isLayoutTest, String uncaughtError) {
19 if (isLayoutTest && (passed == results.length) && uncaughtError == null) { 17 if (isLayoutTest && (passed == results.length) && uncaughtError == null) {
20 document.body.innerHtml = "PASS"; 18 document.body.innerHtml = "PASS";
21 } else { 19 } else {
22 var newBody = new StringBuffer(); 20 var newBody = new StringBuffer();
23 newBody.write("<table class='unittest-table'><tbody>"); 21 newBody.write("<table class='unittest-table'><tbody>");
24 newBody.write(passed == results.length && uncaughtError == null 22 newBody.write(passed == results.length && uncaughtError == null
25 ? "<tr><td colspan='3' class='unittest-pass'>PASS</td></tr>" 23 ? "<tr><td colspan='3' class='unittest-pass'>PASS</td></tr>"
26 : "<tr><td colspan='3' class='unittest-fail'>FAIL</td></tr>"); 24 : "<tr><td colspan='3' class='unittest-fail'>FAIL</td></tr>");
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 if (test_.stackTrace != null) { 82 if (test_.stackTrace != null) {
85 html = '$html<tr><td></td><td colspan="2"><pre>' + 83 html = '$html<tr><td></td><td colspan="2"><pre>' +
86 HTML_ESCAPE.convert(test_.stackTrace.toString()) + 84 HTML_ESCAPE.convert(test_.stackTrace.toString()) +
87 '</pre></td></tr>'; 85 '</pre></td></tr>';
88 } 86 }
89 87
90 return html; 88 return html;
91 } 89 }
92 90
93 class HtmlConfiguration extends SimpleConfiguration { 91 class HtmlConfiguration extends SimpleConfiguration {
94 /** Whether this is run within dartium layout tests. */ 92 /// Whether this is run within dartium layout tests.
95 final bool _isLayoutTest; 93 final bool _isLayoutTest;
96 HtmlConfiguration(this._isLayoutTest); 94 HtmlConfiguration(this._isLayoutTest);
97 95
98 StreamSubscription<Event> _onErrorSubscription; 96 StreamSubscription<Event> _onErrorSubscription;
99 StreamSubscription<Event> _onMessageSubscription; 97 StreamSubscription<Event> _onMessageSubscription;
100 98
101 void _installHandlers() { 99 void _installHandlers() {
102 if (_onErrorSubscription == null) { 100 if (_onErrorSubscription == null) {
103 _onErrorSubscription = window.onError.listen( 101 _onErrorSubscription = window.onError.listen(
104 (e) { 102 (e) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 window.postMessage('unittest-suite-done', '*'); 167 window.postMessage('unittest-suite-done', '*');
170 } 168 }
171 } 169 }
172 170
173 void useHtmlConfiguration([bool isLayoutTest = false]) { 171 void useHtmlConfiguration([bool isLayoutTest = false]) {
174 unittestConfiguration = isLayoutTest ? _singletonLayout : _singletonNotLayout; 172 unittestConfiguration = isLayoutTest ? _singletonLayout : _singletonNotLayout;
175 } 173 }
176 174
177 final _singletonLayout = new HtmlConfiguration(true); 175 final _singletonLayout = new HtmlConfiguration(true);
178 final _singletonNotLayout = new HtmlConfiguration(false); 176 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