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

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

Issue 10836241: Move unittest from lib to pkg. (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
« no previous file with comments | « lib/unittest/description.dart ('k') | lib/unittest/expect.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /** Configuration for running tests in a browser using dart:dom_deprecated. */
6 #library('dom_config');
7
8 #import('dart:dom_deprecated');
9 #import('unittest.dart');
10
11 #source('html_print.dart');
12
13 class DomConfiguration extends Configuration {
14 /** Whether this is run within dartium layout tests. */
15 final bool _isLayoutTest;
16
17 DomConfiguration(this._isLayoutTest);
18
19 // TODO(rnystrom): Get rid of this if we get canonical closures for methods.
20 EventListener _onErrorClosure;
21
22 void onInit() {
23 _onErrorClosure =
24 (e) => handleExternalError(e, '(DOM callback has errors)');
25 }
26
27 void onStart() {
28 window.postMessage('unittest-suite-wait-for-done', '*');
29 // Listen for uncaught errors.
30 window.addEventListener('error', _onErrorClosure, true);
31 }
32
33 void onTestResult(TestCase testCase) {}
34
35 void onDone(int passed, int failed, int errors, List<TestCase> results,
36 String uncaughtError) {
37 window.removeEventListener('error', _onErrorClosure);
38 _showResultsInPage(passed, failed, errors, results, _isLayoutTest,
39 uncaughtError);
40 window.postMessage('unittest-suite-done', '*');
41 }
42 }
43
44 void useDomConfiguration([bool isLayoutTest = false]) {
45 configure(new DomConfiguration(isLayoutTest));
46 }
OLDNEW
« no previous file with comments | « lib/unittest/description.dart ('k') | lib/unittest/expect.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698