OLD | NEW |
1 // js-test now supports lazily printing test results which dumps all test | 1 // js-test now supports lazily printing test results which dumps all test |
2 // results once at the end of the test instead of building them up. To enable | 2 // results once at the end of the test instead of building them up. To enable |
3 // this option, call setPrintTestResultsLazily() before running any tests. | 3 // this option, call setPrintTestResultsLazily() before running any tests. |
4 var _lazyTestResults; // Set by setPrintTestResultsLazily(). | 4 var _lazyTestResults; // Set by setPrintTestResultsLazily(). |
5 | 5 |
6 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex
t + pixel results | 6 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex
t + pixel results |
7 if (self.testRunner) { | 7 if (self.testRunner) { |
8 if (self.enablePixelTesting) | 8 if (self.enablePixelTesting) |
9 testRunner.dumpAsTextWithPixelResults(); | 9 testRunner.dumpAsTextWithPixelResults(); |
10 else | 10 else |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // http://crbug.com/308818 : The new implementation of SVGListProperties do
not necessary return the same wrapper object, so === operator would not work. We
compare for their string representation instead. | 183 // http://crbug.com/308818 : The new implementation of SVGListProperties do
not necessary return the same wrapper object, so === operator would not work. We
compare for their string representation instead. |
184 if (isNewSVGTearOffType(expected) && typeof(expected) == typeof(actual) && a
ctual.valueAsString == expected.valueAsString) | 184 if (isNewSVGTearOffType(expected) && typeof(expected) == typeof(actual) && a
ctual.valueAsString == expected.valueAsString) |
185 return true; | 185 return true; |
186 if (typeof(expected) == "number" && isNaN(expected)) | 186 if (typeof(expected) == "number" && isNaN(expected)) |
187 return typeof(actual) == "number" && isNaN(actual); | 187 return typeof(actual) == "number" && isNaN(actual); |
188 if (expected && (Object.prototype.toString.call(expected) == Object.prototyp
e.toString.call([]))) | 188 if (expected && (Object.prototype.toString.call(expected) == Object.prototyp
e.toString.call([]))) |
189 return areArraysEqual(actual, expected); | 189 return areArraysEqual(actual, expected); |
190 return false; | 190 return false; |
191 } | 191 } |
192 | 192 |
| 193 // Returns a sorted array of property names of object. This function returns |
| 194 // not only own properties but also properties on prototype chains. |
| 195 function getAllPropertyNames(object) { |
| 196 var properties = []; |
| 197 for (var property in object) { |
| 198 properties.push(property); |
| 199 } |
| 200 return properties.sort(); |
| 201 } |
| 202 |
193 function stringify(v) | 203 function stringify(v) |
194 { | 204 { |
195 if (isNewSVGTearOffType(v)) | 205 if (isNewSVGTearOffType(v)) |
196 return v.valueAsString; | 206 return v.valueAsString; |
197 if (v === 0 && 1/v < 0) | 207 if (v === 0 && 1/v < 0) |
198 return "-0"; | 208 return "-0"; |
199 else return "" + v; | 209 else return "" + v; |
200 } | 210 } |
201 | 211 |
| 212 // Stringifies a DOM object. This function stringifies not only own properties |
| 213 // but also DOM attributes which are on a prototype chain. Note that |
| 214 // JSON.stringify only stringifies own properties. |
| 215 function stringifyDOMObject(object) |
| 216 { |
| 217 function deepCopy(src) { |
| 218 if (typeof src != "object") |
| 219 return src; |
| 220 var dst = Array.isArray(src) ? [] : {}; |
| 221 for (var property in src) { |
| 222 dst[property] = deepCopy(src[property]); |
| 223 } |
| 224 return dst; |
| 225 } |
| 226 return JSON.stringify(deepCopy(object)); |
| 227 } |
| 228 |
202 function evalAndLog(_a, _quiet) | 229 function evalAndLog(_a, _quiet) |
203 { | 230 { |
204 if (typeof _a != "string") | 231 if (typeof _a != "string") |
205 debug("WARN: tryAndLog() expects a string argument"); | 232 debug("WARN: tryAndLog() expects a string argument"); |
206 | 233 |
207 // Log first in case things go horribly wrong or this causes a sync event. | 234 // Log first in case things go horribly wrong or this causes a sync event. |
208 if (!_quiet) | 235 if (!_quiet) |
209 debug(_a); | 236 debug(_a); |
210 | 237 |
211 var _av; | 238 var _av; |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 testPassed = function(msg) { | 871 testPassed = function(msg) { |
845 workerPort.postMessage('PASS:' + msg); | 872 workerPort.postMessage('PASS:' + msg); |
846 }; | 873 }; |
847 finishJSTest = function() { | 874 finishJSTest = function() { |
848 workerPort.postMessage('DONE:'); | 875 workerPort.postMessage('DONE:'); |
849 }; | 876 }; |
850 debug = function(msg) { | 877 debug = function(msg) { |
851 workerPort.postMessage(msg); | 878 workerPort.postMessage(msg); |
852 }; | 879 }; |
853 } | 880 } |
OLD | NEW |