Index: lib/unittest/html_config.dart |
diff --git a/lib/unittest/unittest_html.dart b/lib/unittest/html_config.dart |
similarity index 64% |
rename from lib/unittest/unittest_html.dart |
rename to lib/unittest/html_config.dart |
index 45ef6e5c8233524422216c7b74434b4304ad9450..5f996a0168404d021c67c5b32cff110ba3cea9e8 100644 |
--- a/lib/unittest/unittest_html.dart |
+++ b/lib/unittest/html_config.dart |
@@ -8,39 +8,24 @@ |
#library('unittest'); |
#import('dart:html'); |
-#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 HtmlConfiguration extends Configuration { |
+ /** Whether this is run within dartium layout tests. */ |
+ final bool _isLayoutTest; |
+ HtmlConfiguration(this._isLayoutTest); |
-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}', ''); |
+ }; |
} |
void onStart() { |
@@ -57,3 +42,7 @@ class PlatformConfiguration extends Configuration { |
window.postMessage('unittest-suite-done', '*'); |
} |
} |
+ |
+void useHtmlConfiguration([bool isLayoutTest = false]) { |
+ configure(new HtmlConfiguration(isLayoutTest)); |
+} |