Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger-async / async-callstack-middle-run.html
blobd4425a21588c52702a1801477f2a434f282ab787
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/debugger-test.js"></script>
5 <script>
7 function testFunction()
9 setTimeout(timeoutOffCapturing, 0);
12 function timeoutOffCapturing()
14 setTimeout(timeoutOffCapturing2, 0);
15 debugger; // Will start capturing async stacks from this point.
16 setTimeout(timeoutOnCapturing, 0);
19 function timeoutOffCapturing2()
21 debugger;
24 function timeoutOnCapturing()
26 debugger;
29 var test = function()
31 var totalDebuggerStatements = 3;
32 var maxAsyncCallStackDepth = 4;
34 InspectorTest.setQuiet(true);
35 InspectorTest.startDebuggerTest(step1);
37 function step1()
39 InspectorTest.DebuggerAgent.setAsyncCallStackDepth(0, step2);
42 function step2()
44 InspectorTest.runTestFunctionAndWaitUntilPaused(didPause);
47 function resumeExecution()
49 InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(InspectorTest, didPause));
52 var step = 0;
53 var callStacksOutput = [];
54 function didPause(callFrames, reason, breakpointIds, asyncStackTrace)
56 ++step;
57 if (step === 1) {
58 InspectorTest.DebuggerAgent.setAsyncCallStackDepth(maxAsyncCallStackDepth, resumeExecution);
59 return;
62 callStacksOutput.push(InspectorTest.captureStackTraceIntoString(callFrames, asyncStackTrace) + "\n");
63 if (step < totalDebuggerStatements) {
64 resumeExecution();
65 } else {
66 InspectorTest.addResult("Captured call stacks in no particular order:");
67 callStacksOutput.sort();
68 InspectorTest.addResults(callStacksOutput);
69 InspectorTest.completeDebuggerTest();
74 </script>
75 </head>
77 <body onload="runTest()">
78 <p>
79 Tests that capturing asynchronous call stacks in debugger works if started after some time since the page loads.
80 </p>
82 </body>
83 </html>