| 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) | 572 function shouldBeNow(a, delta) |
| 573 { | 573 { |
| 574 // Right now, V8 and Chromium / Blink use two different clock |
| 575 // implementations. On Windows, the implementations are non-trivial and can |
| 576 // be slightly out of sync. The delta is intended to compensate for that. |
| 577 // |
| 578 // FIXME: reconsider this when the V8 and Blink clocks get unified, see http
://crbug.com/324110 |
| 579 if (delta === undefined) |
| 580 delta = 1000; |
| 581 |
| 574 for (var i = 0; i < 1000; ++i) { | 582 for (var i = 0; i < 1000; ++i) { |
| 575 var startDate = Date.now(); | 583 var startDate = Date.now(); |
| 576 var av = eval(a); | 584 var av = eval(a); |
| 577 var date = av.valueOf(); | 585 var date = av.valueOf(); |
| 578 var endDate = Date.now(); | 586 var endDate = Date.now(); |
| 579 | 587 |
| 580 // On some occasions such as NTP updates, the current time can go | 588 // 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 | 589 // 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. | 590 // retrying the test a few times if we detect the time going backwards. |
| 583 if (startDate > endDate) | 591 if (startDate > endDate) |
| 584 continue; | 592 continue; |
| 585 | 593 |
| 586 if (typeof date !== "number") { | 594 if (typeof date !== "number") { |
| 587 testFailed(a + " is not a number or a Date. Got " + av); | 595 testFailed(a + " is not a number or a Date. Got " + av); |
| 588 return; | 596 return; |
| 589 } | 597 } |
| 590 if (date < startDate) { | 598 if (date < startDate - delta) { |
| 591 testFailed(a + " is not the curent time. Got " + av + " which is " +
(startDate - date) / 1000 + " seconds in the past."); | 599 testFailed(a + " is not the curent time. Got " + av + " which is " +
(startDate - date) / 1000 + " seconds in the past."); |
| 592 return; | 600 return; |
| 593 } | 601 } |
| 594 if (date > endDate) { | 602 if (date > endDate + delta) { |
| 595 testFailed(a + " is not the current time. Got " + av + " which is "
+ (date - endDate) / 1000 + " seconds in the future."); | 603 testFailed(a + " is not the current time. Got " + av + " which is "
+ (date - endDate) / 1000 + " seconds in the future."); |
| 596 return; | 604 return; |
| 597 } | 605 } |
| 598 | 606 |
| 599 testPassed(a + " is equivalent to Date.now()."); | 607 testPassed(a + " is equivalent to Date.now()."); |
| 600 return; | 608 return; |
| 601 } | 609 } |
| 602 testFailed(a + " cannot be tested against the current time. The clock is goi
ng backwards too often."); | 610 testFailed(a + " cannot be tested against the current time. The clock is goi
ng backwards too often."); |
| 603 } | 611 } |
| 604 | 612 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 testPassed = function(msg) { | 755 testPassed = function(msg) { |
| 748 workerPort.postMessage('PASS:' + msg); | 756 workerPort.postMessage('PASS:' + msg); |
| 749 }; | 757 }; |
| 750 finishJSTest = function() { | 758 finishJSTest = function() { |
| 751 workerPort.postMessage('DONE:'); | 759 workerPort.postMessage('DONE:'); |
| 752 }; | 760 }; |
| 753 debug = function(msg) { | 761 debug = function(msg) { |
| 754 workerPort.postMessage(msg); | 762 workerPort.postMessage(msg); |
| 755 }; | 763 }; |
| 756 } | 764 } |
| OLD | NEW |