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

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

Issue 15742006: Update browser controller and unittest lib to use start marker to figure out when to start new test… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 | tools/testing/dart/browser_controller.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/lib/test_controller.js
===================================================================
--- pkg/unittest/lib/test_controller.js (revision 23052)
+++ pkg/unittest/lib/test_controller.js (working copy)
@@ -33,8 +33,17 @@
var waitForDone = false;
-function sendDomToTestDriver() {
+function notifyStart() {
if (window.opener) {
+ window.opener.postMessage("STARTING", "*");
+ }
+}
+
+function notifyDone() {
+ if (testRunner) testRunner.notifyDone();
+ // To support in browser launching of tests we post back start and result
+ // messages to the window.opener.
+ if (window.opener) {
window.opener.postMessage(window.document.body.innerHTML, "*");
}
}
@@ -42,8 +51,7 @@
function processMessage(msg) {
if (typeof msg != 'string') return;
if (msg == 'unittest-suite-done') {
- if (testRunner) testRunner.notifyDone();
- sendDomToTestDriver();
+ notifyDone();
} else if (msg == 'unittest-suite-wait-for-done') {
waitForDone = true;
if (testRunner) testRunner.startedDartTest = true;
@@ -55,8 +63,7 @@
}
} else if (msg == 'unittest-suite-success') {
dartPrint('PASS');
- if (testRunner) testRunner.notifyDone();
- sendDomToTestDriver();
+ notifyDone();
} else if (msg == 'unittest-suite-fail') {
showErrorAndExit('Some tests failed.');
}
@@ -79,8 +86,7 @@
// 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();
- sendDomToTestDriver();
+ notifyDone();
}
function onLoad(e) {
@@ -115,8 +121,7 @@
// posted message.
setTimeout(function() {
if (testRunner && !testRunner.startedDartTest) {
- testRunner.notifyDone();
- sendDomToTestDriver();
+ notifyDone();
}
}, 0);
}, 50);
@@ -141,6 +146,8 @@
// dart2js will generate code to call this function instead of calling
// Dart [main] directly. The argument is a closure that invokes main.
function dartMainRunner(main) {
+ // We call notifyStart here to notify the encapsulating browser.
+ notifyStart();
window.postMessage('dart-calling-main', '*');
try {
main();
« no previous file with comments | « no previous file | tools/testing/dart/browser_controller.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698