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

Side by Side Diff: lib/unittest/interactive_html_config.dart

Issue 10854013: Clean up the test srapper code so that it does not use reportTestError, and made that private. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 * This configuration can be used to rerun selected tests, as well 6 * This configuration can be used to rerun selected tests, as well
7 * as see diagnostic output from tests. It runs each test in its own 7 * as see diagnostic output from tests. It runs each test in its own
8 * IFrame, so the configuration consists of two parts - a 'master' 8 * IFrame, so the configuration consists of two parts - a 'master'
9 * config that manages all the tests, and a 'slave' config for the 9 * config that manages all the tests, and a 'slave' config for the
10 * IFrame that runs the individual tests. 10 * IFrame that runs the individual tests.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 /** The time at which tests start. */ 66 /** The time at which tests start. */
67 Map<int,Date> _testStarts; 67 Map<int,Date> _testStarts;
68 68
69 SlaveInteractiveHtmlConfiguration() : 69 SlaveInteractiveHtmlConfiguration() :
70 _testStarts = new Map<int,Date>(); 70 _testStarts = new Map<int,Date>();
71 71
72 /** Don't start running tests automatically. */ 72 /** Don't start running tests automatically. */
73 get autoStart() => false; 73 get autoStart() => false;
74 74
75 void onInit() { 75 void onInit() {
76 _onErrorClosure = (e) { 76 _onErrorClosure =
77 // TODO(vsm): figure out how to expose the stack trace here 77 (e) => handleExternalError(e, '(DOM callback has errors)');
78 // Currently e.message works in dartium, but not in dartc.
79 reportTestError('(DOM callback has errors) Caught ${e}', '');
80 };
81 78
82 /** 79 /**
83 * The master posts a 'start' message to kick things off, 80 * The master posts a 'start' message to kick things off,
84 * which is handled by this handler. It saves the master 81 * which is handled by this handler. It saves the master
85 * window, gets the test ID from the query parameter in the 82 * window, gets the test ID from the query parameter in the
86 * IFrame URL, sets that as a solo test and starts test execution. 83 * IFrame URL, sets that as a solo test and starts test execution.
87 */ 84 */
88 window.on.message.add((MessageEvent e) { 85 window.on.message.add((MessageEvent e) {
89 // Get the result, do any logging, then do a pass/fail. 86 // Get the result, do any logging, then do a pass/fail.
90 var m = new _Message.fromString(e.data); 87 var m = new _Message.fromString(e.data);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 currentTestCase.fail(msg.body, _stack); 216 currentTestCase.fail(msg.body, _stack);
220 } else if (msg.messageType == _Message.ERROR) { 217 } else if (msg.messageType == _Message.ERROR) {
221 currentTestCase.error(msg.body, _stack); 218 currentTestCase.error(msg.body, _stack);
222 } 219 }
223 completeTest(); 220 completeTest();
224 } 221 }
225 } 222 }
226 223
227 void onInit() { 224 void onInit() {
228 _messageHandler = _handleMessage; // We need to make just one closure. 225 _messageHandler = _handleMessage; // We need to make just one closure.
229 _onErrorClosure = (e) { 226 _onErrorClosure =
230 // TODO(vsm): figure out how to expose the stack trace here 227 (e) => handleExternalError(e, '(DOM callback has errors)');
231 // Currently e.message works in dartium, but not in dartc.
232 reportTestError('(DOM callback has errors) Caught ${e}', '');
233 };
234 document.query('#group-divs').innerHTML = ""; 228 document.query('#group-divs').innerHTML = "";
235 } 229 }
236 230
237 void onStart() { 231 void onStart() {
238 // Listen for uncaught errors. 232 // Listen for uncaught errors.
239 window.on.error.add(_onErrorClosure); 233 window.on.error.add(_onErrorClosure);
240 if (!_doneWrap) { 234 if (!_doneWrap) {
241 _doneWrap = true; 235 _doneWrap = true;
242 for (int i = 0; i < testCases.length; i++) { 236 for (int i = 0; i < testCases.length; i++) {
243 testCases[i].test = wrapTest(testCases[i]); 237 testCases[i].test = wrapTest(testCases[i]);
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 display: block; 647 display: block;
654 list-style-type: disc; 648 list-style-type: disc;
655 -webkit-margin-before: 1em; 649 -webkit-margin-before: 1em;
656 -webkit-margin-after: 1em; 650 -webkit-margin-after: 1em;
657 -webkit-margin-start: 0px; 651 -webkit-margin-start: 0px;
658 -webkit-margin-end: 0px; 652 -webkit-margin-end: 0px;
659 -webkit-padding-start: 40px; 653 -webkit-padding-start: 40px;
660 } 654 }
661 655
662 """; 656 """;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698