OLD | NEW |
1 var console = null; | 1 var console = null; |
2 var printFullTestDetails = true; // This is optionaly switched of by test whose
tested values can differ. (see disableFullTestDetailsPrinting()) | 2 var printFullTestDetails = true; // This is optionaly switched of by test whose
tested values can differ. (see disableFullTestDetailsPrinting()) |
3 var runPixelTests; | 3 var runPixelTests; |
4 | 4 |
5 logConsole(); | 5 logConsole(); |
6 | 6 |
7 if (window.layoutTestController) { | 7 if (window.layoutTestController) { |
8 layoutTestController.dumpAsText(runPixelTests); | 8 layoutTestController.dumpAsText(runPixelTests); |
9 layoutTestController.waitUntilDone(); | 9 layoutTestController.waitUntilDone(); |
10 } | 10 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 msg += ", OBSERVED '<em>" + observed + "</em>'"; | 91 msg += ", OBSERVED '<em>" + observed + "</em>'"; |
92 | 92 |
93 logResult(success, msg); | 93 logResult(success, msg); |
94 } | 94 } |
95 | 95 |
96 function waitForEventAndEnd(element, eventName, funcString) | 96 function waitForEventAndEnd(element, eventName, funcString) |
97 { | 97 { |
98 waitForEvent(element, eventName, funcString, true) | 98 waitForEvent(element, eventName, funcString, true) |
99 } | 99 } |
100 | 100 |
101 function waitForEventOnce(element, eventName, func, endit) | 101 function waitForEvent(element, eventName, func, endit) |
102 { | |
103 waitForEvent(element, eventName, func, endit, true) | |
104 } | |
105 | |
106 function waitForEvent(element, eventName, func, endit, once) | |
107 { | 102 { |
108 function _eventCallback(event) | 103 function _eventCallback(event) |
109 { | 104 { |
110 if (once) | |
111 element.removeEventListener(eventName, _eventCallback); | |
112 | |
113 consoleWrite("EVENT(" + eventName + ")"); | 105 consoleWrite("EVENT(" + eventName + ")"); |
114 | 106 |
115 if (func) | 107 if (func) |
116 func(event); | 108 func(event); |
117 | 109 |
118 if (endit) | 110 if (endit) |
119 endTest(); | 111 endTest(); |
120 } | 112 } |
121 | 113 |
122 element.addEventListener(eventName, _eventCallback); | 114 element.addEventListener(eventName, _eventCallback); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 else | 148 else |
157 consoleWrite(text + " <span style='color:red'>FAIL</span>"); | 149 consoleWrite(text + " <span style='color:red'>FAIL</span>"); |
158 } | 150 } |
159 | 151 |
160 function consoleWrite(text) | 152 function consoleWrite(text) |
161 { | 153 { |
162 if (testEnded) | 154 if (testEnded) |
163 return; | 155 return; |
164 logConsole().innerHTML += text + "<br>"; | 156 logConsole().innerHTML += text + "<br>"; |
165 } | 157 } |
OLD | NEW |