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

Unified Diff: LayoutTests/http/tests/resources/testharnessreport.js

Issue 1151323002: testharnessreport: Hide unnecessary elements for JS tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Sync all of testharnessreport.js, and update test results Created 5 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: LayoutTests/http/tests/resources/testharnessreport.js
diff --git a/LayoutTests/http/tests/resources/testharnessreport.js b/LayoutTests/http/tests/resources/testharnessreport.js
index 89b3b6f42e2cdeabf7d0877170a78a21b8b3b617..6e35da5ae1715880635e00aab9953c2dfa84b657 100644
--- a/LayoutTests/http/tests/resources/testharnessreport.js
+++ b/LayoutTests/http/tests/resources/testharnessreport.js
@@ -38,6 +38,19 @@ function convertResult(resultStatus) {
*/
setup({"output":false});
+/* If the test has a meta tag named flags and the content contains "dom", then it's a CSSWG test.
+ */
+function isCSSWGTest() {
+ var flags = document.querySelector('meta[name=flags]'),
+ content = flags ? flags.getAttribute('content') : null;
+
+ return content && content.match(/\bdom\b/);
+}
+
+function isJSTest() {
+ return !!document.querySelector('script[src*="/resources/testharness"]');
+}
+
/* Using a callback function, test results will be added to the page in a
* manner that allows dumpAsText to produce readable test results
*/
@@ -82,9 +95,30 @@ add_completion_callback(function (tests, harness_status) {
// Set results element's textContent to the results string
results.textContent = resultStr;
- // Add results element to document
- document.body.appendChild(results);
+ function done() {
+ if (self.testRunner) {
+ var logDiv = document.getElementById('log');
+ if ((isCSSWGTest() || isJSTest()) && logDiv) {
+ // Assume it's a CSSWG style test, and anything other than the log div isn't
+ // material to the testrunner output, so should be hidden from the text dump
+ for (var i = 0; i < document.body.children.length; i++) {
+ if (document.body.children[i] === logDiv) continue;
- if (self.testRunner)
- testRunner.notifyDone();
+ document.body.children[i].style.visibility = "hidden";
+ }
+ }
+ }
+
+ // Add results element to document
+ document.body.appendChild(results);
+
+ if (self.testRunner)
+ testRunner.notifyDone();
+ }
+
+ if (!document.body || document.readyState === 'loading') {
+ window.addEventListener('load', done);
+ } else {
+ done();
+ }
});

Powered by Google App Engine
This is Rietveld 408576698