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

Unified Diff: lib/unittest/html_enhanced_config.dart

Issue 10153005: unittest step 3 and 4: remove TestFramework.dart, make test.dart use (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
« no previous file with comments | « lib/unittest/html_config.dart ('k') | lib/unittest/html_print.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/unittest/html_enhanced_config.dart
diff --git a/lib/unittest/html_enhanced_config.dart b/lib/unittest/html_enhanced_config.dart
index 1bdf924ea492f2e66c8db842e2f09142edc2761c..7b611c76f3e6c5b6573f0d716c48e4e1c533baa6 100644
--- a/lib/unittest/html_enhanced_config.dart
+++ b/lib/unittest/html_enhanced_config.dart
@@ -38,7 +38,7 @@ class HtmlEnhancedConfiguration extends Configuration {
_onErrorClosure = (e) {
// TODO(vsm): figure out how to expose the stack trace here
// Currently e.message works in dartium, but not in dartc.
- notifyError('(DOM callback has errors) Caught ${e}', '');
+ reportTestError('(DOM callback has errors) Caught ${e}', '');
};
}
@@ -50,17 +50,18 @@ class HtmlEnhancedConfiguration extends Configuration {
void onTestResult(TestCase testCase) {}
- void onDone(int passed, int failed, int errors, List<TestCase> results) {
+ void onDone(int passed, int failed, int errors, List<TestCase> results,
+ String uncaughtError) {
window.on.error.remove(_onErrorClosure);
_showInteractiveResultsInPage(passed, failed, errors, results,
- _isLayoutTest);
+ _isLayoutTest, uncaughtError);
window.postMessage('unittest-suite-done', '*');
}
void _showInteractiveResultsInPage(int passed, int failed, int errors,
- List<TestCase> results, bool isLayoutTest){
+ List<TestCase> results, bool isLayoutTest, String uncaughtError) {
if (isLayoutTest && passed == results.length) {
document.body.innerHTML = "PASS";
} else {
@@ -73,17 +74,25 @@ class HtmlEnhancedConfiguration extends Configuration {
// moved summary to the top since web browsers
// don't auto-scroll to the bottom like consoles typically do.
- if (passed == results.length) {
+ if (passed == results.length && uncaughtError == null) {
te.elements.add(new Element.html("""
<div class='unittest-pass'>All ${passed} tests passed</div>"""));
} else {
+ if (uncaughtError != null) {
+ te.elements.add(new Element.html("""
+ <div class='unittest-summary'>
+ <span class='unittest-error'>Uncaught error: $uncaughtError</span>
+ </div>"""));
+ }
+
te.elements.add(new Element.html("""
- <div class='unittest-summary'>
- <span class='unittest-pass'>Total ${passed} passed</span>,
- <span class='unittest-fail'>${failed} failed</span>,
- <span class='unittest-error'>${errors} errors</span>
- </div>"""));
+ <div class='unittest-summary'>
+ <span class='unittest-pass'>Total ${passed} passed</span>,
+ <span class='unittest-fail'>${failed} failed</span>,
+ <span class='unittest-error'>
+ ${errors + (uncaughtError == null ? 0 : 1)} errors</span>
+ </div>"""));
}
te.elements.add(new Element.html("""
« no previous file with comments | « lib/unittest/html_config.dart ('k') | lib/unittest/html_print.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698