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..6ffa21789727402a3a88eb69b91f4149052a8a60 100644 |
--- a/LayoutTests/http/tests/inspector/debugger-test.js |
+++ b/LayoutTests/http/tests/inspector/debugger-test.js |
@@ -83,6 +83,43 @@ InspectorTest.runTestFunctionAndWaitUntilPaused = function(callback) |
InspectorTest.waitUntilPaused(callback); |
}; |
+InspectorTest.runAsyncCallStacksTest = function(totalDebuggerStatements, maxAsyncCallStackDepth) |
+{ |
+ 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.
|
+ |
+ 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; |
+ InspectorTest.beginResultBufferring(); |
yurys
2013/12/23 09:11:57
I must have overlooked this begin/endResultBufferi
aandrey
2013/12/23 12:09:38
Done.
|
+ InspectorTest.captureStackTrace(callFrames, asyncStackTrace); |
+ callStacksOutput.push(InspectorTest.endResultBufferring()); |
+ |
+ 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); |
@@ -151,7 +188,7 @@ InspectorTest.captureStackTrace = function(callFrames, asyncStackTrace, options) |
while (asyncStackTrace) { |
InspectorTest.addResult(" [" + (asyncStackTrace.description || "Async Call") + "]"); |
printCallFrames(asyncStackTrace.callFrames); |
- if (asyncStackTrace.callFrames[0].functionName === "testFunction") |
+ if (asyncStackTrace.callFrames.peekLast().functionName === "testFunction") |
break; |
asyncStackTrace = asyncStackTrace.asyncStackTrace; |
} |