| 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 | 5 |
| 6 <script> | 6 <script> |
| 7 function oneLineTestFunction() { return 0; } | 7 function oneLineTestFunction() { return 0; } |
| 8 </script> | 8 </script> |
| 9 | 9 |
| 10 <script> | 10 <script> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 var currentSourceFrame; | 23 var currentSourceFrame; |
| 24 InspectorTest.setQuiet(true); | 24 InspectorTest.setQuiet(true); |
| 25 InspectorTest.runDebuggerTestSuite([ | 25 InspectorTest.runDebuggerTestSuite([ |
| 26 function testSetBreakpoint(next) | 26 function testSetBreakpoint(next) |
| 27 { | 27 { |
| 28 InspectorTest.showScriptSource("set-breakpoint.html", didShowScriptS
ource); | 28 InspectorTest.showScriptSource("set-breakpoint.html", didShowScriptS
ource); |
| 29 | 29 |
| 30 function didShowScriptSource(sourceFrame) | 30 function didShowScriptSource(sourceFrame) |
| 31 { | 31 { |
| 32 currentSourceFrame = sourceFrame; | 32 currentSourceFrame = sourceFrame; |
| 33 InspectorTest.prepareSourceFrameForBreakpointTest(currentSourceF
rame); |
| 33 InspectorTest.addResult("Script source was shown."); | 34 InspectorTest.addResult("Script source was shown."); |
| 34 setBreakpointAndWaitUntilPaused(currentSourceFrame, 16, didPause
); | 35 InspectorTest.waitUntilPaused(didPause); |
| 35 InspectorTest.runTestFunction(); | 36 InspectorTest.createNewBreakpoint(currentSourceFrame, 16, "", tr
ue) |
| 37 .then(() => InspectorTest.waitBreakpointSidebarPane()) |
| 38 .then(() => InspectorTest.runTestFunction()); |
| 36 } | 39 } |
| 37 | 40 |
| 38 function didPause(callFrames) | 41 function didPause(callFrames) |
| 39 { | 42 { |
| 40 InspectorTest.addResult("Script execution paused."); | 43 InspectorTest.addResult("Script execution paused."); |
| 41 InspectorTest.captureStackTrace(callFrames); | 44 InspectorTest.captureStackTrace(callFrames); |
| 42 InspectorTest.dumpBreakpointSidebarPane(); | 45 InspectorTest.dumpBreakpointSidebarPane(); |
| 46 InspectorTest.removeBreakpoint(currentSourceFrame, 16) |
| 43 InspectorTest.waitBreakpointSidebarPane().then(breakpointRemoved
); | 47 InspectorTest.waitBreakpointSidebarPane().then(breakpointRemoved
); |
| 44 InspectorTest.removeBreakpoint(currentSourceFrame, 16); | |
| 45 } | 48 } |
| 46 | 49 |
| 47 function breakpointRemoved() | 50 function breakpointRemoved() |
| 48 { | 51 { |
| 49 InspectorTest.resumeExecution(didResume); | 52 InspectorTest.resumeExecution(didResume); |
| 50 } | 53 } |
| 51 | 54 |
| 52 function didResume() | 55 function didResume() |
| 53 { | 56 { |
| 54 InspectorTest.dumpBreakpointSidebarPane() | 57 InspectorTest.dumpBreakpointSidebarPane() |
| 55 InspectorTest.addResult("Script execution resumed."); | 58 InspectorTest.addResult("Script execution resumed."); |
| 56 next(); | 59 next(); |
| 57 } | 60 } |
| 58 }, | 61 }, |
| 59 | 62 |
| 60 function testSetBreakpointOnTheLastLine(next) | 63 function testSetBreakpointOnTheLastLine(next) |
| 61 { | 64 { |
| 62 InspectorTest.showScriptSource("set-breakpoint.html", didShowScriptS
ource); | 65 InspectorTest.showScriptSource("set-breakpoint.html", didShowScriptS
ource); |
| 63 | 66 |
| 64 function didShowScriptSource(sourceFrame) | 67 function didShowScriptSource(sourceFrame) |
| 65 { | 68 { |
| 66 currentSourceFrame = sourceFrame; | 69 currentSourceFrame = sourceFrame; |
| 67 setBreakpointAndWaitUntilPaused(currentSourceFrame, 6, didPause)
; | 70 InspectorTest.waitUntilPaused(didPause); |
| 68 InspectorTest.evaluateInPage("setTimeout(oneLineTestFunction, 0)
"); | 71 InspectorTest.createNewBreakpoint(currentSourceFrame, 6, "", tru
e) |
| 72 .then(() => InspectorTest.waitBreakpointSidebarPane()) |
| 73 .then(() => InspectorTest.evaluateInPage("setTimeout(oneLine
TestFunction, 0)")); |
| 69 } | 74 } |
| 70 | 75 |
| 71 function didPause(callFrames) | 76 function didPause(callFrames) |
| 72 { | 77 { |
| 73 InspectorTest.captureStackTrace(callFrames); | 78 InspectorTest.captureStackTrace(callFrames); |
| 74 InspectorTest.removeBreakpoint(currentSourceFrame, 6); | 79 InspectorTest.removeBreakpoint(currentSourceFrame, 6); |
| 75 InspectorTest.resumeExecution(next); | 80 InspectorTest.resumeExecution(next); |
| 76 } | 81 } |
| 77 }, | 82 }, |
| 78 | 83 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 108 } | 113 } |
| 109 | 114 |
| 110 function didSetBreakpointAgain(error, breakpointId) | 115 function didSetBreakpointAgain(error, breakpointId) |
| 111 { | 116 { |
| 112 InspectorTest.assertTrue(!!error); | 117 InspectorTest.assertTrue(!!error); |
| 113 InspectorTest.assertTrue(!breakpointId); | 118 InspectorTest.assertTrue(!breakpointId); |
| 114 next(); | 119 next(); |
| 115 } | 120 } |
| 116 } | 121 } |
| 117 ]); | 122 ]); |
| 118 | |
| 119 function setBreakpointAndWaitUntilPaused(sourceFrame, lineNumber, pausedCall
back) | |
| 120 { | |
| 121 var expectedBreakpointId; | |
| 122 InspectorTest.addSniffer(Bindings.BreakpointManager.ModelBreakpoint.prot
otype, "_didSetBreakpointInDebugger", didSetBreakpointInDebugger); | |
| 123 InspectorTest.setBreakpoint(sourceFrame, lineNumber, "", true); | |
| 124 | |
| 125 function didSetBreakpointInDebugger(callback, breakpointId) | |
| 126 { | |
| 127 expectedBreakpointId = breakpointId; | |
| 128 InspectorTest.waitUntilPaused(didPause); | |
| 129 } | |
| 130 | |
| 131 function didPause(callFrames, reason, breakpointIds) | |
| 132 { | |
| 133 InspectorTest.assertEquals(breakpointIds.length, 1); | |
| 134 InspectorTest.assertEquals(breakpointIds[0], expectedBreakpointId); | |
| 135 InspectorTest.assertEquals(reason, "other"); | |
| 136 | |
| 137 pausedCallback(callFrames); | |
| 138 } | |
| 139 } | |
| 140 } | 123 } |
| 141 | 124 |
| 142 </script> | 125 </script> |
| 143 </head> | 126 </head> |
| 144 | 127 |
| 145 <body onload="runTest()"> | 128 <body onload="runTest()"> |
| 146 <p> | 129 <p> |
| 147 Tests setting breakpoints. | 130 Tests setting breakpoints. |
| 148 </p> | 131 </p> |
| 149 | 132 |
| 150 </body> | 133 </body> |
| 151 </html> | 134 </html> |
| OLD | NEW |