| OLD | NEW |
| 1 if (window.GCController) | 1 if (window.GCController) |
| 2 GCController.collectAll(); | 2 GCController.collectAll(); |
| 3 var initialize_InspectorTest = function() { | 3 var initialize_InspectorTest = function() { |
| 4 | 4 |
| 5 var results = []; | 5 var results = []; |
| 6 | 6 |
| 7 function consoleOutputHook(messageType) | 7 function consoleOutputHook(messageType) |
| 8 { | 8 { |
| 9 InspectorTest.addResult(messageType + ": " + Array.prototype.slice.call(argu
ments, 1)); | 9 InspectorTest.addResult(messageType + ": " + Array.prototype.slice.call(argu
ments, 1)); |
| 10 } | 10 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 var expression = "testRunner.evaluateInWebInspectorOverlay(\"(\" + " + func
+ " + \")()\")"; | 103 var expression = "testRunner.evaluateInWebInspectorOverlay(\"(\" + " + func
+ " + \")()\")"; |
| 104 var mainContext = InspectorTest.runtimeModel.executionContexts()[0]; | 104 var mainContext = InspectorTest.runtimeModel.executionContexts()[0]; |
| 105 mainContext.evaluate(expression, "", false, false, true, false, false, wrapC
allback); | 105 mainContext.evaluate(expression, "", false, false, true, false, false, wrapC
allback); |
| 106 | 106 |
| 107 function wrapCallback(val, err, result) | 107 function wrapCallback(val, err, result) |
| 108 { | 108 { |
| 109 callback(result.value) | 109 callback(result.value) |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 InspectorTest.waitForOverlayRepaint = function(callback) | |
| 114 { | |
| 115 InspectorTest.invokePageFunctionAsync("requestAnimationFrame", callback); | |
| 116 } | |
| 117 | |
| 118 var lastEvalId = 0; | |
| 119 var pendingEvalRequests = {}; | |
| 120 | |
| 121 /** | |
| 122 * @param {string} functionName | |
| 123 * @param {...} varArgs | |
| 124 * @param {function()} callback | |
| 125 */ | |
| 126 InspectorTest.invokePageFunctionAsync = function(functionName, varArgs) | |
| 127 { | |
| 128 var id = ++lastEvalId; | |
| 129 var args = Array.prototype.slice.call(arguments, 1); | |
| 130 var callback = args.pop(); | |
| 131 pendingEvalRequests[id] = InspectorTest.safeWrap(callback); | |
| 132 var asyncEvalWrapper = function(callId, functionName, argsString) | |
| 133 { | |
| 134 function evalCallback(result) | |
| 135 { | |
| 136 testRunner.evaluateInWebInspector(evalCallbackCallId, "InspectorTest
.didInvokePageFunctionAsync(" + callId + ", " + JSON.stringify(result) + ");"); | |
| 137 } | |
| 138 var argsArray = argsString.replace(/^\[(.*)\]$/, "$1"); | |
| 139 if (argsArray.length) | |
| 140 argsArray += ","; | |
| 141 try { | |
| 142 eval(functionName + "(" + argsArray + evalCallback + ")"); | |
| 143 } catch(e) { | |
| 144 InspectorTest.addResult("Error: " + e); | |
| 145 evalCallback(String(e)); | |
| 146 } | |
| 147 } | |
| 148 var escapedJSONArgs = JSON.stringify(JSON.stringify(args)); | |
| 149 InspectorTest.evaluateInPage("(" + asyncEvalWrapper.toString() + ")(" + id +
", unescape('" + escape(functionName) + "')," + escapedJSONArgs + ")"); | |
| 150 } | |
| 151 | |
| 152 InspectorTest.didInvokePageFunctionAsync = function(callId, value) | |
| 153 { | |
| 154 var callback = pendingEvalRequests[callId]; | |
| 155 if (!callback) { | |
| 156 InspectorTest.addResult("Missing callback for async eval " + callId + ",
perhaps callback invoked twice?"); | |
| 157 return; | |
| 158 } | |
| 159 delete pendingEvalRequests[callId]; | |
| 160 callback(value); | |
| 161 } | |
| 162 | |
| 163 InspectorTest.check = function(passCondition, failureText) | 113 InspectorTest.check = function(passCondition, failureText) |
| 164 { | 114 { |
| 165 if (!passCondition) | 115 if (!passCondition) |
| 166 InspectorTest.addResult("FAIL: " + failureText); | 116 InspectorTest.addResult("FAIL: " + failureText); |
| 167 } | 117 } |
| 168 | 118 |
| 169 InspectorTest.addResult = function(text) | 119 InspectorTest.addResult = function(text) |
| 170 { | 120 { |
| 171 results.push(String(text)); | 121 results.push(String(text)); |
| 172 } | 122 } |
| (...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 _output("[page] " + text); | 1145 _output("[page] " + text); |
| 1196 } | 1146 } |
| 1197 | 1147 |
| 1198 function _output(result) | 1148 function _output(result) |
| 1199 { | 1149 { |
| 1200 if (!outputElement) | 1150 if (!outputElement) |
| 1201 createOutputElement(); | 1151 createOutputElement(); |
| 1202 outputElement.appendChild(document.createTextNode(result)); | 1152 outputElement.appendChild(document.createTextNode(result)); |
| 1203 outputElement.appendChild(document.createElement("br")); | 1153 outputElement.appendChild(document.createElement("br")); |
| 1204 } | 1154 } |
| OLD | NEW |