blob: 0f5a3154b37137f79e466d97b4034638f863b754 [file] [log] [blame]
<html>
<head>
<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
<script src="resources/breakpoint.js"></script>
<script>
function test()
{
InspectorProtocol.sendCommand("Debugger.enable", {});
InspectorProtocol.sendCommand("Debugger.setBreakpointsActive", {active: true});
var allowedToHitBreakpoint = false;
var breakpointIdentifier = null;
InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
{
if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
ProtocolTest.log("Found breakpoint.js");
var scriptIdentifier = messageObject.params.scriptId;
var location = {scriptId: scriptIdentifier, lineNumber: 13, columnNumber: 0};
var options = {autoContinue: true};
InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
InspectorProtocol.checkForError(responseObject);
breakpointIdentifier = responseObject.result.breakpointId;
ProtocolTest.log("Running breakpointAutomaticallyContinue multiple times with automatically continue");
InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointAutomaticallyContinue()"});
InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointAutomaticallyContinue()"});
InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointAutomaticallyContinue()"}, function() {
ProtocolTest.log("Removing breakpoint");
InspectorProtocol.sendCommand("Debugger.removeBreakpoint", {"breakpointId": breakpointIdentifier}, function(responseObject) {
InspectorProtocol.checkForError(responseObject);
allowedToHitBreakpoint = true;
options = {autoContinue: false};
ProtocolTest.log("Setting new breakpoint without autoContinue that should trigger");
InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
InspectorProtocol.checkForError(responseObject);
InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointAutomaticallyContinue()"});
});
});
});
});
}
}
InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
{
ProtocolTest.log("Hit Breakpoint!");
InspectorProtocol.sendCommand("Debugger.disable");
if (!allowedToHitBreakpoint) {
ProtocolTest.log("FAIL: should not have hit breakpoint.");
ProtocolTest.completeTest();
} else {
ProtocolTest.log("PASS: hit breakpoint when allowed.");
ProtocolTest.completeTest();
}
}
}
</script>
</head>
<body onload="runTest()">
<p>Debugger.setBreakpoint options.autoContinue</p>
</body>
</html>