| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="../../http/tests/inspector/resources/inspector-test.js"></script> | |
| <script> | |
| function triggerMultiplePauses() { | |
| setTimeout(pause1, 0); | |
| setTimeout(pause2, 0); | |
| } | |
| function pause1() { | |
| debugger; | |
| } | |
| function pause2() { | |
| debugger; | |
| } | |
| function test() | |
| { | |
| function topCallFrameName() { | |
| let targetData = WI.debuggerManager.dataForTarget(InspectorTest.mainFrameTarget); | |
| return targetData.stackTrace.callFrames[0].functionName; | |
| } | |
| let suite = InspectorTest.createAsyncSuite("Debugger.continueUntilNextRunLoop"); | |
| suite.addTestCase({ | |
| name: "Debugger.Unpaused.continueUntilNextRunLoop", | |
| description: "Debugger.continueUntilNextRunLoop should only work when paused.", | |
| test(resolve, reject) { | |
| InspectorTest.mainFrameTarget.DebuggerAgent.continueUntilNextRunLoop((error) => { | |
| InspectorTest.expectThat(error, "Should produce an error if not paused."); | |
| InspectorTest.log(error); | |
| resolve(); | |
| }); | |
| } | |
| }); | |
| suite.addTestCase({ | |
| name: "Debugger.Unpaused.continueUntilNextRunLoop", | |
| description: "Debugger.continueUntilNextRunLoop should only work when paused.", | |
| test(resolve, reject) { | |
| InspectorTest.evaluateInPage("triggerMultiplePauses()"); | |
| WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => { | |
| InspectorTest.pass("Received First Pause Event."); | |
| InspectorTest.expectEqual(topCallFrameName(), "pause1", "Should be paused in pause1."); | |
| WI.debuggerManager.continueUntilNextRunLoop(InspectorTest.mainFrameTarget); | |
| WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => { | |
| InspectorTest.pass("Received Second Pause Event."); | |
| InspectorTest.expectEqual(topCallFrameName(), "pause2", "Should be paused in pause2."); | |
| WI.debuggerManager.resume().then(resolve, reject); | |
| }); | |
| }); | |
| } | |
| }); | |
| suite.runTestCasesAndFinish(); | |
| } | |
| </script> | |
| </head> | |
| <body onload="runTest()"> | |
| <p>Debugger.continueUntilNextRunLoop</p> | |
| </body> | |
| </html> |