OLD | NEW |
---|---|
1 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex t + pixel results | 1 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex t + pixel results |
2 if (self.testRunner) { | 2 if (self.testRunner) { |
3 if (self.enablePixelTesting) | 3 if (self.enablePixelTesting) |
4 testRunner.dumpAsTextWithPixelResults(); | 4 testRunner.dumpAsTextWithPixelResults(); |
5 else | 5 else |
6 testRunner.dumpAsText(); | 6 testRunner.dumpAsText(); |
7 } | 7 } |
8 | 8 |
9 var description, debug, successfullyParsed; | 9 var description, debug, successfullyParsed; |
10 | 10 |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
562 if (typeof _e == "undefined" || exception == _ev) | 562 if (typeof _e == "undefined" || exception == _ev) |
563 testPassed(_a + " threw exception " + exception + "."); | 563 testPassed(_a + " threw exception " + exception + "."); |
564 else | 564 else |
565 testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an excepti on" : _ev) + ". Threw exception " + exception + "."); | 565 testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an excepti on" : _ev) + ". Threw exception " + exception + "."); |
566 } else if (typeof _av == "undefined") | 566 } else if (typeof _av == "undefined") |
567 testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception " : _ev) + ". Was undefined."); | 567 testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception " : _ev) + ". Was undefined."); |
568 else | 568 else |
569 testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception " : _ev) + ". Was " + _av + "."); | 569 testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception " : _ev) + ". Was " + _av + "."); |
570 } | 570 } |
571 | 571 |
572 function shouldBeNow(_a) | |
573 { | |
574 for (var _i = 0; _i < 1000; ++_i) { | |
ojan
2013/11/23 01:41:31
No need for the underscores. jsbell has a patch re
pwnall-personal
2013/11/23 01:56:22
Done.
| |
575 var _startDate = Date.now(); | |
576 var _av = eval(_a); | |
577 var _date = _av.valueOf(); | |
578 var _endDate = Date.now(); | |
579 | |
580 // On some occasions such as NTP updates, the current time can go | |
581 // backwards. This should only happen rarely, so we can get away with | |
582 // retrying the test a few times if we detect the time going backwards. | |
583 if (_startDate > _endDate) | |
584 continue; | |
585 | |
586 if (typeof _date !== "number") { | |
587 testFailed(_a + " is not a number or a Date. Got " + _av); | |
588 return; | |
589 } | |
590 if (_date < _startDate) { | |
591 testFailed(_a + " is not the curent time. Got " + _av + " which is " + (_startDate - _date) / 1000 + " seconds in the past."); | |
592 return; | |
593 } | |
594 if (_date > _endDate) { | |
595 testFailed(_a + " is not the current time. Got " + _av + " which is " + (_date - _endDate) / 1000 + " seconds in the future."); | |
596 return; | |
597 } | |
598 | |
599 testPassed(_a + " is equivalent to Date.now()."); | |
600 return; | |
601 } | |
602 testFailed(_a + " cannot be tested against the current time. The clock is go ing backwards too often."); | |
603 } | |
604 | |
572 function expectError() | 605 function expectError() |
573 { | 606 { |
574 if (expectingError) { | 607 if (expectingError) { |
575 testFailed("shouldHaveError() called twice before an error occurred!"); | 608 testFailed("shouldHaveError() called twice before an error occurred!"); |
576 } | 609 } |
577 expectingError = true; | 610 expectingError = true; |
578 } | 611 } |
579 | 612 |
580 function shouldHaveHadError(message) | 613 function shouldHaveHadError(message) |
581 { | 614 { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
714 testPassed = function(msg) { | 747 testPassed = function(msg) { |
715 workerPort.postMessage('PASS:' + msg); | 748 workerPort.postMessage('PASS:' + msg); |
716 } | 749 } |
717 finishJSTest = function() { | 750 finishJSTest = function() { |
718 workerPort.postMessage('DONE:'); | 751 workerPort.postMessage('DONE:'); |
719 } | 752 } |
720 debug = function(msg) { | 753 debug = function(msg) { |
721 workerPort.postMessage(msg); | 754 workerPort.postMessage(msg); |
722 } | 755 } |
723 } | 756 } |
OLD | NEW |