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

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

Issue 74063002: DevTools: Support asynchronous call stacks on backend. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: removed trash Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 var initialize_DebuggerTest = function() { 1 var initialize_DebuggerTest = function() {
2 2
3 InspectorTest.startDebuggerTest = function(callback, quiet) 3 InspectorTest.startDebuggerTest = function(callback, quiet)
4 { 4 {
5 if (quiet !== undefined) 5 if (quiet !== undefined)
6 InspectorTest._quiet = quiet; 6 InspectorTest._quiet = quiet;
7 WebInspector.showPanel("sources"); 7 WebInspector.showPanel("sources");
8 8
9 if (WebInspector.debuggerModel.debuggerEnabled()) 9 if (WebInspector.debuggerModel.debuggerEnabled())
10 startTest(); 10 startTest();
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 InspectorTest._waitUntilResumedCallback = callback; 113 InspectorTest._waitUntilResumedCallback = callback;
114 }; 114 };
115 115
116 InspectorTest.resumeExecution = function(callback) 116 InspectorTest.resumeExecution = function(callback)
117 { 117 {
118 if (WebInspector.panels.sources.paused) 118 if (WebInspector.panels.sources.paused)
119 WebInspector.panels.sources._togglePause(); 119 WebInspector.panels.sources._togglePause();
120 InspectorTest.waitUntilResumed(callback); 120 InspectorTest.waitUntilResumed(callback);
121 }; 121 };
122 122
123 InspectorTest.captureStackTrace = function(callFrames, dropLineNumbers, printRet urnValue) 123 InspectorTest.captureStackTrace = function(callFrames, asyncStackTrace, options)
124 { 124 {
125 options = options || {};
126
127 function printCallFrames(callFrames, indent)
128 {
129 indent = indent || "";
130 for (var i = 0; i < callFrames.length; i++) {
131 var frame = callFrames[i];
132 var script = WebInspector.debuggerModel.scriptForId(frame.location.s criptId);
133 var url;
134 var lineNumber;
135 if (script) {
136 url = WebInspector.displayNameForURL(script.sourceURL);
137 lineNumber = frame.location.lineNumber + 1;
138 } else {
139 url = "(internal script)";
140 lineNumber = "(line number)";
141 }
142 var s = " " + i + ") " + frame.functionName + " (" + url + (optio ns.dropLineNumbers ? "" : ":" + lineNumber) + ")";
143 InspectorTest.addResult(indent + s);
144 if (options.printReturnValue && frame.returnValue)
145 InspectorTest.addResult(indent + " <return>: " + frame.ret urnValue.description);
146 }
147 }
148
125 InspectorTest.addResult("Call stack:"); 149 InspectorTest.addResult("Call stack:");
126 for (var i = 0; i < callFrames.length; i++) { 150 printCallFrames(callFrames);
127 var frame = callFrames[i]; 151
128 var script = WebInspector.debuggerModel.scriptForId(frame.location.scrip tId); 152 while (asyncStackTrace) {
129 var url; 153 InspectorTest.addResult(" [Async Call]");
130 var lineNumber; 154 printCallFrames(asyncStackTrace.callFrames, " ");
131 if (script) { 155 if (asyncStackTrace.callFrames[0].functionName === "testFunction")
132 url = WebInspector.displayNameForURL(script.sourceURL); 156 break;
133 lineNumber = frame.location.lineNumber + 1; 157 asyncStackTrace = asyncStackTrace.asyncStackTrace;
yurys 2013/12/04 15:25:52 initiatorStackTrace would be a better name for asy
aandrey 2013/12/04 15:57:26 for which one? anyway "initiator" would seem confu
yurys 2013/12/05 11:37:48 For those which are asyncStackTrace at the moment,
aandrey 2013/12/05 13:03:40 Out of these two I like "async" more. Moreover it
134 } else {
135 url = "(internal script)";
136 lineNumber = "(line number)";
137 }
138 var s = " " + i + ") " + frame.functionName + " (" + url + (dropLineN umbers ? "" : ":" + lineNumber) + ")";
139 InspectorTest.addResult(s);
140 if (printReturnValue && frame.returnValue)
141 InspectorTest.addResult(" <return>: " + frame.returnValue.desc ription);
142 } 158 }
143 }; 159 };
144 160
145 InspectorTest.captureStackTraceExtended = function(callFrames, dropLineNumbers)
146 {
147 InspectorTest.captureStackTrace(callFrames, dropLineNumbers, true);
148 };
149
150 InspectorTest.dumpSourceFrameContents = function(sourceFrame) 161 InspectorTest.dumpSourceFrameContents = function(sourceFrame)
151 { 162 {
152 InspectorTest.addResult("==Source frame contents start=="); 163 InspectorTest.addResult("==Source frame contents start==");
153 var textEditor = sourceFrame._textEditor; 164 var textEditor = sourceFrame._textEditor;
154 for (var i = 0; i < textEditor.linesCount; ++i) 165 for (var i = 0; i < textEditor.linesCount; ++i)
155 InspectorTest.addResult(textEditor.line(i)); 166 InspectorTest.addResult(textEditor.line(i));
156 InspectorTest.addResult("==Source frame contents end=="); 167 InspectorTest.addResult("==Source frame contents end==");
157 }; 168 };
158 169
159 InspectorTest._pausedScript = function(callFrames, reason, auxData, breakpointId s) 170 InspectorTest._pausedScript = function(callFrames, reason, auxData, breakpointId s, asyncStackTrace)
160 { 171 {
161 if (!InspectorTest._quiet) 172 if (!InspectorTest._quiet)
162 InspectorTest.addResult("Script execution paused."); 173 InspectorTest.addResult("Script execution paused.");
163 InspectorTest._pausedScriptArguments = [callFrames, reason, breakpointIds]; 174 InspectorTest._pausedScriptArguments = [callFrames, reason, breakpointIds, a syncStackTrace];
164 if (InspectorTest._waitUntilPausedCallback) { 175 if (InspectorTest._waitUntilPausedCallback) {
165 var callback = InspectorTest._waitUntilPausedCallback; 176 var callback = InspectorTest._waitUntilPausedCallback;
166 delete InspectorTest._waitUntilPausedCallback; 177 delete InspectorTest._waitUntilPausedCallback;
167 callback.apply(callback, InspectorTest._pausedScriptArguments); 178 callback.apply(callback, InspectorTest._pausedScriptArguments);
168 } 179 }
169 }; 180 };
170 181
171 InspectorTest._resumedScript = function() 182 InspectorTest._resumedScript = function()
172 { 183 {
173 if (!InspectorTest._quiet) 184 if (!InspectorTest._quiet)
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 340
330 InspectorTest.checkUILocation = function(uiSourceCode, lineNumber, columnNumber, location) 341 InspectorTest.checkUILocation = function(uiSourceCode, lineNumber, columnNumber, location)
331 { 342 {
332 InspectorTest.assertEquals(uiSourceCode, location.uiSourceCode, "Incorrect u iSourceCode, expected '" + (uiSourceCode ? uiSourceCode.originURL() : null) + "' ," + 343 InspectorTest.assertEquals(uiSourceCode, location.uiSourceCode, "Incorrect u iSourceCode, expected '" + (uiSourceCode ? uiSourceCode.originURL() : null) + "' ," +
333 " but got '" + (location.uiSourceCode ? location.uiSourceCode.originURL() : null) + "'"); 344 " but got '" + (location.uiSourceCode ? location.uiSourceCode.originURL() : null) + "'");
334 InspectorTest.assertEquals(lineNumber, location.lineNumber, "Incorrect lineN umber, expected '" + lineNumber + "', but got '" + location.lineNumber + "'"); 345 InspectorTest.assertEquals(lineNumber, location.lineNumber, "Incorrect lineN umber, expected '" + lineNumber + "', but got '" + location.lineNumber + "'");
335 InspectorTest.assertEquals(columnNumber, location.columnNumber, "Incorrect c olumnNumber, expected '" + columnNumber + "', but got '" + location.columnNumber + "'"); 346 InspectorTest.assertEquals(columnNumber, location.columnNumber, "Incorrect c olumnNumber, expected '" + columnNumber + "', but got '" + location.columnNumber + "'");
336 }; 347 };
337 348
338 }; 349 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698