| <html> |
| <head> |
| <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| <script src="../../../http/tests/inspector/debugger-test.js"></script> |
| <script src="../debugger/resources/click-breakpoints.js"></script> |
| <script> |
| function test() |
| { |
| function clickCodeMirrorLineNumber(lineNumber, isRemove, sourceFrame) |
| { |
| var element = Array.from(document.getElementsByClassName("CodeMirror-linenumber")).filter(x => x.textContent === (lineNumber + 1).toString())[0]; |
| if (!element) { |
| InspectorTest.addResult("CodeMirror Gutter Not Found:" + lineNumber); |
| InspectorTest.completeDebuggerTest(); |
| return Promise.resolve(); |
| } |
| var rect = element.getBoundingClientRect(); |
| eventSender.mouseMoveTo(rect.left + rect.width / 2, rect.top + rect.height / 2); |
| eventSender.mouseDown(); |
| eventSender.mouseUp(); |
| if (!isRemove) |
| return new Promise(resolve => InspectorTest.addSniffer(sourceFrame.__proto__, "_breakpointWasSetForTest", resolve, false)); |
| return Promise.resolve(); |
| } |
| |
| Bindings.breakpointManager._storage._breakpoints = {}; |
| var panel = UI.panels.sources; |
| var scriptFormatter; |
| var formattedSourceFrame; |
| |
| InspectorTest.startDebuggerTest(() => InspectorTest.showScriptSource("click-breakpoints.js", didShowScriptSource)); |
| |
| |
| function didShowScriptSource(sourceFrame) |
| { |
| clickCodeMirrorLineNumber(2, false, sourceFrame) |
| .then(() => clickCodeMirrorLineNumber(2, true, sourceFrame)) |
| .then(() => clickCodeMirrorLineNumber(3, false, sourceFrame)) |
| .then(runScript); |
| } |
| |
| function runScript() |
| { |
| Promise.all([InspectorTest.waitBreakpointSidebarPane(), new Promise(resolve => InspectorTest.waitUntilPaused(resolve))]) |
| .then(() => InspectorTest.dumpBreakpointSidebarPane("while paused")) |
| .then(() => InspectorTest.completeDebuggerTest()); |
| InspectorTest.evaluateInPageWithTimeout("f2()"); |
| } |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>Tests that breakpoints can be added and removed by clicking the gutter. |
| </p> |
| </body> |
| </html> |