Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../http/tests/inspector/debugger-test.js"></script> | 4 <script src="../../../http/tests/inspector/debugger-test.js"></script> |
| 5 <script src="../debugger/resources/click-breakpoints.js"></script> | 5 <script src="../debugger/resources/click-breakpoints.js"></script> |
| 6 <script> | 6 <script> |
| 7 function test() | 7 function test() |
| 8 { | 8 { |
| 9 function clickCodeMirrorLineNumber(lineNumber) | 9 function clickCodeMirrorLineNumber(lineNumber, isRemove, sourceFrame) |
| 10 { | 10 { |
| 11 var element = Array.from(document.getElementsByClassName("CodeMirror-lin enumber")).filter(x => x.textContent === (lineNumber + 1).toString())[0]; | 11 var element = Array.from(document.getElementsByClassName("CodeMirror-lin enumber")).filter(x => x.textContent === (lineNumber + 1).toString())[0]; |
| 12 if (!element) { | 12 if (!element) { |
| 13 InspectorTest.addResult("CodeMirror Gutter Not Found:" + lineNumber) ; | 13 InspectorTest.addResult("CodeMirror Gutter Not Found:" + lineNumber) ; |
| 14 InspectorTest.completeDebuggerTest(); | 14 InspectorTest.completeDebuggerTest(); |
| 15 return false; | 15 return Promise.resolve(); |
| 16 } | 16 } |
| 17 var rect = element.getBoundingClientRect(); | 17 var rect = element.getBoundingClientRect(); |
| 18 eventSender.mouseMoveTo(rect.left + rect.width / 2, rect.top + rect.heig ht / 2); | 18 eventSender.mouseMoveTo(rect.left + rect.width / 2, rect.top + rect.heig ht / 2); |
| 19 eventSender.mouseDown(); | 19 eventSender.mouseDown(); |
| 20 eventSender.mouseUp(); | 20 eventSender.mouseUp(); |
| 21 return true; | 21 if (!isRemove) |
| 22 return new Promise(resolve => InspectorTest.addSniffer(sourceFrame._ _proto__, "_setBreakpoint", resolve, false)); | |
|
dgozman
2016/11/09 20:44:03
Introduce a special method |_breakpointWasSetForTe
kozy
2016/11/10 03:17:36
Done.
| |
| 23 return Promise.resolve(); | |
| 22 } | 24 } |
| 23 | 25 |
| 24 WebInspector.breakpointManager._storage._breakpoints = {}; | 26 WebInspector.breakpointManager._storage._breakpoints = {}; |
| 25 var panel = WebInspector.panels.sources; | 27 var panel = WebInspector.panels.sources; |
| 26 var scriptFormatter; | 28 var scriptFormatter; |
| 27 var formattedSourceFrame; | 29 var formattedSourceFrame; |
| 28 | 30 |
| 29 InspectorTest.startDebuggerTest(() => InspectorTest.showScriptSource("click- breakpoints.js", didShowScriptSource)); | 31 InspectorTest.startDebuggerTest(() => InspectorTest.showScriptSource("click- breakpoints.js", didShowScriptSource)); |
| 30 | 32 |
| 31 | 33 |
| 32 function didShowScriptSource() | 34 function didShowScriptSource(sourceFrame) |
| 33 { | 35 { |
| 34 clickCodeMirrorLineNumber(2); | 36 clickCodeMirrorLineNumber(2, false, sourceFrame) |
| 35 clickCodeMirrorLineNumber(2); | 37 .then(() => clickCodeMirrorLineNumber(2, true, sourceFrame)) |
| 36 clickCodeMirrorLineNumber(3); | 38 .then(() => clickCodeMirrorLineNumber(3, false, sourceFrame)) |
| 39 .then(runScript); | |
| 40 } | |
| 41 | |
| 42 function runScript() | |
| 43 { | |
| 37 InspectorTest.waitUntilPaused(pausedInF2); | 44 InspectorTest.waitUntilPaused(pausedInF2); |
| 38 InspectorTest.evaluateInPageWithTimeout("f2()"); | 45 InspectorTest.evaluateInPageWithTimeout("f2()"); |
| 39 } | 46 } |
| 40 | 47 |
| 41 function pausedInF2(callFrames) | 48 function pausedInF2(callFrames) |
| 42 { | 49 { |
| 43 InspectorTest.dumpBreakpointSidebarPane("while paused"); | 50 InspectorTest.dumpBreakpointSidebarPane("while paused"); |
| 44 InspectorTest.completeDebuggerTest(); | 51 InspectorTest.completeDebuggerTest(); |
| 45 } | 52 } |
| 46 | 53 |
| 47 } | 54 } |
| 48 </script> | 55 </script> |
| 49 </head> | 56 </head> |
| 50 <body onload="runTest()"> | 57 <body onload="runTest()"> |
| 51 <p>Tests that breakpoints can be added and removed by clicking the gutter. | 58 <p>Tests that breakpoints can be added and removed by clicking the gutter. |
| 52 </p> | 59 </p> |
| 53 </body> | 60 </body> |
| 54 </html> | 61 </html> |
| OLD | NEW |