| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 function mycallback(error, result, wasThrown) | 42 function mycallback(error, result, wasThrown) |
| 43 { | 43 { |
| 44 if (!error) | 44 if (!error) |
| 45 callback(WebInspector.runtimeModel.createRemoteObject(result), wasTh
rown); | 45 callback(WebInspector.runtimeModel.createRemoteObject(result), wasTh
rown); |
| 46 } | 46 } |
| 47 RuntimeAgent.evaluate(code, "console", false, mycallback); | 47 RuntimeAgent.evaluate(code, "console", false, mycallback); |
| 48 } | 48 } |
| 49 | 49 |
| 50 InspectorTest.evaluateInPageWithTimeout = function(code) | 50 InspectorTest.evaluateInPageWithTimeout = function(code) |
| 51 { | 51 { |
| 52 InspectorTest.evaluateInPage("setTimeout(unescape('" + escape(code) + "'))")
; | 52 // FIXME: we need a better way of waiting for chromium events to happen |
| 53 InspectorTest.evaluateInPage("setTimeout(unescape('" + escape(code) + "'), 1
)"); |
| 53 } | 54 } |
| 54 | 55 |
| 55 var lastEvalId = 0; | 56 var lastEvalId = 0; |
| 56 var pendingEvalRequests = {}; | 57 var pendingEvalRequests = {}; |
| 57 | 58 |
| 58 InspectorTest.invokePageFunctionAsync = function(functionName, callback) | 59 InspectorTest.invokePageFunctionAsync = function(functionName, callback) |
| 59 { | 60 { |
| 60 var id = ++lastEvalId; | 61 var id = ++lastEvalId; |
| 61 pendingEvalRequests[id] = InspectorTest.safeWrap(callback); | 62 pendingEvalRequests[id] = InspectorTest.safeWrap(callback); |
| 62 var asyncEvalWrapper = function(callId, functionName) | 63 var asyncEvalWrapper = function(callId, functionName) |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 /** | 439 /** |
| 439 * @constructor | 440 * @constructor |
| 440 * @param {!string} dirPath | 441 * @param {!string} dirPath |
| 441 * @param {!string} name | 442 * @param {!string} name |
| 442 * @param {!function(?WebInspector.TempFile)} callback | 443 * @param {!function(?WebInspector.TempFile)} callback |
| 443 */ | 444 */ |
| 444 InspectorTest.TempFileMock = function(dirPath, name, callback) | 445 InspectorTest.TempFileMock = function(dirPath, name, callback) |
| 445 { | 446 { |
| 446 this._chunks = []; | 447 this._chunks = []; |
| 447 this._name = name; | 448 this._name = name; |
| 448 setTimeout(callback.bind(this, this), 0); | 449 setTimeout(callback.bind(this, this), 1); |
| 449 } | 450 } |
| 450 | 451 |
| 451 InspectorTest.TempFileMock.prototype = { | 452 InspectorTest.TempFileMock.prototype = { |
| 452 /** | 453 /** |
| 453 * @param {!Array.<string>} strings | 454 * @param {!Array.<string>} strings |
| 454 * @param {!function(boolean)} callback | 455 * @param {!function(boolean)} callback |
| 455 */ | 456 */ |
| 456 write: function(strings, callback) | 457 write: function(strings, callback) |
| 457 { | 458 { |
| 458 this._chunks.push.apply(this._chunks, strings); | 459 this._chunks.push.apply(this._chunks, strings); |
| 459 setTimeout(callback.bind(this, true), 0); | 460 setTimeout(callback.bind(this, true), 1); |
| 460 }, | 461 }, |
| 461 | 462 |
| 462 finishWriting: function() { }, | 463 finishWriting: function() { }, |
| 463 | 464 |
| 464 /** | 465 /** |
| 465 * @param {function(?string)} callback | 466 * @param {function(?string)} callback |
| 466 */ | 467 */ |
| 467 read: function(callback) | 468 read: function(callback) |
| 468 { | 469 { |
| 469 callback(this._chunks.join("")); | 470 callback(this._chunks.join("")); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 | 594 |
| 594 function reopenFrontend() | 595 function reopenFrontend() |
| 595 { | 596 { |
| 596 closeFrontend(openFrontendAndIncrement); | 597 closeFrontend(openFrontendAndIncrement); |
| 597 } | 598 } |
| 598 | 599 |
| 599 function closeFrontend(callback) | 600 function closeFrontend(callback) |
| 600 { | 601 { |
| 601 // Do this asynchronously to allow InspectorBackendDispatcher to send respon
se | 602 // Do this asynchronously to allow InspectorBackendDispatcher to send respon
se |
| 602 // back to the frontend before it's destroyed. | 603 // back to the frontend before it's destroyed. |
| 604 // FIXME: we need a better way of waiting for chromium events to happen |
| 603 setTimeout(function() { | 605 setTimeout(function() { |
| 604 testRunner.closeWebInspector(); | 606 testRunner.closeWebInspector(); |
| 605 callback(); | 607 callback(); |
| 606 }, 0); | 608 }, 1); |
| 607 } | 609 } |
| 608 | 610 |
| 609 function openFrontendAndIncrement() | 611 function openFrontendAndIncrement() |
| 610 { | 612 { |
| 611 frontendReopeningCount++; | 613 frontendReopeningCount++; |
| 612 testRunner.showWebInspector(); | 614 testRunner.showWebInspector(); |
| 613 setTimeout(runTest, 0); | 615 setTimeout(runTest, 1); |
| 614 } | 616 } |
| 615 | 617 |
| 616 function runAfterIframeIsLoaded() | 618 function runAfterIframeIsLoaded() |
| 617 { | 619 { |
| 618 if (window.testRunner) | 620 if (window.testRunner) |
| 619 testRunner.waitUntilDone(); | 621 testRunner.waitUntilDone(); |
| 620 function step() | 622 function step() |
| 621 { | 623 { |
| 622 if (!window.iframeLoaded) | 624 if (!window.iframeLoaded) |
| 623 setTimeout(step, 100); | 625 setTimeout(step, 100); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 _output("[page] " + text); | 789 _output("[page] " + text); |
| 788 } | 790 } |
| 789 | 791 |
| 790 function _output(result) | 792 function _output(result) |
| 791 { | 793 { |
| 792 if (!outputElement) | 794 if (!outputElement) |
| 793 createOutputElement(); | 795 createOutputElement(); |
| 794 outputElement.appendChild(document.createTextNode(result)); | 796 outputElement.appendChild(document.createTextNode(result)); |
| 795 outputElement.appendChild(document.createElement("br")); | 797 outputElement.appendChild(document.createElement("br")); |
| 796 } | 798 } |
| OLD | NEW |