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

Unified Diff: dart/pkg/unittest/test_controller.js

Issue 10916259: Enable wrapper-less browser tests on selenium. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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 | « no previous file | dart/tests/html/html.status » ('j') | dart/tools/testing/dart/test_suite.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/pkg/unittest/test_controller.js
diff --git a/dart/pkg/unittest/test_controller.js b/dart/pkg/unittest/test_controller.js
index 5b2152103bf5aff2ecc26f92523f547632898e50..b5734b93e78d000f21799c3d611a95bd1f2e3bd8 100644
--- a/dart/pkg/unittest/test_controller.js
+++ b/dart/pkg/unittest/test_controller.js
@@ -11,6 +11,8 @@ if (navigator.webkitStartDart) {
navigator.webkitStartDart();
}
+// testRunner is provided by DRT or WebKit's layout tests.
+// It is not available in selenium tests.
var testRunner = window.testRunner || window.layoutTestController;
var waitForDone = false;
@@ -29,7 +31,7 @@ function processMessage(msg) {
window.postMessage('unittest-suite-success', '*');
}
} else if (msg == 'unittest-suite-success') {
- document.body.innerHTML += '<pre>PASS</pre>';
+ dartPrint('PASS');
if (testRunner) testRunner.notifyDone();
} else if (msg == 'unittest-suite-fail') {
showErrorAndExit('Some tests failed.');
@@ -48,13 +50,12 @@ window.addEventListener("message", onReceive, false);
function showErrorAndExit(message) {
if (message) {
- var element = document.createElement('pre');
- element.innerHTML = message;
- document.body.appendChild(element);
- }
- if (testRunner) {
- testRunner.notifyDone();
+ dartPrint('Error: ' + String(message));
}
+ // dart/tools/testing/run_selenium.py is looking for either PASS or
+ // FAIL and will continue polling until one of these words show up.
+ dartPrint('FAIL');
+ if (testRunner) testRunner.notifyDone();
}
function onLoad(e) {
@@ -109,6 +110,11 @@ function dartPrint(msg) {
// Dart [main] directly. The argument is a closure that invokes main.
function dartMainRunner(main) {
window.postMessage('dart-calling-main', '*');
- main();
+ try {
+ main();
+ } catch (e) {
+ window.postMessage('unittest-suite-fail', '*');
+ return;
+ }
window.postMessage('dart-main-done', '*');
}
« no previous file with comments | « no previous file | dart/tests/html/html.status » ('j') | dart/tools/testing/dart/test_suite.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698