| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 function isCSSWGTest() { | 59 function isCSSWGTest() { |
| 60 var flags = document.querySelector('meta[name=flags]'), | 60 var flags = document.querySelector('meta[name=flags]'), |
| 61 content = flags ? flags.getAttribute('content') : null; | 61 content = flags ? flags.getAttribute('content') : null; |
| 62 return content && content.match(/\bdom\b/); | 62 return content && content.match(/\bdom\b/); |
| 63 } | 63 } |
| 64 | 64 |
| 65 function isJSTest() { | 65 function isJSTest() { |
| 66 return !!document.querySelector('script[src*="/resources/testharness"]')
; | 66 return !!document.querySelector('script[src*="/resources/testharness"]')
; |
| 67 } | 67 } |
| 68 | 68 |
| 69 |
| 69 function injectSyntheticInput() { | 70 function injectSyntheticInput() { |
| 70 var path = window.location.pathname; | 71 var path = window.location.pathname; |
| 71 if (path.match(/imported\/wpt\/.*\.html$/)) { | 72 if (path.match(/imported\/wpt\/.*\.html$/)) { |
| 73 // Set a global variable for the address of automated input script i
f they need to use it. |
| 74 var automated_input_scripts_folder = path.replace(/imported\/wpt\/(.
*)\.html$/, 'imported/wpt_automation'); |
| 75 |
| 76 importAutomationScript = function(relativePath) { |
| 77 var common_script = document.createElement('script'); |
| 78 common_script.setAttribute('src', automated_input_scripts_folder +
relativePath); |
| 79 document.head.appendChild(common_script); |
| 80 } |
| 81 |
| 72 path = path.replace(/imported\/wpt\/(.*)\.html$/, "imported/wpt_auto
mation/$1-input.js"); | 82 path = path.replace(/imported\/wpt\/(.*)\.html$/, "imported/wpt_auto
mation/$1-input.js"); |
| 73 var input_script = document.createElement('script'); | 83 var input_script = document.createElement('script'); |
| 74 input_script.setAttribute('src', path); | 84 input_script.setAttribute('src', path); |
| 75 document.head.appendChild(input_script); | 85 document.head.appendChild(input_script); |
| 76 } | 86 } |
| 77 } | 87 } |
| 78 | 88 |
| 79 var didDispatchLoadEvent = false; | 89 var didDispatchLoadEvent = false; |
| 80 var handleLoad = function() { | 90 var handleLoad = function() { |
| 81 didDispatchLoadEvent = true; | 91 didDispatchLoadEvent = true; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // another completion callback might generate more results. So, we | 156 // another completion callback might generate more results. So, we |
| 147 // don't dump the results immediately. | 157 // don't dump the results immediately. |
| 148 setTimeout(done, 0); | 158 setTimeout(done, 0); |
| 149 } else { | 159 } else { |
| 150 // Parsing the test HTML isn't finished yet. | 160 // Parsing the test HTML isn't finished yet. |
| 151 window.addEventListener('load', done); | 161 window.addEventListener('load', done); |
| 152 } | 162 } |
| 153 }); | 163 }); |
| 154 | 164 |
| 155 })(); | 165 })(); |
| OLD | NEW |