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

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

Issue 8515004: Fix unittest - fix error in the error reporting code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month 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 | no next file » | 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"); 8 #library("unittest");
9 9
10 #import("dart:dom"); 10 #import("dart:dom");
11 11
12 #source("shared.dart"); 12 #source("shared.dart");
13 13
14 // TODO(rnystrom): Get rid of this if we get canonical closures for methods. 14 // TODO(rnystrom): Get rid of this if we get canonical closures for methods.
15 EventListener _onErrorClosure; 15 EventListener _onErrorClosure;
16 16
17 _platformInitialize() { 17 _platformInitialize() {
18 _onErrorClosure = (e) { _onError(e); }; 18 _onErrorClosure = (e) { _onError(e); };
19 } 19 }
20 20
21 _platformDefer(void callback()) { 21 _platformDefer(void callback()) {
22 window.setTimeout(callback, 0); 22 window.setTimeout(callback, 0);
23 } 23 }
24 24
25 void _onError(e) { 25 void _onError(e) {
26 if (_currentTest < _tests.length) { 26 if (_currentTest < _tests.length) {
27 final testCase = _tests[_currentTest]; 27 final testCase = _tests[_currentTest];
28 // TODO(vsm): figure out how to expose the stack trace here 28 // TODO(vsm): figure out how to expose the stack trace here
29 // Currently e.message works in dartium, but not in dartc. 29 // Currently e.message works in dartium, but not in dartc.
30 testCase.recordError('(DOM callback has errors) Caught ${e}', ''); 30 testCase.error('(DOM callback has errors) Caught ${e}', '');
31 _state = _UNCAUGHT_ERROR; 31 _state = _UNCAUGHT_ERROR;
32 if (testCase.callbacks > 0) { 32 if (testCase.callbacks > 0) {
33 _currentTest++; 33 _currentTest++;
34 _nextBatch(); 34 _nextBatch();
35 } 35 }
36 } 36 }
37 } 37 }
38 38
39 /** Runs all queued tests, one at a time. */ 39 /** Runs all queued tests, one at a time. */
40 _platformStartTests() { 40 _platformStartTests() {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 <td class="unittest-${test.result}">${test.result.toUpperCase()}</td> 94 <td class="unittest-${test.result}">${test.result.toUpperCase()}</td>
95 <td>Expectation: ${test.description}. ${test.message}</td> 95 <td>Expectation: ${test.description}. ${test.message}</td>
96 </tr>'''; 96 </tr>''';
97 97
98 if (test.stackTrace != null) { 98 if (test.stackTrace != null) {
99 html += 99 html +=
100 '<tr><td></td><td colspan="2"><pre>${test.stackTrace}</pre></td></tr>'; 100 '<tr><td></td><td colspan="2"><pre>${test.stackTrace}</pre></td></tr>';
101 } 101 }
102 102
103 return html; 103 return html;
104 } 104 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698