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

Unified Diff: tools/testing/dart/browser_test.dart

Issue 10226008: Revert "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 | « tests/isolate/src/TestFramework.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/browser_test.dart
diff --git a/tools/testing/dart/browser_test.dart b/tools/testing/dart/browser_test.dart
index 04e88454ea37788ca26a34743ebcdfbdea230e24..7449dd1cee58a914e7cf6e02dfd5c8dfd668f705 100644
--- a/tools/testing/dart/browser_test.dart
+++ b/tools/testing/dart/browser_test.dart
@@ -57,22 +57,52 @@ String WrapDartTestInLibrary(String test) =>
#source('$test');
""";
-String DartTestWrapper(String dartHome, String library) =>
+String DartTestWrapper(String domLibrary,
+ String testFramework,
+ String library) =>
"""
#library('test');
-#import('${dartHome}/lib/unittest/unittest.dart', prefix: 'unittest');
-#import('${dartHome}/lib/unittest/html_config.dart', prefix: 'config');
+#import('${domLibrary}');
+#import('${testFramework}');
#import('${library}', prefix: "Test");
+waitForDone() {
+ window.postMessage('unittest-suite-wait-for-done', '*');
+}
+
+pass() {
+ document.body.innerHTML = 'PASS';
+ window.postMessage('unittest-suite-done', '*');
+}
+
+fail(e, trace) {
+ document.body.innerHTML = 'FAIL: \$e, \$trace';
+ window.postMessage('unittest-suite-done', '*');
+}
+
main() {
- config.useHtmlConfiguration();
+ bool needsToWait = false;
+ bool mainIsFinished = false;
+ TestRunner.waitForDoneCallback = () { needsToWait = true; };
+ TestRunner.doneCallback = () {
+ if (mainIsFinished) {
+ pass();
+ } else {
+ needsToWait = false;
+ }
+ };
try {
- unittest.ensureInitialized();
Test.main();
+ if (needsToWait) {
+ waitForDone();
+ } else {
+ pass();
+ }
+ mainIsFinished = true;
} catch(var e, var trace) {
- unittest.reportTestError(e.message, trace);
+ fail(e, trace);
}
}
""";
« no previous file with comments | « tests/isolate/src/TestFramework.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698