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

Unified Diff: lib/unittest/html_config.dart

Issue 10037027: unittest step2: bye bye to multiple entrypoints for unittest (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
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 {
Bob Nystrom 2012/04/12 16:45:49 Can this be unified with DomConfiguration? They se
Siggi Cherem (dart-lang) 2012/04/12 17:36:28 I don't recall the current status, but I was under
Bob Nystrom 2012/04/12 18:01:37 No, I wouldn't bother. DomConfiguration will just
+ /** 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));
+}

Powered by Google App Engine
This is Rietveld 408576698