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

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

Issue 1259393002: DevTools: add support for logging fetch requests when XHR logging is enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixed the test Created 5 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 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 window._originalConsoleLog = console.log.bind(console); 10 window._originalConsoleLog = console.log.bind(console);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 var callbacks = pendingPromiseEvalRequests[callId]; 107 var callbacks = pendingPromiseEvalRequests[callId];
108 if (!callbacks) { 108 if (!callbacks) {
109 InspectorTest.addResult("Missing callback for async eval " + callId + ", perhaps callback invoked twice?"); 109 InspectorTest.addResult("Missing callback for async eval " + callId + ", perhaps callback invoked twice?");
110 return; 110 return;
111 } 111 }
112 var callback = didResolve ? callbacks.resolve : callbacks.reject; 112 var callback = didResolve ? callbacks.resolve : callbacks.reject;
113 delete pendingPromiseEvalRequests[callId]; 113 delete pendingPromiseEvalRequests[callId];
114 callback(value); 114 callback(value);
115 } 115 }
116 116
117 InspectorTest.invokePageFunctionAsync = function(functionName, callback) 117 /**
118 * @param {string} functionName
119 * @param {...} varArgs
120 * @param {function()} callback
121 */
122 InspectorTest.invokePageFunctionAsync = function(functionName, varArgs)
118 { 123 {
119 var id = ++lastEvalId; 124 var id = ++lastEvalId;
125 var args = Array.prototype.slice.call(arguments, 1);
126 var callback = args.pop();
120 pendingEvalRequests[id] = InspectorTest.safeWrap(callback); 127 pendingEvalRequests[id] = InspectorTest.safeWrap(callback);
121 var asyncEvalWrapper = function(callId, functionName) 128 var asyncEvalWrapper = function(callId, functionName, argsString)
122 { 129 {
123 function evalCallback(result) 130 function evalCallback(result)
124 { 131 {
125 testRunner.evaluateInWebInspector(evalCallbackCallId, "InspectorTest .didInvokePageFunctionAsync(" + callId + ", " + JSON.stringify(result) + ");"); 132 testRunner.evaluateInWebInspector(evalCallbackCallId, "InspectorTest .didInvokePageFunctionAsync(" + callId + ", " + JSON.stringify(result) + ");");
126 } 133 }
127 134 var argsArray = argsString.replace(/^\[(.*)\]$/, "$1");
135 if (argsArray.length)
136 argsArray += ",";
128 try { 137 try {
129 eval(functionName + "(" + evalCallback + ")"); 138 eval(functionName + "(" + argsArray + evalCallback + ")");
130 } catch(e) { 139 } catch(e) {
131 InspectorTest.addResult("Error: " + e); 140 InspectorTest.addResult("Error: " + e);
132 evalCallback(String(e)); 141 evalCallback(String(e));
133 } 142 }
134 } 143 }
135 InspectorTest.evaluateInPage("(" + asyncEvalWrapper.toString() + ")(" + id + ", unescape('" + escape(functionName) + "'))"); 144 var escapedJSONArgs = JSON.stringify(JSON.stringify(args));
145 InspectorTest.evaluateInPage("(" + asyncEvalWrapper.toString() + ")(" + id + ", unescape('" + escape(functionName) + "')," + escapedJSONArgs + ")");
136 } 146 }
137 147
138 InspectorTest.didInvokePageFunctionAsync = function(callId, value) 148 InspectorTest.didInvokePageFunctionAsync = function(callId, value)
139 { 149 {
140 var callback = pendingEvalRequests[callId]; 150 var callback = pendingEvalRequests[callId];
141 if (!callback) { 151 if (!callback) {
142 InspectorTest.addResult("Missing callback for async eval " + callId + ", perhaps callback invoked twice?"); 152 InspectorTest.addResult("Missing callback for async eval " + callId + ", perhaps callback invoked twice?");
143 return; 153 return;
144 } 154 }
145 delete pendingEvalRequests[callId]; 155 delete pendingEvalRequests[callId];
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 _output("[page] " + text); 1069 _output("[page] " + text);
1060 } 1070 }
1061 1071
1062 function _output(result) 1072 function _output(result)
1063 { 1073 {
1064 if (!outputElement) 1074 if (!outputElement)
1065 createOutputElement(); 1075 createOutputElement();
1066 outputElement.appendChild(document.createTextNode(result)); 1076 outputElement.appendChild(document.createTextNode(result));
1067 outputElement.appendChild(document.createElement("br")); 1077 outputElement.appendChild(document.createElement("br"));
1068 } 1078 }
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/inspector/console-xhr-logging-expected.txt ('k') | LayoutTests/http/tests/inspector/network-test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698