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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/resources/testharnessreport.js

Issue 1977313003: testharnessreport: Clear BODY content regardless of existence of <div id=log> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unregister_service_worker() Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * THIS FILE INTENTIONALLY LEFT BLANK 2 * THIS FILE INTENTIONALLY LEFT BLANK
3 * 3 *
4 * More specifically, this file is intended for vendors to implement 4 * More specifically, this file is intended for vendors to implement
5 * code needed to integrate testharness.js tests with their own test systems. 5 * code needed to integrate testharness.js tests with their own test systems.
6 * 6 *
7 * Typically such integration will attach callbacks when each test is 7 * Typically such integration will attach callbacks when each test is
8 * has run, using add_result_callback(callback(test)), or when the whole test fi le has 8 * has run, using add_result_callback(callback(test)), or when the whole test fi le has
9 * completed, using add_completion_callback(callback(tests, harness_status)). 9 * completed, using add_completion_callback(callback(tests, harness_status)).
10 * 10 *
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 sanitize(tests[i].message) + "\n"; 100 sanitize(tests[i].message) + "\n";
101 } 101 }
102 } 102 }
103 resultStr += "Harness: the test ran to completion.\n"; 103 resultStr += "Harness: the test ran to completion.\n";
104 104
105 // Set results element's textContent to the results string. 105 // Set results element's textContent to the results string.
106 results.textContent = resultStr; 106 results.textContent = resultStr;
107 107
108 function done() { 108 function done() {
109 if (self.testRunner) { 109 if (self.testRunner) {
110 var logDiv = document.getElementById('log'); 110 if (isCSSWGTest() || isJSTest()) {
111 if ((isCSSWGTest() || isJSTest()) && logDiv) { 111 // Anything isn't material to the testrunner output, so
112 // Assume it's a CSSWG style test, and anything other than
113 // the log div isn't material to the testrunner output, so
114 // should be hidden from the text dump. 112 // should be hidden from the text dump.
115 document.body.textContent = ''; 113 if (document.body)
114 document.body.textContent = '';
116 } 115 }
117 } 116 }
118 117
119 // Add results element to document. 118 // Add results element to document.
120 if (!document.body) { 119 if (!document.body) {
121 if (!document.documentElement) 120 if (!document.documentElement)
122 document.appendChild(document.createElement('html')); 121 document.appendChild(document.createElement('html'));
123 document.documentElement.appendChild(document.createElement("bod y")); 122 document.documentElement.appendChild(document.createElement("bod y"));
124 } 123 }
125 document.body.appendChild(results); 124 document.body.appendChild(results);
126 125
127 if (self.testRunner) 126 if (self.testRunner)
128 testRunner.notifyDone(); 127 testRunner.notifyDone();
129 } 128 }
130 129
131 if (didDispatchLoadEvent || document.readyState != 'loading') { 130 if (didDispatchLoadEvent || document.readyState != 'loading') {
132 // This function might not be the last 'completion callback', and 131 // This function might not be the last 'completion callback', and
133 // another completion callback might generate more results. So, we 132 // another completion callback might generate more results. So, we
134 // don't dump the results immediately. 133 // don't dump the results immediately.
135 setTimeout(done, 0); 134 setTimeout(done, 0);
136 } else { 135 } else {
137 // Parsing the test HTML isn't finished yet. 136 // Parsing the test HTML isn't finished yet.
138 window.addEventListener('load', done); 137 window.addEventListener('load', done);
139 } 138 }
140 }); 139 });
141 140
142 })(); 141 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698