| OLD | NEW |
| 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 Loading... |
| 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 })(); |
| OLD | NEW |