90f035a8495ec24eddea064a2e1347ed56dbfeb9
[WebKit-https.git] / LayoutTests / inspector-protocol / debugger / setBreakpoint.html
1 <html>
2 <head>
3 <script src="../../http/tests/inspector-protocol/resources/protocol-test.js"></script>
4 <script src="resources/breakpoint.js"></script>
5 <script>
6 function test()
7 {
8     InspectorTest.sendCommand("Debugger.enable", {});
9     InspectorTest.sendCommand("Debugger.setBreakpointsActive", {active: true}, function() {
10         InspectorTest.log("Breakpoints Enabled");
11     });
12
13     InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
14     {
15         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
16             InspectorTest.log("Found breakpoint.js");
17             var scriptIdentifier = messageObject.params.scriptId;
18             var location = {scriptId: scriptIdentifier, lineNumber: 3, columnNumber: 0};
19             InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location}, function(responseObject) {
20                 InspectorTest.checkForError(responseObject);
21                 InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location}, function(responseObject) {
22                     if (!responseObject.error) {
23                         InspectorTest.log("FAIL: Expected error setting duplicate breakpoint");
24                         InspectorTest.completeTest();
25                     } else {
26                         InspectorTest.log("PASS: Received error setting duplicate breakpoint: " + responseObject.error.message);
27                         InspectorTest.log("Running breakpointBasic");
28                         InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointBasic()"});
29                     }
30                 });
31             });
32         }
33     }
34
35     InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
36     {
37         InspectorTest.log("Hit Breakpoint!");
38         InspectorTest.log("PASS");
39         InspectorTest.completeTest();
40     }
41 }
42 </script>
43 </head>
44 <body onload="runTest()">
45 <p>Debugger.setBreakpoint on line:0 in &lt;script src="..."&gt;</p>
46 </body>
47 </html>