Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: LayoutTests/resources/js-test.js

Issue 615033002: Refactor of various layout tests to use RAF (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix use-detatch.svg Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 isJsTest = true; 9 var isJsTest = true;
10 10
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 } 684 }
685 685
686 // With Oilpan tests that rely on garbage collection need to go through 686 // With Oilpan tests that rely on garbage collection need to go through
687 // the event loop in order to get precise garbage collections. Oilpan 687 // the event loop in order to get precise garbage collections. Oilpan
688 // uses conservative stack scanning when not at the event loop and that 688 // uses conservative stack scanning when not at the event loop and that
689 // can artificially keep objects alive. Therefore, tests that need to check 689 // can artificially keep objects alive. Therefore, tests that need to check
690 // that something is dead need to use this asynchronous collectGarbage 690 // that something is dead need to use this asynchronous collectGarbage
691 // function. 691 // function.
692 function asyncGC(callback) { 692 function asyncGC(callback) {
693 GCController.collectAll(); 693 GCController.collectAll();
694 setTimeout(callback, 0); 694 requestAnimationFrame(callback);
eseidel 2014/10/14 16:15:58 I might leave a comment to explain why RAF works b
695 } 695 }
696 696
697 function gc() { 697 function gc() {
698 if (typeof GCController !== "undefined") 698 if (typeof GCController !== "undefined")
699 GCController.collectAll(); 699 GCController.collectAll();
700 else { 700 else {
701 var gcRec = function (n) { 701 var gcRec = function (n) {
702 if (n < 1) 702 if (n < 1)
703 return {}; 703 return {};
704 var temp = {i: "ab" + i + (i / 100000)}; 704 var temp = {i: "ab" + i + (i / 100000)};
705 temp += "foo"; 705 temp += "foo";
706 gcRec(n-1); 706 gcRec(n-1);
707 }; 707 };
708 for (var i = 0; i < 1000; i++) 708 for (var i = 0; i < 1000; i++)
709 gcRec(10); 709 gcRec(10);
710 } 710 }
711 } 711 }
712 712
713 function asyncMinorGC(callback) { 713 function asyncMinorGC(callback) {
714 if (typeof GCController !== "undefined") 714 if (typeof GCController !== "undefined")
715 GCController.minorCollect(); 715 GCController.minorCollect();
716 else 716 else
717 testFailed("Minor GC is available only when you enable the --expose-gc o ption in V8."); 717 testFailed("Minor GC is available only when you enable the --expose-gc o ption in V8.");
718 setTimeout(callback, 0); 718 requestAnimationFrame(callback);
719 } 719 }
720 720
721 function isSuccessfullyParsed() 721 function isSuccessfullyParsed()
722 { 722 {
723 // FIXME: Remove this and only report unexpected syntax errors. 723 // FIXME: Remove this and only report unexpected syntax errors.
724 successfullyParsed = !unexpectedErrorMessage; 724 successfullyParsed = !unexpectedErrorMessage;
725 shouldBeTrue("successfullyParsed"); 725 shouldBeTrue("successfullyParsed");
726 debug('<br /><span class="pass">TEST COMPLETE</span>'); 726 debug('<br /><span class="pass">TEST COMPLETE</span>');
727 } 727 }
728 728
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 testPassed = function(msg) { 813 testPassed = function(msg) {
814 workerPort.postMessage('PASS:' + msg); 814 workerPort.postMessage('PASS:' + msg);
815 }; 815 };
816 finishJSTest = function() { 816 finishJSTest = function() {
817 workerPort.postMessage('DONE:'); 817 workerPort.postMessage('DONE:');
818 }; 818 };
819 debug = function(msg) { 819 debug = function(msg) {
820 workerPort.postMessage(msg); 820 workerPort.postMessage(msg);
821 }; 821 };
822 } 822 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698