blob: e04d5084e7f8266a37a70be0d01d8f980bb5277c [file] [log] [blame]
<!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(WI.mainTarget);
return targetData.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) {
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(WI.mainTarget);
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>