Chromium Code Reviews| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 var resultStr = "This is a testharness.js-based test.\n"; | 84 var resultStr = "This is a testharness.js-based test.\n"; |
| 85 | 85 |
| 86 // Check harness_status. If it is not 0, tests did not execute | 86 // Check harness_status. If it is not 0, tests did not execute |
| 87 // correctly, output the error code and message. | 87 // correctly, output the error code and message. |
| 88 if (harness_status.status != 0) { | 88 if (harness_status.status != 0) { |
| 89 resultStr += "Harness Error. harness_status.status = " + | 89 resultStr += "Harness Error. harness_status.status = " + |
| 90 harness_status.status + | 90 harness_status.status + |
| 91 " , harness_status.message = " + | 91 " , harness_status.message = " + |
| 92 harness_status.message + | 92 harness_status.message + |
| 93 "\n"; | 93 "\n"; |
| 94 } else { | |
|
jsbell
2016/06/08 21:12:19
This file is imported, and should not be changed d
| |
| 95 // Iterate through tests array and build string that contains | |
| 96 // results for all tests. | |
| 97 for (var i = 0; i < tests.length; ++i) { | |
| 98 resultStr += convertResult(tests[i].status) + " " + | |
| 99 sanitize(tests[i].name) + " " + | |
| 100 sanitize(tests[i].message) + "\n"; | |
| 101 } | |
| 102 } | 94 } |
| 95 // Iterate through tests array and build string that contains | |
| 96 // results for all tests. | |
| 97 for (var i = 0; i < tests.length; ++i) { | |
| 98 resultStr += convertResult(tests[i].status) + " " + | |
| 99 sanitize(tests[i].name) + " " + | |
| 100 sanitize(tests[i].message) + "\n"; | |
| 101 } | |
| 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 if (isCSSWGTest() || isJSTest()) { | 110 if (isCSSWGTest() || isJSTest()) { |
| 111 // Anything isn't material to the testrunner output, so | 111 // Anything isn't material to the testrunner output, so |
| 112 // should be hidden from the text dump. | 112 // should be hidden from the text dump. |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 132 // another completion callback might generate more results. So, we | 132 // another completion callback might generate more results. So, we |
| 133 // don't dump the results immediately. | 133 // don't dump the results immediately. |
| 134 setTimeout(done, 0); | 134 setTimeout(done, 0); |
| 135 } else { | 135 } else { |
| 136 // Parsing the test HTML isn't finished yet. | 136 // Parsing the test HTML isn't finished yet. |
| 137 window.addEventListener('load', done); | 137 window.addEventListener('load', done); |
| 138 } | 138 } |
| 139 }); | 139 }); |
| 140 | 140 |
| 141 })(); | 141 })(); |
| OLD | NEW |