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

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
Index: pkg/unittest/lib/test_controller.js
===================================================================
--- pkg/unittest/lib/test_controller.js (revision 22979)
+++ pkg/unittest/lib/test_controller.js (working copy)
@@ -33,8 +33,18 @@
var waitForDone = false;
-function sendDomToTestDriver() {
+function start() {
kustermann 2013/05/22 17:08:50 For symmetry reasons, I'd call it 'notifyStart()'.
ricow1 2013/05/22 17:36:12 Done.
+ if (testRunner) testRunner.startedDartTest = true;
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,21 +52,19 @@
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;
+ start();
} else if (msg == 'dart-calling-main') {
- if (testRunner) testRunner.startedDartTest = true;
+ start();
kustermann 2013/05/22 17:08:50 When we reach this point, the test has already bee
ricow1 2013/05/22 17:36:12 That is fine, we do 2 postmessage there, they will
} else if (msg == 'dart-main-done') {
if (!waitForDone) {
window.postMessage('unittest-suite-success', '*');
}
} 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 +87,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();
+ nofityDone();
}
function onLoad(e) {
@@ -115,8 +122,7 @@
// posted message.
setTimeout(function() {
if (testRunner && !testRunner.startedDartTest) {
- testRunner.notifyDone();
- sendDomToTestDriver();
+ notifyDone();
}
}, 0);
}, 50);
« no previous file with comments | « no previous file | tools/testing/dart/browser_controller.dart » ('j') | tools/testing/dart/browser_controller.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698