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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js

Issue 2208963002: [DevTools] Removed InspectorTest.invokeFunctionInPageAsync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-promise-from-other-tests
Patch Set: a Created 4 years, 4 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 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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698