OLD | NEW |
1 var initialize_InspectorTest = function() { | 1 var initialize_InspectorTest = function() { |
2 | 2 |
3 var results = []; | 3 var results = []; |
4 | 4 |
5 function consoleOutputHook(messageType) | 5 function consoleOutputHook(messageType) |
6 { | 6 { |
7 InspectorTest.addResult(messageType + ": " + Array.prototype.slice.call(argu
ments, 1)); | 7 InspectorTest.addResult(messageType + ": " + Array.prototype.slice.call(argu
ments, 1)); |
8 } | 8 } |
9 | 9 |
10 console.log = consoleOutputHook.bind(InspectorTest, "log"); | 10 console.log = consoleOutputHook.bind(InspectorTest, "log"); |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 /** | 438 /** |
439 * @constructor | 439 * @constructor |
440 * @param {!string} dirPath | 440 * @param {!string} dirPath |
441 * @param {!string} name | 441 * @param {!string} name |
442 * @param {!function(?WebInspector.TempFile)} callback | 442 * @param {!function(?WebInspector.TempFile)} callback |
443 */ | 443 */ |
444 InspectorTest.TempFileMock = function(dirPath, name, callback) | 444 InspectorTest.TempFileMock = function(dirPath, name, callback) |
445 { | 445 { |
446 this._chunks = []; | 446 this._chunks = []; |
447 this._name = name; | 447 this._name = name; |
448 setTimeout(callback.bind(this, this), 0); | 448 requestAnimationFrame(callback.bind(this, this)); |
449 } | 449 } |
450 | 450 |
451 InspectorTest.TempFileMock.prototype = { | 451 InspectorTest.TempFileMock.prototype = { |
452 /** | 452 /** |
453 * @param {!Array.<string>} strings | 453 * @param {!Array.<string>} strings |
454 * @param {!function(boolean)} callback | 454 * @param {!function(boolean)} callback |
455 */ | 455 */ |
456 write: function(strings, callback) | 456 write: function(strings, callback) |
457 { | 457 { |
458 this._chunks.push.apply(this._chunks, strings); | 458 this._chunks.push.apply(this._chunks, strings); |
459 setTimeout(callback.bind(this, true), 0); | 459 requestAnimationFrame(callback.bind(this, true)); |
460 }, | 460 }, |
461 | 461 |
462 finishWriting: function() { }, | 462 finishWriting: function() { }, |
463 | 463 |
464 /** | 464 /** |
465 * @param {function(?string)} callback | 465 * @param {function(?string)} callback |
466 */ | 466 */ |
467 read: function(callback) | 467 read: function(callback) |
468 { | 468 { |
469 callback(this._chunks.join("")); | 469 callback(this._chunks.join("")); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 | 593 |
594 function reopenFrontend() | 594 function reopenFrontend() |
595 { | 595 { |
596 closeFrontend(openFrontendAndIncrement); | 596 closeFrontend(openFrontendAndIncrement); |
597 } | 597 } |
598 | 598 |
599 function closeFrontend(callback) | 599 function closeFrontend(callback) |
600 { | 600 { |
601 // Do this asynchronously to allow InspectorBackendDispatcher to send respon
se | 601 // Do this asynchronously to allow InspectorBackendDispatcher to send respon
se |
602 // back to the frontend before it's destroyed. | 602 // back to the frontend before it's destroyed. |
603 setTimeout(function() { | 603 requestAnimationFrame(function() { |
604 testRunner.closeWebInspector(); | 604 testRunner.closeWebInspector(); |
605 callback(); | 605 callback(); |
606 }, 0); | 606 }); |
607 } | 607 } |
608 | 608 |
609 function openFrontendAndIncrement() | 609 function openFrontendAndIncrement() |
610 { | 610 { |
611 frontendReopeningCount++; | 611 frontendReopeningCount++; |
612 testRunner.showWebInspector(); | 612 testRunner.showWebInspector(); |
613 setTimeout(runTest, 0); | 613 requestAnimationFrame(runTest); |
614 } | 614 } |
615 | 615 |
616 function runAfterIframeIsLoaded() | 616 function runAfterIframeIsLoaded() |
617 { | 617 { |
618 if (window.testRunner) | 618 if (window.testRunner) |
619 testRunner.waitUntilDone(); | 619 testRunner.waitUntilDone(); |
620 function step() | 620 function step() |
621 { | 621 { |
622 if (!window.iframeLoaded) | 622 if (!window.iframeLoaded) |
623 setTimeout(step, 100); | 623 setTimeout(step, 100); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 for (var i = 0; i < results.length; ++i) | 756 for (var i = 0; i < results.length; ++i) |
757 _output(results[i]); | 757 _output(results[i]); |
758 } | 758 } |
759 | 759 |
760 function closeInspectorAndNotifyDone() | 760 function closeInspectorAndNotifyDone() |
761 { | 761 { |
762 if (window._watchDogTimer) | 762 if (window._watchDogTimer) |
763 clearTimeout(window._watchDogTimer); | 763 clearTimeout(window._watchDogTimer); |
764 | 764 |
765 testRunner.closeWebInspector(); | 765 testRunner.closeWebInspector(); |
766 setTimeout(function() { | 766 requestAnimationFrame(function() { |
767 testRunner.notifyDone(); | 767 testRunner.notifyDone(); |
768 }, 0); | 768 }); |
769 } | 769 } |
770 | 770 |
771 var outputElement; | 771 var outputElement; |
772 | 772 |
773 function createOutputElement() | 773 function createOutputElement() |
774 { | 774 { |
775 outputElement = document.createElement("div"); | 775 outputElement = document.createElement("div"); |
776 // Support for svg - add to document, not body, check for style. | 776 // Support for svg - add to document, not body, check for style. |
777 if (outputElement.style) { | 777 if (outputElement.style) { |
778 outputElement.style.whiteSpace = "pre"; | 778 outputElement.style.whiteSpace = "pre"; |
779 outputElement.style.height = "10px"; | 779 outputElement.style.height = "10px"; |
780 outputElement.style.overflow = "hidden"; | 780 outputElement.style.overflow = "hidden"; |
781 } | 781 } |
782 document.documentElement.appendChild(outputElement); | 782 document.documentElement.appendChild(outputElement); |
783 } | 783 } |
784 | 784 |
785 function output(text) | 785 function output(text) |
786 { | 786 { |
787 _output("[page] " + text); | 787 _output("[page] " + text); |
788 } | 788 } |
789 | 789 |
790 function _output(result) | 790 function _output(result) |
791 { | 791 { |
792 if (!outputElement) | 792 if (!outputElement) |
793 createOutputElement(); | 793 createOutputElement(); |
794 outputElement.appendChild(document.createTextNode(result)); | 794 outputElement.appendChild(document.createTextNode(result)); |
795 outputElement.appendChild(document.createElement("br")); | 795 outputElement.appendChild(document.createElement("br")); |
796 } | 796 } |
OLD | NEW |