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

Unified 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: addressed 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/http/tests/inspector/inspector-test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/inspector/debugger-test.js
diff --git a/LayoutTests/http/tests/inspector/debugger-test.js b/LayoutTests/http/tests/inspector/debugger-test.js
index 21d535568fa5df938ea51a053cd0d494f88b2732..55541cb9ba23d9230cb4d7fa3a1b6c4e2e66743c 100644
--- a/LayoutTests/http/tests/inspector/debugger-test.js
+++ b/LayoutTests/http/tests/inspector/debugger-test.js
@@ -83,6 +83,38 @@ InspectorTest.runTestFunctionAndWaitUntilPaused = function(callback)
InspectorTest.waitUntilPaused(callback);
};
+InspectorTest.runAsyncCallStacksTest = function(totalDebuggerStatements, maxAsyncCallStackDepth)
+{
+ InspectorTest.setQuiet(true);
+ InspectorTest.startDebuggerTest(step1);
+
+ function step1()
+ {
+ DebuggerAgent.setAsyncCallStackDepth(maxAsyncCallStackDepth, step2);
+ }
+
+ function step2()
+ {
+ InspectorTest.runTestFunctionAndWaitUntilPaused(didPaused);
+ }
+
+ var step = 0;
+ var callStacksOutput = [];
+ function didPaused(callFrames, reason, breakpointIds, asyncStackTrace)
+ {
+ ++step;
+ callStacksOutput.push(InspectorTest.captureStackTraceIntoString(callFrames, asyncStackTrace) + "\n");
+ if (step < totalDebuggerStatements) {
+ InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(InspectorTest, didPaused));
+ } else {
+ InspectorTest.addResult("Captured call stacks in no particular order:");
+ callStacksOutput.sort();
+ InspectorTest.addResults(callStacksOutput);
+ InspectorTest.completeDebuggerTest();
+ }
+ }
+};
+
InspectorTest.waitUntilPausedNextTime = function(callback)
{
InspectorTest._waitUntilPausedCallback = InspectorTest.safeWrap(callback);
@@ -122,6 +154,12 @@ InspectorTest.resumeExecution = function(callback)
InspectorTest.captureStackTrace = function(callFrames, asyncStackTrace, options)
{
+ InspectorTest.addResult(InspectorTest.captureStackTraceIntoString(callFrames, asyncStackTrace, options));
+};
+
+InspectorTest.captureStackTraceIntoString = function(callFrames, asyncStackTrace, options)
+{
+ var results = [];
options = options || {};
function printCallFrames(callFrames)
@@ -139,22 +177,23 @@ InspectorTest.captureStackTrace = function(callFrames, asyncStackTrace, options)
lineNumber = "(line number)";
}
var s = " " + i + ") " + frame.functionName + " (" + url + (options.dropLineNumbers ? "" : ":" + lineNumber) + ")";
- InspectorTest.addResult(s);
+ results.push(s);
if (options.printReturnValue && frame.returnValue)
- InspectorTest.addResult(" <return>: " + frame.returnValue.description);
+ results.push(" <return>: " + frame.returnValue.description);
}
}
- InspectorTest.addResult("Call stack:");
+ results.push("Call stack:");
printCallFrames(callFrames);
while (asyncStackTrace) {
- InspectorTest.addResult(" [" + (asyncStackTrace.description || "Async Call") + "]");
+ results.push(" [" + (asyncStackTrace.description || "Async Call") + "]");
printCallFrames(asyncStackTrace.callFrames);
- if (asyncStackTrace.callFrames[0].functionName === "testFunction")
+ if (asyncStackTrace.callFrames.peekLast().functionName === "testFunction")
break;
asyncStackTrace = asyncStackTrace.asyncStackTrace;
}
+ return results.join("\n");
};
InspectorTest.dumpSourceFrameContents = function(sourceFrame)
« no previous file with comments | « no previous file | LayoutTests/http/tests/inspector/inspector-test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698