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

Side by Side Diff: LayoutTests/http/tests/inspector/inspector-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: 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 var initialize_InspectorTest = function() { 1 var initialize_InspectorTest = function() {
2 2
3 var results = []; 3 var results = [];
4 var resultsSynchronized = false; 4 var resultsSynchronized = false;
5 5
6 function consoleOutputHook(messageType) 6 function consoleOutputHook(messageType)
7 { 7 {
8 InspectorTest.addResult(messageType + ": " + Array.prototype.slice.call(argu ments, 1)); 8 InspectorTest.addResult(messageType + ": " + Array.prototype.slice.call(argu ments, 1));
9 } 9 }
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 function mycallback(error, result, wasThrown) 83 function mycallback(error, result, wasThrown)
84 { 84 {
85 if (!error) 85 if (!error)
86 callback(WebInspector.runtimeModel.createRemoteObject(result), wasTh rown); 86 callback(WebInspector.runtimeModel.createRemoteObject(result), wasTh rown);
87 } 87 }
88 RuntimeAgent.evaluate(code, "console", false, mycallback); 88 RuntimeAgent.evaluate(code, "console", false, mycallback);
89 } 89 }
90 90
91 InspectorTest.evaluateInPageWithTimeout = function(code) 91 InspectorTest.evaluateInPageWithTimeout = function(code)
92 { 92 {
93 InspectorTest.evaluateInPage("setTimeout(unescape('" + escape(code) + "'))") ; 93 InspectorTest.evaluateInPage("setTimeout(unescape('" + escape(code) + "'), 1 )");
94 } 94 }
95 95
96 var lastEvalId = 0; 96 var lastEvalId = 0;
97 var pendingEvalRequests = {}; 97 var pendingEvalRequests = {};
98 98
99 InspectorTest.invokePageFunctionAsync = function(functionName, callback) 99 InspectorTest.invokePageFunctionAsync = function(functionName, callback)
100 { 100 {
101 var id = ++lastEvalId; 101 var id = ++lastEvalId;
102 pendingEvalRequests[id] = InspectorTest.safeWrap(callback); 102 pendingEvalRequests[id] = InspectorTest.safeWrap(callback);
103 var asyncEvalWrapper = function(callId, functionName) 103 var asyncEvalWrapper = function(callId, functionName)
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 /** 507 /**
508 * @constructor 508 * @constructor
509 * @param {!string} dirPath 509 * @param {!string} dirPath
510 * @param {!string} name 510 * @param {!string} name
511 * @param {!function(?WebInspector.TempFile)} callback 511 * @param {!function(?WebInspector.TempFile)} callback
512 */ 512 */
513 InspectorTest.TempFileMock = function(dirPath, name, callback) 513 InspectorTest.TempFileMock = function(dirPath, name, callback)
514 { 514 {
515 this._chunks = []; 515 this._chunks = [];
516 this._name = name; 516 this._name = name;
517 setTimeout(callback.bind(this, this), 0); 517 requestAnimationFrame(callback.bind(this, this));
518 } 518 }
519 519
520 InspectorTest.TempFileMock.prototype = { 520 InspectorTest.TempFileMock.prototype = {
521 /** 521 /**
522 * @param {!Array.<string>} strings 522 * @param {!Array.<string>} strings
523 * @param {!function(boolean)} callback 523 * @param {!function(boolean)} callback
524 */ 524 */
525 write: function(strings, callback) 525 write: function(strings, callback)
526 { 526 {
527 this._chunks.push.apply(this._chunks, strings); 527 this._chunks.push.apply(this._chunks, strings);
528 setTimeout(callback.bind(this, true), 0); 528 requestAnimationFrame(callback.bind(this, true));
529 }, 529 },
530 530
531 finishWriting: function() { }, 531 finishWriting: function() { },
532 532
533 /** 533 /**
534 * @param {function(?string)} callback 534 * @param {function(?string)} callback
535 */ 535 */
536 read: function(callback) 536 read: function(callback)
537 { 537 {
538 callback(this._chunks.join("")); 538 callback(this._chunks.join(""));
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 656
657 function reopenFrontend() 657 function reopenFrontend()
658 { 658 {
659 closeFrontend(openFrontendAndIncrement); 659 closeFrontend(openFrontendAndIncrement);
660 } 660 }
661 661
662 function closeFrontend(callback) 662 function closeFrontend(callback)
663 { 663 {
664 // Do this asynchronously to allow InspectorBackendDispatcher to send respon se 664 // Do this asynchronously to allow InspectorBackendDispatcher to send respon se
665 // back to the frontend before it's destroyed. 665 // back to the frontend before it's destroyed.
666 setTimeout(function() { 666 requestAnimationFrame(function() {
667 testRunner.closeWebInspector(); 667 testRunner.closeWebInspector();
668 callback(); 668 callback();
669 }, 0); 669 });
670 } 670 }
671 671
672 function openFrontendAndIncrement() 672 function openFrontendAndIncrement()
673 { 673 {
674 frontendReopeningCount++; 674 frontendReopeningCount++;
675 testRunner.showWebInspector(); 675 testRunner.showWebInspector();
676 setTimeout(runTest, 0); 676 requestAnimationFrame(runTest);
677 } 677 }
678 678
679 function runAfterIframeIsLoaded() 679 function runAfterIframeIsLoaded()
680 { 680 {
681 if (window.testRunner) 681 if (window.testRunner)
682 testRunner.waitUntilDone(); 682 testRunner.waitUntilDone();
683 function step() 683 function step()
684 { 684 {
685 if (!window.iframeLoaded) 685 if (!window.iframeLoaded)
686 setTimeout(step, 100); 686 setTimeout(step, 100);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 outputElementParent.appendChild(outputElement); 773 outputElementParent.appendChild(outputElement);
774 closeInspectorAndNotifyDone(); 774 closeInspectorAndNotifyDone();
775 } 775 }
776 776
777 function closeInspectorAndNotifyDone() 777 function closeInspectorAndNotifyDone()
778 { 778 {
779 if (window._watchDogTimer) 779 if (window._watchDogTimer)
780 clearTimeout(window._watchDogTimer); 780 clearTimeout(window._watchDogTimer);
781 781
782 testRunner.closeWebInspector(); 782 testRunner.closeWebInspector();
783 setTimeout(function() { 783 requestAnimationFrame(function() {
784 testRunner.notifyDone(); 784 testRunner.notifyDone();
785 }, 0); 785 });
786 } 786 }
787 787
788 var outputElement; 788 var outputElement;
789 var outputElementParent; 789 var outputElementParent;
790 var savedOutput; 790 var savedOutput;
791 791
792 function createOutputElement() 792 function createOutputElement()
793 { 793 {
794 var intermediate = document.createElement("div"); 794 var intermediate = document.createElement("div");
795 document.body.appendChild(intermediate); 795 document.body.appendChild(intermediate);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 evaluateInWebInspector: function(callId, script) 861 evaluateInWebInspector: function(callId, script)
862 { 862 {
863 window.opener.postMessage(["evaluateInWebInspector", callId, script], "* "); 863 window.opener.postMessage(["evaluateInWebInspector", callId, script], "* ");
864 }, 864 },
865 865
866 display: function() { } 866 display: function() { }
867 } 867 }
868 868
869 if (!window.testRunner && window.opener) 869 if (!window.testRunner && window.opener)
870 window.testRunner = new StandaloneTestRunnerStub(); 870 window.testRunner = new StandaloneTestRunnerStub();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698