| 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 var _lazyDescription; // Set by description() after setPrintTestResultsLazily(). | 5 var _lazyDescription; // Set by description() after setPrintTestResultsLazily(). |
| 6 | 6 |
| 7 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex
t + pixel results | 7 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex
t + pixel results |
| 8 if (self.testRunner) { | 8 if (self.testRunner) { |
| 9 if (self.enablePixelTesting) | 9 if (self.enablePixelTesting) |
| 10 testRunner.dumpAsTextWithPixelResults(); | 10 testRunner.dumpAsTextWithPixelResults(); |
| 11 else | 11 else |
| 12 testRunner.dumpAsText(); | 12 testRunner.dumpAsText(); |
| 13 } | 13 } |
| 14 | 14 |
| 15 var isJsTest = true; | 15 var isJsTest = true; |
| 16 | 16 |
| 17 var description, debug, successfullyParsed, getOrCreateTestElement; | 17 var description, debug, successfullyParsed, getOrCreateTestElement; |
| 18 | |
| 19 var expectingError; // set by shouldHaveError() | 18 var expectingError; // set by shouldHaveError() |
| 20 var expectedErrorMessage; // set by onerror when expectingError is true | 19 var expectedErrorMessage; // set by onerror when expectingError is true |
| 21 var unexpectedErrorMessage; // set by onerror when expectingError is not true | 20 var unexpectedErrorMessage; // set by onerror when expectingError is not true |
| 21 var defaultTimeoutForShouldBecome = self.defaultTimeoutForShouldBecome || 500; |
| 22 | 22 |
| 23 (function() { | 23 (function() { |
| 24 | 24 |
| 25 getOrCreateTestElement = function(id, tagName) | 25 getOrCreateTestElement = function(id, tagName) |
| 26 { | 26 { |
| 27 var element = document.getElementById(id); | 27 var element = document.getElementById(id); |
| 28 if (element) | 28 if (element) |
| 29 return element; | 29 return element; |
| 30 | 30 |
| 31 element = document.createElement(tagName); | 31 element = document.createElement(tagName); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 }); | 273 }); |
| 274 } | 274 } |
| 275 } | 275 } |
| 276 | 276 |
| 277 function shouldBecomeEqual(_a, _b, _completionHandler, _timeout) | 277 function shouldBecomeEqual(_a, _b, _completionHandler, _timeout) |
| 278 { | 278 { |
| 279 if (typeof _a != "string" || typeof _b != "string") | 279 if (typeof _a != "string" || typeof _b != "string") |
| 280 debug("WARN: shouldBecomeEqual() expects string arguments"); | 280 debug("WARN: shouldBecomeEqual() expects string arguments"); |
| 281 | 281 |
| 282 if (_timeout === undefined) | 282 if (_timeout === undefined) |
| 283 _timeout = 500; | 283 _timeout = defaultTimeoutForShouldBecome; |
| 284 | 284 |
| 285 var _bv; | 285 var _bv; |
| 286 var _condition = function() { | 286 var _condition = function() { |
| 287 var _exception; | 287 var _exception; |
| 288 var _av; | 288 var _av; |
| 289 try { | 289 try { |
| 290 _av = eval(_a); | 290 _av = eval(_a); |
| 291 } catch (e) { | 291 } catch (e) { |
| 292 _exception = e; | 292 _exception = e; |
| 293 } | 293 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 } | 406 } |
| 407 } else | 407 } else |
| 408 testFailed(_a + " should not be " + _bv + "."); | 408 testFailed(_a + " should not be " + _bv + "."); |
| 409 } | 409 } |
| 410 | 410 |
| 411 function shouldBecomeDifferent(_a, _b, _completionHandler, _timeout) | 411 function shouldBecomeDifferent(_a, _b, _completionHandler, _timeout) |
| 412 { | 412 { |
| 413 if (typeof _a != "string" || typeof _b != "string") | 413 if (typeof _a != "string" || typeof _b != "string") |
| 414 debug("WARN: shouldBecomeDifferent() expects string arguments"); | 414 debug("WARN: shouldBecomeDifferent() expects string arguments"); |
| 415 if (_timeout === undefined) | 415 if (_timeout === undefined) |
| 416 _timeout = 500; | 416 _timeout = defaultTimeoutForShouldBecome; |
| 417 | 417 |
| 418 var _bv; | 418 var _bv; |
| 419 var _condition = function() { | 419 var _condition = function() { |
| 420 var _exception; | 420 var _exception; |
| 421 var _av; | 421 var _av; |
| 422 try { | 422 try { |
| 423 _av = eval(_a); | 423 _av = eval(_a); |
| 424 } catch (e) { | 424 } catch (e) { |
| 425 _exception = e; | 425 _exception = e; |
| 426 } | 426 } |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 testPassed = function(msg) { | 903 testPassed = function(msg) { |
| 904 workerPort.postMessage('PASS:' + msg); | 904 workerPort.postMessage('PASS:' + msg); |
| 905 }; | 905 }; |
| 906 finishJSTest = function() { | 906 finishJSTest = function() { |
| 907 workerPort.postMessage('DONE:'); | 907 workerPort.postMessage('DONE:'); |
| 908 }; | 908 }; |
| 909 debug = function(msg) { | 909 debug = function(msg) { |
| 910 workerPort.postMessage(msg); | 910 workerPort.postMessage(msg); |
| 911 }; | 911 }; |
| 912 } | 912 } |
| OLD | NEW |