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

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

Issue 10951015: Issue 5152: Browser bots much more flaky after going "wrapperless" (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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/html_enhanced_config.dart » ('j') | tests/html/html.status » ('J')
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:html'); 10 #import('dart:html');
11 #import('unittest.dart'); 11 #import('unittest.dart');
12 12
13 #source('html_print.dart'); 13 #source('html_print.dart');
14 14
15 class HtmlConfiguration extends Configuration { 15 class HtmlConfiguration extends Configuration {
16 /** Whether this is run within dartium layout tests. */ 16 /** Whether this is run within dartium layout tests. */
17 final bool _isLayoutTest; 17 final bool _isLayoutTest;
18 HtmlConfiguration(this._isLayoutTest); 18 HtmlConfiguration(this._isLayoutTest);
19 19
20 // TODO(rnystrom): Get rid of this if we get canonical closures for methods. 20 // TODO(rnystrom): Get rid of this if we get canonical closures for methods.
21 EventListener _onErrorClosure; 21 EventListener _onErrorClosure;
22 EventListener _onMessageClosure;
22 23
23 void onInit() { 24 void onInit() {
24 _onErrorClosure = 25 _onErrorClosure =
25 (e) => handleExternalError(e, '(DOM callback has errors)'); 26 (e) => handleExternalError(e, '(DOM callback has errors)');
27 _onMessageClosure = (m) {
28 if (m.data == 'unittest-suite-external-error') {
29 handleExternalError('<unknown>', '(external error detected)');
30 }
31 };
26 } 32 }
27 33
28 void onStart() { 34 void onStart() {
29 window.postMessage('unittest-suite-wait-for-done', '*'); 35 window.postMessage('unittest-suite-wait-for-done', '*');
30 // Listen for uncaught errors. 36 // Listen for uncaught errors.
31 window.on.error.add(_onErrorClosure); 37 window.on.error.add(_onErrorClosure);
38 window.on.message.add(_onMessageClosure);
32 } 39 }
33 40
34 void onTestResult(TestCase testCase) {} 41 void onTestResult(TestCase testCase) {}
35 42
36 void onDone(int passed, int failed, int errors, List<TestCase> results, 43 void onDone(int passed, int failed, int errors, List<TestCase> results,
37 String uncaughtError) { 44 String uncaughtError) {
38 window.on.error.remove(_onErrorClosure); 45 window.on.error.remove(_onErrorClosure);
46 window.on.message.remove(_onMessageClosure);
39 _showResultsInPage(passed, failed, errors, results, _isLayoutTest, 47 _showResultsInPage(passed, failed, errors, results, _isLayoutTest,
40 uncaughtError); 48 uncaughtError);
41 window.postMessage('unittest-suite-done', '*'); 49 window.postMessage('unittest-suite-done', '*');
42 } 50 }
43 } 51 }
44 52
45 void useHtmlConfiguration([bool isLayoutTest = false]) { 53 void useHtmlConfiguration([bool isLayoutTest = false]) {
46 configure(new HtmlConfiguration(isLayoutTest)); 54 configure(new HtmlConfiguration(isLayoutTest));
47 } 55 }
OLDNEW
« no previous file with comments | « no previous file | pkg/unittest/html_enhanced_config.dart » ('j') | tests/html/html.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698