OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 3 <script src="../../http/tests/inspector/debugger-test.js"></script> |
| 4 |
| 5 <script type="application/dart" src="debugger.dart"></script> |
| 6 |
| 7 <script> |
| 8 |
| 9 function testFunction() { |
| 10 window.postMessage('fromJS', '*'); |
| 11 } |
| 12 |
| 13 function handleReplyFromDart(event) |
| 14 { |
| 15 if (event.data == 'fromDart') |
| 16 debugger; |
| 17 } |
| 18 |
| 19 window.addEventListener('load', function() |
| 20 { |
| 21 window.addEventListener('message', handleReplyFromDart); |
| 22 }); |
| 23 |
| 24 function test() |
| 25 { |
| 26 var panel = WebInspector.inspectorView.showPanel("sources"); |
| 27 InspectorTest.runDebuggerTestSuite([ |
| 28 function testSetBreakpoint(next) |
| 29 { |
| 30 InspectorTest.showScriptSource('debugger.dart', didShowScriptSource)
; |
| 31 |
| 32 function didShowScriptSource(sourceFrame) |
| 33 { |
| 34 setBreakpointAndWaitUntilPaused(sourceFrame, 13, didPauseInDart)
; |
| 35 InspectorTest.runTestFunction(); |
| 36 } |
| 37 |
| 38 function didPauseInDart(callFrames) |
| 39 { |
| 40 InspectorTest.captureStackTrace(callFrames, false, true); |
| 41 InspectorTest.resumeExecution(resumedDart); |
| 42 } |
| 43 |
| 44 function resumedDart() |
| 45 { |
| 46 InspectorTest.waitUntilPaused(didPauseInJS); |
| 47 } |
| 48 |
| 49 function didPauseInJS(callFrames) |
| 50 { |
| 51 InspectorTest.captureStackTrace(callFrames, false, true); |
| 52 InspectorTest.resumeExecution(next); |
| 53 } |
| 54 }, |
| 55 |
| 56 function testRemoveBreakpoint(next) |
| 57 { |
| 58 InspectorTest.showScriptSource('debugger.dart', didShowScriptSource)
; |
| 59 |
| 60 function didShowScriptSource(sourceFrame) |
| 61 { |
| 62 InspectorTest.removeBreakpoint(sourceFrame, 13); |
| 63 InspectorTest.runTestFunctionAndWaitUntilPaused(didPause); |
| 64 } |
| 65 |
| 66 function didPause(callFrames) |
| 67 { |
| 68 // Should pause in JS. |
| 69 InspectorTest.captureStackTrace(callFrames, false, true); |
| 70 InspectorTest.resumeExecution(next); |
| 71 } |
| 72 } |
| 73 ]); |
| 74 |
| 75 function setBreakpointAndWaitUntilPaused(sourceFrame, lineNumber, pausedCall
back) |
| 76 { |
| 77 var expectedBreakpointId; |
| 78 InspectorTest.addSniffer(WebInspector.BreakpointManager.TargetBreakpoint
.prototype, "_didSetBreakpointInDebugger", didSetBreakpointInDebugger); |
| 79 InspectorTest.setBreakpoint(sourceFrame, lineNumber, "", true); |
| 80 |
| 81 function didSetBreakpointInDebugger(callback, breakpointId) |
| 82 { |
| 83 expectedBreakpointId = breakpointId; |
| 84 InspectorTest.waitUntilPaused(didPause); |
| 85 } |
| 86 |
| 87 function didPause(callFrames, reason, breakpointIds) |
| 88 { |
| 89 InspectorTest.assertEquals(breakpointIds.length, 1); |
| 90 InspectorTest.assertEquals(breakpointIds[0], expectedBreakpointId); |
| 91 InspectorTest.assertEquals(reason, "other"); |
| 92 |
| 93 pausedCallback(callFrames); |
| 94 } |
| 95 } |
| 96 }; |
| 97 |
| 98 </script> |
| 99 |
| 100 <body onload="runTest()"> |
| 101 </body> |
| 102 </html> |
OLD | NEW |