3 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../../http/tests/inspector/debugger-test.js"></script>
7 function oneLineTestFunction() { return 0; }
11 function oneLineTestFunction2() { return 0; }</script>
15 function testFunction()
17 var x
= Math
.sqrt(10);
24 var currentSourceFrame
;
25 InspectorTest
.setQuiet(true);
26 InspectorTest
.runDebuggerTestSuite([
27 function testSetConditionalBreakpointThatBreaks(next
)
29 InspectorTest
.showScriptSource("set-conditional-breakpoint.html", didShowScriptSource
);
31 function didShowScriptSource(sourceFrame
)
33 currentSourceFrame
= sourceFrame
;
34 InspectorTest
.addResult("Script source was shown.");
35 setBreakpointAndWaitUntilPaused(currentSourceFrame
, 16, "true", didPause
);
36 InspectorTest
.runTestFunction();
39 function didPause(callFrames
)
41 InspectorTest
.addResult("Script execution paused.");
42 InspectorTest
.captureStackTrace(callFrames
);
43 InspectorTest
.dumpBreakpointSidebarPane();
44 InspectorTest
.addSniffer(currentSourceFrame
, "_removeBreakpointDecoration", breakpointRemoved
);
45 InspectorTest
.removeBreakpoint(currentSourceFrame
, 16);
48 function breakpointRemoved()
50 InspectorTest
.resumeExecution(didResume
);
55 InspectorTest
.dumpBreakpointSidebarPane()
56 InspectorTest
.addResult("Script execution resumed.");
61 function testSetConditionalBreakpointThatDoesNotBreak(next
)
63 InspectorTest
.showScriptSource("set-conditional-breakpoint.html", didShowScriptSource
);
65 function didShowScriptSource(sourceFrame
)
67 currentSourceFrame
= sourceFrame
;
68 InspectorTest
.addResult("Script source was shown.");
69 setBreakpoint(currentSourceFrame
, 16, "false");
70 InspectorTest
.runTestFunction();
71 InspectorTest
.addConsoleSniffer(testFunctionFinished
);
75 function testFunctionFinished(callFrames
)
77 InspectorTest
.addResult("Test function finished.");
78 InspectorTest
.dumpBreakpointSidebarPane();
79 InspectorTest
.addSniffer(currentSourceFrame
, "_removeBreakpointDecoration", breakpointRemoved
);
80 InspectorTest
.removeBreakpoint(currentSourceFrame
, 16);
83 function breakpointRemoved()
85 InspectorTest
.addResult("Breakpoints removed.");
86 InspectorTest
.dumpBreakpointSidebarPane();
92 function setBreakpoint(sourceFrame
, lineNumber
, condition
, callback
)
94 var expectedBreakpointId
;
95 InspectorTest
.addSniffer(WebInspector
.BreakpointManager
.TargetBreakpoint
.prototype, "_didSetBreakpointInDebugger", didSetBreakpointInDebugger
);
96 InspectorTest
.setBreakpoint(sourceFrame
, lineNumber
, condition
, true);
98 function didSetBreakpointInDebugger(breakpointManagerCallback
, breakpointId
)
101 callback(breakpointId
);
105 function setBreakpointAndWaitUntilPaused(sourceFrame
, lineNumber
, condition
, pausedCallback
)
107 setBreakpoint(sourceFrame
, lineNumber
, condition
, didSetBreakpointInDebugger
);
108 var expectedBreakpointId
;
110 function didSetBreakpointInDebugger(breakpointId
)
112 expectedBreakpointId
= breakpointId
;
113 InspectorTest
.waitUntilPaused(didPause
);
116 function didPause(callFrames
, reason
, breakpointIds
)
118 InspectorTest
.assertEquals(breakpointIds
.length
, 1);
119 InspectorTest
.assertEquals(breakpointIds
[0], expectedBreakpointId
);
120 InspectorTest
.assertEquals(reason
, "other");
122 pausedCallback(callFrames
);
130 <body onload=
"runTest()">
132 Tests setting breakpoints.