| <html> |
| <head> |
| <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| <script src="../../../http/tests/inspector/debugger-test.js"></script> |
| <script src="../../../http/tests/inspector/resources/compiled.js"></script> |
| <script> |
| |
| var test = function() |
| { |
| InspectorTest.startDebuggerTest(step1); |
| |
| function step1() |
| { |
| InspectorTest.showScriptSource("source1.js", step2); |
| } |
| |
| function step2(sourceFrame) |
| { |
| InspectorTest.addSniffer(Bindings.BreakpointManager.TargetBreakpoint.prototype, "_addResolvedLocation", didSetBreakpointInDebugger, true); |
| |
| InspectorTest.setBreakpoint(sourceFrame, 14, "", true); |
| InspectorTest.setBreakpoint(sourceFrame, 15, "", true); |
| |
| var counter = 2; |
| |
| function didSetBreakpointInDebugger() |
| { |
| counter--; |
| if (counter) |
| return; |
| //Both breakpoints are resolved before reload |
| InspectorTest.addSniffer(Sources.JavaScriptBreakpointsSidebarPane.prototype, "didReceiveBreakpointLineForTest", onBreakpointsReady); |
| } |
| |
| function onBreakpointsReady() |
| { |
| InspectorTest.dumpBreakpointSidebarPane("Breakpoints before reload:"); |
| waitForBreakpoints(); |
| InspectorTest.reloadPage(onPageReloaded); |
| } |
| |
| function waitForBreakpoints() |
| { |
| var expectedBreakpointLocations = [[14, 0], [16, 4]]; |
| var jsBreakpoints = self.runtime.sharedInstance(Sources.JavaScriptBreakpointsSidebarPane); |
| jsBreakpoints.didReceiveBreakpointLineForTest = function(uiSourceCode, line, column) |
| { |
| if (Bindings.CompilerScriptMapping.StubProjectID === uiSourceCode.project().id()) |
| return; |
| if (!uiSourceCode.url().endsWith("source1.js")) |
| return; |
| |
| expectedBreakpointLocations = |
| expectedBreakpointLocations.filter((location) => (location[0] != line && location[1] != column)); |
| if (expectedBreakpointLocations.length) |
| return; |
| breakpointSourcesReceived = true; |
| maybeCompleteTest(); |
| } |
| } |
| |
| } |
| |
| var breakpointSourcesReceived = false; |
| var pageReloaded = false; |
| |
| function onPageReloaded() |
| { |
| pageReloaded = true; |
| maybeCompleteTest(); |
| } |
| |
| function maybeCompleteTest() |
| { |
| if (!pageReloaded || !breakpointSourcesReceived) |
| return; |
| InspectorTest.dumpBreakpointSidebarPane("Breakpoints after reload:"); |
| InspectorTest.completeDebuggerTest(); |
| } |
| } |
| |
| </script> |
| </head> |
| |
| <body onload="runTest()"> |
| <p> |
| Tests "reload" from within inspector window while on pause. |
| </p> |
| |
| </body> |
| </html> |