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

Unified Diff: lib/unittest/html_print.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
Index: lib/unittest/html_print.dart
diff --git a/lib/unittest/html_print.dart b/lib/unittest/html_print.dart
index 89e2f5cbf35fd963fd5040870d6fb75f8329644c..ea43545dd9c3161a5449bae1cfe0fbc35f42ddb9 100644
--- a/lib/unittest/html_print.dart
+++ b/lib/unittest/html_print.dart
@@ -5,14 +5,14 @@
/** This file is sourced by both dom_config.dart and html_config.dart. */
/** Creates a table showing tests results in HTML. */
-void _showResultsInPage(int testsPassed, int testsFailed, int testsErrors,
- List<TestCase> results, isLayoutTest) {
- if (isLayoutTest && (testsPassed == results.length)) {
+void _showResultsInPage(int passed, int failed, int errors,
+ List<TestCase> results, bool isLayoutTest, String uncaughtError) {
+ if (isLayoutTest && (passed == results.length) && uncaughtError == null) {
document.body.innerHTML = "PASS";
} else {
var newBody = new StringBuffer();
newBody.add("<table class='unittest-table'><tbody>");
- newBody.add(testsPassed == results.length
+ newBody.add(passed == results.length && uncaughtError == null
? "<tr><td colspan='3' class='unittest-pass'>PASS</td></tr>"
: "<tr><td colspan='3' class='unittest-fail'>FAIL</td></tr>");
@@ -20,17 +20,26 @@ void _showResultsInPage(int testsPassed, int testsFailed, int testsErrors,
newBody.add(_toHtml(test_));
}
- if (testsPassed == results.length) {
+ if (uncaughtError != null) {
+ newBody.add('''<tr>
+ <td>--</td>
+ <td class="unittest-error">ERROR</td>
+ <td>Uncaught error: $uncaughtError</td>
+ </tr>''');
+ }
+
+ if (passed == results.length && uncaughtError == null) {
newBody.add("""
<tr><td colspan='3' class='unittest-pass'>
- All ${testsPassed} tests passed
+ All ${passed} tests passed
</td></tr>""");
} else {
newBody.add("""
<tr><td colspan='3'>Total
- <span class='unittest-pass'>${testsPassed} passed</span>,
- <span class='unittest-fail'>${testsFailed} failed</span>
- <span class='unittest-error'>${testsErrors} errors</span>
+ <span class='unittest-pass'>${passed} passed</span>,
+ <span class='unittest-fail'>${failed} failed</span>
+ <span class='unittest-error'>
+ ${errors + (uncaughtError == null ? 0 : 1)} errors</span>
</td></tr>""");
}
newBody.add("</tbody></table>");

Powered by Google App Engine
This is Rietveld 408576698