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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 _exception = e; | 256 _exception = e; |
257 } | 257 } |
258 var _bv = eval(_b); | 258 var _bv = eval(_b); |
259 | 259 |
260 if (_exception) | 260 if (_exception) |
261 testFailed(_a + " should be " + _bv + ". Threw exception " + _exception); | 261 testFailed(_a + " should be " + _bv + ". Threw exception " + _exception); |
262 else if (isResultCorrect(_av, _bv) || (typeof opt_tolerance == 'number' && typ
eof _av == 'number' && Math.abs(_av - _bv) <= opt_tolerance)) { | 262 else if (isResultCorrect(_av, _bv) || (typeof opt_tolerance == 'number' && typ
eof _av == 'number' && Math.abs(_av - _bv) <= opt_tolerance)) { |
263 if (!quiet) { | 263 if (!quiet) { |
264 testPassed(_a + " is " + _b); | 264 testPassed(_a + " is " + _b); |
265 } | 265 } |
266 } else if (typeof(_av) == typeof(_bv)) | 266 } else if (typeof(_av) == typeof(_bv)){ |
267 testFailed(_a + " should be " + _bv + ". Was " + stringify(_av) + "."); | 267 testFailed(_a + " should be " + _bv + ". Was " + stringify(_av) + "."); |
| 268 } |
268 else | 269 else |
269 testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was "
+ _av + " (of type " + typeof _av + ")."); | 270 testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was "
+ _av + " (of type " + typeof _av + ")."); |
270 } | 271 } |
271 | 272 |
272 // Execute condition every 5 milliseconds until it succeed or failureTime is rea
ched. | 273 // Execute condition every 5 milliseconds until it succeed or failureTime is rea
ched. |
273 // completionHandler is executed on success, failureHandler is executed on timeo
ut. | 274 // completionHandler is executed on success, failureHandler is executed on timeo
ut. |
274 function _waitForCondition(condition, failureTime, completionHandler, failureHan
dler) | 275 function _waitForCondition(condition, failureTime, completionHandler, failureHan
dler) |
275 { | 276 { |
276 if (condition()) { | 277 if (condition()) { |
277 completionHandler(); | 278 completionHandler(); |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 testPassed = function(msg) { | 891 testPassed = function(msg) { |
891 workerPort.postMessage('PASS:' + msg); | 892 workerPort.postMessage('PASS:' + msg); |
892 }; | 893 }; |
893 finishJSTest = function() { | 894 finishJSTest = function() { |
894 workerPort.postMessage('DONE:'); | 895 workerPort.postMessage('DONE:'); |
895 }; | 896 }; |
896 debug = function(msg) { | 897 debug = function(msg) { |
897 workerPort.postMessage(msg); | 898 workerPort.postMessage(msg); |
898 }; | 899 }; |
899 } | 900 } |
OLD | NEW |