Chromium Code Reviews| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 | 192 |
| 193 function stringify(v) | 193 function stringify(v) |
| 194 { | 194 { |
| 195 if (isNewSVGTearOffType(v)) | 195 if (isNewSVGTearOffType(v)) |
| 196 return v.valueAsString; | 196 return v.valueAsString; |
| 197 if (v === 0 && 1/v < 0) | 197 if (v === 0 && 1/v < 0) |
| 198 return "-0"; | 198 return "-0"; |
| 199 else return "" + v; | 199 else return "" + v; |
| 200 } | 200 } |
| 201 | 201 |
| 202 // Stringifies a DOM object. This function stringifies not only own properties | |
| 203 // but also DOM attributes which are on a prototype chain. Note that | |
| 204 // JSON.stringify only stringifies own properties. | |
| 205 function stringifyDOMObject(object) | |
| 206 { | |
| 207 function deepCopy(src) { | |
| 208 if (typeof src != "object") | |
| 209 return src; | |
| 210 var dst = src instanceof Array ? [] : {}; | |
|
jsbell
2015/01/21 18:09:39
Nit: Use Array.isArray()
(instanceof doesn't work
Yuki
2015/01/22 06:53:29
Done.
| |
| 211 for (var property in src) { | |
| 212 dst[property] = deepCopy(src[property]); | |
| 213 } | |
| 214 return dst; | |
| 215 } | |
| 216 return JSON.stringify(deepCopy(object)); | |
| 217 } | |
| 218 | |
| 202 function evalAndLog(_a, _quiet) | 219 function evalAndLog(_a, _quiet) |
| 203 { | 220 { |
| 204 if (typeof _a != "string") | 221 if (typeof _a != "string") |
| 205 debug("WARN: tryAndLog() expects a string argument"); | 222 debug("WARN: tryAndLog() expects a string argument"); |
| 206 | 223 |
| 207 // Log first in case things go horribly wrong or this causes a sync event. | 224 // Log first in case things go horribly wrong or this causes a sync event. |
| 208 if (!_quiet) | 225 if (!_quiet) |
| 209 debug(_a); | 226 debug(_a); |
| 210 | 227 |
| 211 var _av; | 228 var _av; |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 844 testPassed = function(msg) { | 861 testPassed = function(msg) { |
| 845 workerPort.postMessage('PASS:' + msg); | 862 workerPort.postMessage('PASS:' + msg); |
| 846 }; | 863 }; |
| 847 finishJSTest = function() { | 864 finishJSTest = function() { |
| 848 workerPort.postMessage('DONE:'); | 865 workerPort.postMessage('DONE:'); |
| 849 }; | 866 }; |
| 850 debug = function(msg) { | 867 debug = function(msg) { |
| 851 workerPort.postMessage(msg); | 868 workerPort.postMessage(msg); |
| 852 }; | 869 }; |
| 853 } | 870 } |
| OLD | NEW |