blob: 6253d9952fb80d18cd997f5a8e8eeeea2bb1c62f [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script src="../debugger/resources/log-active-stack-trace.js"></script>
<script src="resources/dom-debugger-utilities.js"></script>
<script>
function test()
{
let workerTarget = null;
let suite = InspectorTest.createAsyncSuite("Worker.DOMDebugger.EventBreakpoint.Interval");
suite.addTestCase({
name: "Worker.DOMDebugger.EventBreakpoint.Interval.Basic",
description: "Check that adding/removing interval event breakpoints work for a Worker target.",
async test() {
InspectorTest.assert(workerTarget.DOMDebuggerAgent, "Worker target should have a DOMDebuggerAgent.");
InspectorTest.assert(workerTarget.DOMDebuggerAgent.setEventBreakpoint, "The Worker's DOMDebuggerAgent should have a setEventBreakpoint command.");
InspectorTest.assert(workerTarget.DOMDebuggerAgent.removeEventBreakpoint, "The Worker's DOMDebuggerAgent should have a removeEventBreakpoint command.");
const breakpointType = "interval";
await workerTarget.DOMDebuggerAgent.setEventBreakpoint(breakpointType);
await Promise.all([
WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused),
InspectorTest.evaluateInPage(`worker.postMessage("triggerInterval")`),
]);
let paused = WI.debuggerManager.paused;
let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
let pauseReason = targetData.pauseReason;
let stackTrace = getActiveStackTrace();
await workerTarget.DOMDebuggerAgent.removeEventBreakpoint(breakpointType);
await WI.debuggerManager.resume();
InspectorTest.expectThat(paused, "Should have paused.");
InspectorTest.expectEqual(pauseReason, WI.DebuggerManager.PauseReason.Interval, "Pause reason should have been Interval.");
logStackTrace(stackTrace);
},
});
InspectorTest.Worker.DOMDebugger.createWorkerTarget((target) => {
workerTarget = target;
suite.runTestCasesAndFinish();
});
}
</script>
</head>
<body onload="runTest()">
<p>Tests for interval event breakpoint functionality (DOMDebugger) in a Worker.</p>
</body>
</html>