blob: b7dbcc0b53f7b2093ef3494868123a5df88457cc [file] [edit]
<!doctype html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script src="../debugger/resources/breakpoint-options-utilities.js"></script>
<script src="../debugger/resources/log-active-stack-trace.js"></script>
<script src="../worker/resources/resource-utilities.js"></script>
<script src="resources/url-breakpoint-utilities.js"></script>
<script>
function test()
{
const type = WI.URLBreakpoint.Type.RegularExpression;
const url = "data[A-Z]*\.(json|txt|png)";
let suite = InspectorTest.createAsyncSuite("URLBreakpoint.BreakOnMatchingRegularExpression");
suite.addTestCase({
name: "URLBreakpoint.BreakOnMatchingRegularExpression.DOM",
description: "Check that debugger pauses based on a URL matching a regex pattern.",
async test() {
let breakpoint = await InspectorTest.URLBreakpoint.createBreakpoint(type, url);
InspectorTest.URLBreakpoint.request("DOM");
await WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused);
let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
InspectorTest.log("PAUSED:");
InspectorTest.expectEqual(targetData.pauseReason, WI.DebuggerManager.PauseReason.URL, `Pause reason should be URL.`);
InspectorTest.expectEqual(targetData.pauseData.breakpointURL, breakpoint.url, "Pause data URL should match breakpoint URL.");
logActiveStackTrace();
await WI.debuggerManager.resume();
},
teardown: InspectorTest.URLBreakpoint.teardown,
});
InspectorTest.BreakpointOptions.addTestCases(suite, {
testCaseNamePrefix: "DOM.",
createBreakpoint() {
return InspectorTest.URLBreakpoint.createBreakpoint(type, url);
},
triggerBreakpoint() {
return InspectorTest.URLBreakpoint.request("DOM");
},
});
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="runTest()">
<p>Tests for regex URL breakpoints.</p>
</body>
</html>