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

Unified Diff: tools/testing/dart/browser_test.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: tools/testing/dart/browser_test.dart
diff --git a/tools/testing/dart/browser_test.dart b/tools/testing/dart/browser_test.dart
index 7449dd1cee58a914e7cf6e02dfd5c8dfd668f705..f05f24a93d75cec9ff9c5cdf819f0ad21368cd9b 100644
--- a/tools/testing/dart/browser_test.dart
+++ b/tools/testing/dart/browser_test.dart
@@ -57,52 +57,22 @@ String WrapDartTestInLibrary(String test) =>
#source('$test');
""";
-String DartTestWrapper(String domLibrary,
- String testFramework,
- String library) =>
+String DartTestWrapper(String dartHome, String library) =>
"""
#library('test');
-#import('${domLibrary}');
-#import('${testFramework}');
+#import('${dartHome}/lib/unittest/unittest.dart', prefix: 'unittest');
+#import('${dartHome}/lib/unittest/html_config.dart', prefix: 'config');
#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() {
- bool needsToWait = false;
- bool mainIsFinished = false;
- TestRunner.waitForDoneCallback = () { needsToWait = true; };
- TestRunner.doneCallback = () {
- if (mainIsFinished) {
- pass();
- } else {
- needsToWait = false;
- }
- };
+ config.useHtmlConfiguration();
try {
+ unittest.ensureInitialized();
Test.main();
- if (needsToWait) {
- waitForDone();
- } else {
- pass();
- }
- mainIsFinished = true;
} catch(var e, var trace) {
- fail(e, trace);
+ unittest.notifyError(e.message, trace);
}
}
""";

Powered by Google App Engine
This is Rietveld 408576698