3 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../../http/tests/inspector/debugger-test.js"></script>
5 <script src=
"../debugger/resources/framework.js"></script>
8 var dummy
= function FAIL_should_not_pause_here() { return 0; };
10 function testFunction()
15 setTimeout(dummy
, 30);
16 (function setAsyncBreakpointForMe() { setTimeout(callback1
, 20); })();
21 debugger; // Stop the debugger to receive pending AsyncOperation events.
26 var func
= setTimeout
.bind(null, callback2
, 0);
27 func
= setTimeout
.bind(null, func
, 0);
28 func
= setTimeout
.bind(null, func
, 0);
29 (function setAsyncBreakpointForMe() { setTimeout(func
); })();
36 var func
= Framework
.willSchedule(callback3
);
37 func
= Framework
.willSchedule(func
);
38 func
= Framework
.willSchedule(func
);
39 (function setAsyncBreakpointForMe() { Framework
.schedule(func
); })();
41 Promise
.resolve().then(dummy
).then(dummy
).then(dummy
);
53 var maxAsyncCallStackDepth
= 4;
54 var frameworkRegexString
= "/framework\\.js$";
55 WebInspector
.settingForTest("skipStackFramesPattern").set(frameworkRegexString
);
57 InspectorTest
.startDebuggerTest(step1
, true);
61 InspectorTest
.runTestFunctionAndWaitUntilPaused(step2
);
66 InspectorTest
.debuggerModel
.addEventListener(WebInspector
.DebuggerModel
.Events
.AsyncOperationStarted
, onAsyncOperationStarted
);
67 InspectorTest
.DebuggerAgent
.setAsyncCallStackDepth(maxAsyncCallStackDepth
, step3
);
72 var callbackFuncCount
= 3;
77 if (!callbackFuncCount
--) {
78 InspectorTest
.completeDebuggerTest();
81 InspectorTest
.waitUntilPausedAndPerformSteppingActions(["Resume", "Resume"], InspectorTest
.waitUntilPaused
.bind(InspectorTest
, didPause
));
84 function didPause(callFrames
, reason
, breakpointIds
, asyncStackTrace
)
86 InspectorTest
.captureStackTrace(callFrames
);
87 InspectorTest
.addResult("Pause reason: " + reason
);
92 function onAsyncOperationStarted(event
)
94 var operation
= event
.data
;
95 var callFrames
= operation
.stackTrace
|| [];
96 for (var callFrame
of callFrames
) {
97 var functionName
= callFrame
&& callFrame
.functionName
;
98 if (functionName
=== "setAsyncBreakpointForMe") {
99 InspectorTest
.DebuggerAgent
.setAsyncOperationBreakpoint(operation
.id
);
109 <body onload=
"runTest()">
111 Tests AsyncOperation breakpoints.