Skip to content

Commit

Permalink
Merge pull request #110 from w3c/jgraham/servodriver_no_dom
Browse files Browse the repository at this point in the history
Don't use the DOM to store results for servodriver.
  • Loading branch information
jgraham committed May 19, 2015
2 parents 932bab6 + a6908f9 commit d511c6a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 47 deletions.
14 changes: 7 additions & 7 deletions wptrunner/executors/reftest-wait_servodriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
callback = arguments[arguments.length - 1];

function check_done() {
if (!document.body.classList.contains('reftest-wait')) {
callback();
} else {
setTimeout(check_done, 50);
}
if (!document.body.classList.contains('reftest-wait')) {
callback();
} else {
setTimeout(check_done, 50);
}
}

if (document.readyState === 'complete') {
check_done();
check_done();
} else {
addEventListener("load", check_done, false);
addEventListener("load", check_done);
}
30 changes: 2 additions & 28 deletions wptrunner/executors/testharness_servodriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,5 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var callback = arguments[arguments.length - 1];

var results_id = "__testharness__results__";

function done() {
clearTimeout(timer);
callback(document.getElementById(results_id).textContent);
}

// Work around the fact that load isn't blocked on the scripts
// actually running
(function setup() {
if (document.getElementById(results_id)) {
done();
} else {
if (window.add_completion_callback) {
add_completion_callback(function() {
add_completion_callback(done);
});
} else {
setTimeout(setup, 20);
}
}
})()

var timer = setTimeout(function() {
timeout();
}, %(timeout)s);
window.__wd_results_callback__ = arguments[arguments.length - 1];
window.__wd_results_timer__ = setTimeout(timeout, %(timeout)s);
25 changes: 13 additions & 12 deletions wptrunner/testharnessreport-servodriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var props = {output:%(output)d};

setup(props);
setup({output:%(output)d});

add_completion_callback(function() {
add_completion_callback(function (tests, status) {
var results_element = document.createElement("script");
results_element.type = "text/json";
results_element.id = "__testharness__results__";
var test_results = tests.map(function(x) {
return {name:x.name, status:x.status, message:x.message, stack:x.stack}
});
data = {tests:test_results,
status: status.status,
message: status.message,
stack: status.stack};
results_element.textContent = JSON.stringify(data);
document.documentElement.lastChild.appendChild(results_element);
var results = JSON.stringify({tests:test_results,
status: status.status,
message: status.message,
stack: status.stack});
(function done() {
if (window.__wd_results_callback__) {
clearTimeout(__wd_results_timer__);
__wd_results_callback__(results)
} else {
setTimeout(done, 20);
}
})()
})
});

0 comments on commit d511c6a

Please sign in to comment.