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

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/resources/testharnessreport.js

Issue 2547653005: testharness.js: support output_document setting. (Closed)
Patch Set: Created 4 years 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 | third_party/WebKit/LayoutTests/resources/testharnessreport.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/imported/wpt/resources/testharnessreport.js
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/resources/testharnessreport.js b/third_party/WebKit/LayoutTests/imported/wpt/resources/testharnessreport.js
index 145a0c44d0c20bbc65dea70bf634752b3ba4c2a3..fc6222fe32b4f193e9a7e31c030cc35ca895e465 100644
--- a/third_party/WebKit/LayoutTests/imported/wpt/resources/testharnessreport.js
+++ b/third_party/WebKit/LayoutTests/imported/wpt/resources/testharnessreport.js
@@ -14,6 +14,8 @@
(function() {
+ var output_document = document;
+
// Setup for WebKit JavaScript tests
if (self.testRunner) {
testRunner.dumpAsText();
@@ -146,12 +148,17 @@
}
}, { once: true });
+ add_start_callback(function(properties) {
+ if (properties.output_document)
+ output_document = properties.output_document;
+ });
+
// Using a callback function, test results will be added to the page in a
// manner that allows dumpAsText to produce readable test results.
add_completion_callback(function (tests, harness_status) {
// Create element to hold results.
- var results = document.createElement("pre");
+ var results = output_document.createElement("pre");
// Declare result string.
var resultStr = "This is a testharness.js-based test.\n";
@@ -167,7 +174,7 @@
}
// reflection tests contain huge number of tests, and Chromium code
// review tool has the 1MB diff size limit. We merge PASS lines.
- if (document.URL.indexOf("/html/dom/reflection") >= 0) {
+ if (output_document.URL.indexOf("/html/dom/reflection") >= 0) {
for (var i = 0; i < tests.length; ++i) {
if (tests[i].status == 0) {
var colon = tests[i].name.indexOf(':');
@@ -215,26 +222,26 @@
if (isCSSWGTest() || isJSTest()) {
// Anything isn't material to the testrunner output, so
// should be hidden from the text dump.
- if (document.body && document.body.tagName == 'BODY')
- document.body.textContent = '';
+ if (output_document.body && output_document.body.tagName == 'BODY')
+ output_document.body.textContent = '';
}
}
- // Add results element to document.
- if (!document.body || document.body.tagName != 'BODY') {
- if (!document.documentElement)
- document.appendChild(document.createElement('html'));
- else if (document.body) // document.body is <frameset>.
- document.body.remove();
- document.documentElement.appendChild(document.createElement("body"));
+ // Add results element to output_document.
+ if (!output_document.body || output_document.body.tagName != 'BODY') {
+ if (!output_document.documentElement)
+ output_document.appendChild(output_document.createElement('html'));
+ else if (output_document.body) // output_document.body is <frameset>.
+ output_document.body.remove();
+ output_document.documentElement.appendChild(output_document.createElement("body"));
}
- document.body.appendChild(results);
+ output_document.body.appendChild(results);
if (self.testRunner)
testRunner.notifyDone();
}
- if (didDispatchLoadEvent || document.readyState != 'loading') {
+ if (didDispatchLoadEvent || output_document.readyState != 'loading') {
// This function might not be the last 'completion callback', and
// another completion callback might generate more results. So, we
// don't dump the results immediately.
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/resources/testharnessreport.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698