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

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

Issue 118293002: DevTools: Support XHR async call stacks in the debugger. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: split tests 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 InspectorTest.evaluateInConsole("setTimeout(testFunction, 0)"); 76 InspectorTest.evaluateInConsole("setTimeout(testFunction, 0)");
77 InspectorTest.addResult("Set timer for test function."); 77 InspectorTest.addResult("Set timer for test function.");
78 }; 78 };
79 79
80 InspectorTest.runTestFunctionAndWaitUntilPaused = function(callback) 80 InspectorTest.runTestFunctionAndWaitUntilPaused = function(callback)
81 { 81 {
82 InspectorTest.runTestFunction(); 82 InspectorTest.runTestFunction();
83 InspectorTest.waitUntilPaused(callback); 83 InspectorTest.waitUntilPaused(callback);
84 }; 84 };
85 85
86 InspectorTest.runAsyncCallStacksTest = function(totalDebuggerStatements, maxAsyn cCallStackDepth)
87 {
88 maxAsyncCallStackDepth = maxAsyncCallStackDepth || 4;
yurys 2013/12/23 09:11:57 Please make it a required parameter for better rea
aandrey 2013/12/23 12:09:38 Done.
89
90 InspectorTest.setQuiet(true);
91 InspectorTest.startDebuggerTest(step1);
92
93 function step1()
94 {
95 DebuggerAgent.setAsyncCallStackDepth(maxAsyncCallStackDepth, step2);
96 }
97
98 function step2()
99 {
100 InspectorTest.runTestFunctionAndWaitUntilPaused(didPaused);
101 }
102
103 var step = 0;
104 var callStacksOutput = [];
105 function didPaused(callFrames, reason, breakpointIds, asyncStackTrace)
106 {
107 ++step;
108 InspectorTest.beginResultBufferring();
yurys 2013/12/23 09:11:57 I must have overlooked this begin/endResultBufferi
aandrey 2013/12/23 12:09:38 Done.
109 InspectorTest.captureStackTrace(callFrames, asyncStackTrace);
110 callStacksOutput.push(InspectorTest.endResultBufferring());
111
112 if (step < totalDebuggerStatements) {
113 InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(Ins pectorTest, didPaused));
114 } else {
115 InspectorTest.addResult("Captured call stacks in no particular order :");
116 callStacksOutput.sort();
117 InspectorTest.addResults(callStacksOutput);
118 InspectorTest.completeDebuggerTest();
119 }
120 }
121 };
122
86 InspectorTest.waitUntilPausedNextTime = function(callback) 123 InspectorTest.waitUntilPausedNextTime = function(callback)
87 { 124 {
88 InspectorTest._waitUntilPausedCallback = InspectorTest.safeWrap(callback); 125 InspectorTest._waitUntilPausedCallback = InspectorTest.safeWrap(callback);
89 }; 126 };
90 127
91 InspectorTest.waitUntilPaused = function(callback) 128 InspectorTest.waitUntilPaused = function(callback)
92 { 129 {
93 callback = InspectorTest.safeWrap(callback); 130 callback = InspectorTest.safeWrap(callback);
94 131
95 if (InspectorTest._pausedScriptArguments) 132 if (InspectorTest._pausedScriptArguments)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 InspectorTest.addResult(" <return>: " + frame.returnValue. description); 181 InspectorTest.addResult(" <return>: " + frame.returnValue. description);
145 } 182 }
146 } 183 }
147 184
148 InspectorTest.addResult("Call stack:"); 185 InspectorTest.addResult("Call stack:");
149 printCallFrames(callFrames); 186 printCallFrames(callFrames);
150 187
151 while (asyncStackTrace) { 188 while (asyncStackTrace) {
152 InspectorTest.addResult(" [" + (asyncStackTrace.description || "Async Call") + "]"); 189 InspectorTest.addResult(" [" + (asyncStackTrace.description || "Async Call") + "]");
153 printCallFrames(asyncStackTrace.callFrames); 190 printCallFrames(asyncStackTrace.callFrames);
154 if (asyncStackTrace.callFrames[0].functionName === "testFunction") 191 if (asyncStackTrace.callFrames.peekLast().functionName === "testFunction ")
155 break; 192 break;
156 asyncStackTrace = asyncStackTrace.asyncStackTrace; 193 asyncStackTrace = asyncStackTrace.asyncStackTrace;
157 } 194 }
158 }; 195 };
159 196
160 InspectorTest.dumpSourceFrameContents = function(sourceFrame) 197 InspectorTest.dumpSourceFrameContents = function(sourceFrame)
161 { 198 {
162 InspectorTest.addResult("==Source frame contents start=="); 199 InspectorTest.addResult("==Source frame contents start==");
163 var textEditor = sourceFrame._textEditor; 200 var textEditor = sourceFrame._textEditor;
164 for (var i = 0; i < textEditor.linesCount; ++i) 201 for (var i = 0; i < textEditor.linesCount; ++i)
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 376
340 InspectorTest.checkUILocation = function(uiSourceCode, lineNumber, columnNumber, location) 377 InspectorTest.checkUILocation = function(uiSourceCode, lineNumber, columnNumber, location)
341 { 378 {
342 InspectorTest.assertEquals(uiSourceCode, location.uiSourceCode, "Incorrect u iSourceCode, expected '" + (uiSourceCode ? uiSourceCode.originURL() : null) + "' ," + 379 InspectorTest.assertEquals(uiSourceCode, location.uiSourceCode, "Incorrect u iSourceCode, expected '" + (uiSourceCode ? uiSourceCode.originURL() : null) + "' ," +
343 " but got '" + (location.uiSourceCode ? location.uiSourceCode.originURL() : null) + "'"); 380 " but got '" + (location.uiSourceCode ? location.uiSourceCode.originURL() : null) + "'");
344 InspectorTest.assertEquals(lineNumber, location.lineNumber, "Incorrect lineN umber, expected '" + lineNumber + "', but got '" + location.lineNumber + "'"); 381 InspectorTest.assertEquals(lineNumber, location.lineNumber, "Incorrect lineN umber, expected '" + lineNumber + "', but got '" + location.lineNumber + "'");
345 InspectorTest.assertEquals(columnNumber, location.columnNumber, "Incorrect c olumnNumber, expected '" + columnNumber + "', but got '" + location.columnNumber + "'"); 382 InspectorTest.assertEquals(columnNumber, location.columnNumber, "Incorrect c olumnNumber, expected '" + columnNumber + "', but got '" + location.columnNumber + "'");
346 }; 383 };
347 384
348 }; 385 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698