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

Side by Side Diff: third_party/WebKit/LayoutTests/resources/testharnessreport.js

Issue 2639113002: testharnessreport: Remove isCSSWGTest() and isJSTest(). (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/LayoutTests/external/wpt/resources/testharnessreport.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // Escape null characters, otherwise diff will think the file is binary. 69 // Escape null characters, otherwise diff will think the file is binary.
70 text = text.replace(/\0/g, "\\0"); 70 text = text.replace(/\0/g, "\\0");
71 // Escape carriage returns as they break rietveld's difftools. 71 // Escape carriage returns as they break rietveld's difftools.
72 text = text.replace(/\r/g, "\\r"); 72 text = text.replace(/\r/g, "\\r");
73 // Replace machine-dependent path with "...". 73 // Replace machine-dependent path with "...".
74 if (localPathRegExp) 74 if (localPathRegExp)
75 text = text.replace(localPathRegExp, "..."); 75 text = text.replace(localPathRegExp, "...");
76 return text; 76 return text;
77 } 77 }
78 78
79 // If the test has a meta tag named flags and the content contains "dom",
80 // then it's a CSSWG test.
81 function isCSSWGTest() {
82 var flags = document.querySelector('meta[name=flags]'),
83 content = flags ? flags.getAttribute('content') : null;
84 return content && content.match(/\bdom\b/);
85 }
86
87 function isJSTest() {
88 return !!document.querySelector('script[src*="/resources/testharness"]') ;
89 }
90
91 function isWPTManualTest() { 79 function isWPTManualTest() {
92 var path = location.pathname; 80 var path = location.pathname;
93 if (location.hostname == 'web-platform.test' && path.endsWith('-manual.h tml')) 81 if (location.hostname == 'web-platform.test' && path.endsWith('-manual.h tml'))
94 return true; 82 return true;
95 return /\/imported\/wpt\/.*-manual\.html$/.test(path); 83 return /\/imported\/wpt\/.*-manual\.html$/.test(path);
96 } 84 }
97 85
98 // Returns a directory part relative to WPT root and a basename part of the 86 // Returns a directory part relative to WPT root and a basename part of the
99 // current test. e.g. 87 // current test. e.g.
100 // Current test: file:///.../LayoutTests/external/wpt/pointerevents/foobar.h tml 88 // Current test: file:///.../LayoutTests/external/wpt/pointerevents/foobar.h tml
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // Set results element's textContent to the results string. 200 // Set results element's textContent to the results string.
213 results.textContent = resultStr; 201 results.textContent = resultStr;
214 202
215 function done() { 203 function done() {
216 if (self.testRunner) { 204 if (self.testRunner) {
217 // The following DOM operations may show console messages. We 205 // The following DOM operations may show console messages. We
218 // suppress them because they are not related to the running 206 // suppress them because they are not related to the running
219 // test. 207 // test.
220 testRunner.setDumpConsoleMessages(false); 208 testRunner.setDumpConsoleMessages(false);
221 209
222 if (isCSSWGTest() || isJSTest()) { 210 // Anything isn't material to the testrunner output, so should
223 // Anything isn't material to the testrunner output, so 211 // be hidden from the text dump.
224 // should be hidden from the text dump. 212 if (output_document.body && output_document.body.tagName == 'BOD Y')
225 if (output_document.body && output_document.body.tagName == 'BODY') 213 output_document.body.textContent = '';
226 output_document.body.textContent = '';
227 }
228 } 214 }
229 215
230 // Add results element to output_document. 216 // Add results element to output_document.
231 if (!output_document.body || output_document.body.tagName != 'BODY') { 217 if (!output_document.body || output_document.body.tagName != 'BODY') {
232 if (!output_document.documentElement) 218 if (!output_document.documentElement)
233 output_document.appendChild(output_document.createElement('h tml')); 219 output_document.appendChild(output_document.createElement('h tml'));
234 else if (output_document.body) // output_document.body is <frame set>. 220 else if (output_document.body) // output_document.body is <frame set>.
235 output_document.body.remove(); 221 output_document.body.remove();
236 output_document.documentElement.appendChild(output_document.crea teElement("body")); 222 output_document.documentElement.appendChild(output_document.crea teElement("body"));
237 } 223 }
238 output_document.body.appendChild(results); 224 output_document.body.appendChild(results);
239 225
240 if (self.testRunner) 226 if (self.testRunner)
241 testRunner.notifyDone(); 227 testRunner.notifyDone();
242 } 228 }
243 229
244 if (didDispatchLoadEvent || output_document.readyState != 'loading') { 230 if (didDispatchLoadEvent || output_document.readyState != 'loading') {
245 // This function might not be the last 'completion callback', and 231 // This function might not be the last 'completion callback', and
246 // another completion callback might generate more results. So, we 232 // another completion callback might generate more results. So, we
247 // don't dump the results immediately. 233 // don't dump the results immediately.
248 setTimeout(done, 0); 234 setTimeout(done, 0);
249 } else { 235 } else {
250 // Parsing the test HTML isn't finished yet. 236 // Parsing the test HTML isn't finished yet.
251 window.addEventListener('load', done); 237 window.addEventListener('load', done);
252 } 238 }
253 }); 239 });
254 240
255 })(); 241 })();
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/external/wpt/resources/testharnessreport.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698