Chromium Code Reviews| Index: lib/unittest/dom_config.dart |
| diff --git a/lib/unittest/unittest_dom.dart b/lib/unittest/dom_config.dart |
| similarity index 59% |
| rename from lib/unittest/unittest_dom.dart |
| rename to lib/unittest/dom_config.dart |
| index a96e2191c5e1ae323e9a0af848db821e11be0e26..77efd0e43c237a9cf1233c71f38bd49d5b07a6a7 100644 |
| --- a/lib/unittest/unittest_dom.dart |
| +++ b/lib/unittest/dom_config.dart |
| @@ -2,45 +2,28 @@ |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| -/** |
| - * A simple unit test library for running tests in a browser. |
| - */ |
| -#library('unittest'); |
| +/** Configuration for running tests in a browser using dart:dom. */ |
| +#library('dom_config'); |
| #import('dart:dom'); |
| -#import('dart:isolate'); |
| +#import('unittest.dart'); |
| -#source('config.dart'); |
| -#source('shared.dart'); |
| #source('html_print.dart'); |
| -/** Whether this is run within dartium layout tests. */ |
| -bool _isLayoutTest = false; |
| +class DomConfiguration extends Configuration { |
| + /** Whether this is run within dartium layout tests. */ |
| + final bool _isLayoutTest; |
| + DomConfiguration(this._isLayoutTest); |
|
Bob Nystrom
2012/04/12 16:45:49
Style nit, newline before this to separate from fi
Siggi Cherem (dart-lang)
2012/04/12 17:36:28
Done.
|
| -void forLayoutTests() { |
| - _isLayoutTest = true; |
| -} |
| - |
| -class PlatformConfiguration extends Configuration { |
| // TODO(rnystrom): Get rid of this if we get canonical closures for methods. |
| EventListener _onErrorClosure; |
| void onInit() { |
| - _onErrorClosure = (e) { _onError(e); }; |
| - } |
| - |
| - void _onError(e) { |
| - if (_currentTest < _tests.length) { |
| - final testCase = _tests[_currentTest]; |
| + _onErrorClosure = (e) { |
| // TODO(vsm): figure out how to expose the stack trace here |
| // Currently e.message works in dartium, but not in dartc. |
| - testCase.error('(DOM callback has errors) Caught ${e}', ''); |
| - _state = _UNCAUGHT_ERROR; |
| - if (testCase.callbacks > 0) { |
| - _currentTest++; |
| - _testRunner(); |
| - } |
| - } |
| + notifyError('(DOM callback has errors) Caught ${e}', ''); |
|
Bob Nystrom
2012/04/12 16:45:49
$e
Siggi Cherem (dart-lang)
2012/04/12 17:36:28
Done.
|
| + }; |
| } |
| void onStart() { |
| @@ -57,3 +40,7 @@ class PlatformConfiguration extends Configuration { |
| window.postMessage('unittest-suite-done', '*'); |
| } |
| } |
| + |
| +void useDomConfiguration([bool isLayoutTest = false]) { |
| + configure(new DomConfiguration(isLayoutTest)); |
| +} |