Skip to content

Commit

Permalink
Merge pull request #117 from w3c/jgraham/marionette_postmessage_fixup
Browse files Browse the repository at this point in the history
Fix marionette executor's use of postMessage events to get test results
  • Loading branch information
jgraham committed Jun 3, 2015
2 parents 85935d4 + 029b0a5 commit cabaf16
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
30 changes: 17 additions & 13 deletions wptrunner/executors/testharness_marionette.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,27 @@
window.wrappedJSObject.timeout_multiplier = %(timeout_multiplier)d;
window.wrappedJSObject.explicit_timeout = %(explicit_timeout)d;

window.wrappedJSObject.addEventListener("message", function(event) {
var tests = event.data[0];
var status = event.data[1];
clearTimeout(timer);
marionetteScriptFinished({test:"%(url)s",
tests: tests,
status: status.status,
message: status.message,
stack: status.stack});
window.wrappedJSObject.addEventListener("message", function listener(event) {
if (event.data.type != "complete") {
return;
}
window.wrappedJSObject.removeEventListener("message", listener);
clearTimeout(timer);
var tests = event.data.tests;
var status = event.data.status;
marionetteScriptFinished({test:"%(url)s",
tests: tests,
status: status.status,
message: status.message,
stack: status.stack});
}, false);

window.wrappedJSObject.win = window.open("%(abs_url)s", "%(window_id)s");

var timer = null;
if (%(timeout)s) {
timer = setTimeout(function() {
log("Timeout fired");
window.wrappedJSObject.win.timeout();
}, %(timeout)s);
timer = setTimeout(function() {
log("Timeout fired");
window.wrappedJSObject.win.timeout();
}, %(timeout)s);
}
3 changes: 2 additions & 1 deletion wptrunner/testharnessreport.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var props = {output:%(output)d,
explicit_timeout: true};
explicit_timeout: true,
message_events: ["completion"]};

if (window.opener && "timeout_multiplier" in window.opener) {
props["timeout_multiplier"] = window.opener.timeout_multiplier;
Expand Down

0 comments on commit cabaf16

Please sign in to comment.