| 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="../../../http/tests/inspector/resources/compiled.js"></script> | 5 <script src="../../../http/tests/inspector/resources/compiled.js"></script> |
| 6 <script> | 6 <script> |
| 7 | 7 |
| 8 var test = function() | 8 var test = function() |
| 9 { | 9 { |
| 10 InspectorTest.startDebuggerTest(step1); | 10 InspectorTest.startDebuggerTest(step1); |
| 11 | 11 |
| 12 function step1() | 12 function step1() |
| 13 { | 13 { |
| 14 InspectorTest.showScriptSource("source1.js", step2); | 14 InspectorTest.showScriptSource("source1.js", step2); |
| 15 } | 15 } |
| 16 | 16 |
| 17 function step2(sourceFrame) | 17 function step2(sourceFrame) |
| 18 { | 18 { |
| 19 InspectorTest.addSniffer(Bindings.BreakpointManager.TargetBreakpoint.pro
totype, "_addResolvedLocation", didSetBreakpointInDebugger, true); | 19 InspectorTest.waitBreakpointSidebarPane().then(onBreakpointsReady); |
| 20 | |
| 21 InspectorTest.setBreakpoint(sourceFrame, 14, "", true); | 20 InspectorTest.setBreakpoint(sourceFrame, 14, "", true); |
| 22 InspectorTest.setBreakpoint(sourceFrame, 15, "", true); | 21 InspectorTest.setBreakpoint(sourceFrame, 15, "", true); |
| 23 | 22 |
| 24 var counter = 2; | |
| 25 | |
| 26 function didSetBreakpointInDebugger() | |
| 27 { | |
| 28 counter--; | |
| 29 if (counter) | |
| 30 return; | |
| 31 //Both breakpoints are resolved before reload | |
| 32 InspectorTest.addSniffer(Sources.JavaScriptBreakpointsSidebarPane.pr
ototype, "didReceiveBreakpointLineForTest", onBreakpointsReady); | |
| 33 } | |
| 34 | |
| 35 function onBreakpointsReady() | 23 function onBreakpointsReady() |
| 36 { | 24 { |
| 37 InspectorTest.dumpBreakpointSidebarPane("Breakpoints before reload:"
); | 25 InspectorTest.dumpBreakpointSidebarPane("Breakpoints before reload:"
); |
| 38 waitForBreakpoints(); | 26 InspectorTest.waitBreakpointSidebarPane().then(finishIfReady) |
| 39 InspectorTest.reloadPage(onPageReloaded); | 27 InspectorTest.reloadPage(); |
| 40 } | 28 } |
| 41 | 29 |
| 42 function waitForBreakpoints() | 30 function finishIfReady() { |
| 43 { | 31 var content = InspectorTest.breakpointsSidebarPaneContent(); |
| 44 var expectedBreakpointLocations = [[14, 0], [16, 4]]; | 32 if (content.indexOf('source1.js') !== -1) { |
| 45 var jsBreakpoints = self.runtime.sharedInstance(Sources.JavaScriptBr
eakpointsSidebarPane); | 33 InspectorTest.addResult("Breakpoints after reload:"); |
| 46 jsBreakpoints.didReceiveBreakpointLineForTest = function(uiSourceCod
e, line, column) | 34 InspectorTest.addResult(content); |
| 47 { | 35 InspectorTest.completeDebuggerTest(); |
| 48 if (Bindings.CompilerScriptMapping.StubProjectID === uiSourceCod
e.project().id()) | 36 } else { |
| 49 return; | 37 InspectorTest.waitBreakpointSidebarPane().then(finishIfReady); |
| 50 if (!uiSourceCode.url().endsWith("source1.js")) | |
| 51 return; | |
| 52 | |
| 53 expectedBreakpointLocations = | |
| 54 expectedBreakpointLocations.filter((location) => (location[0
] != line && location[1] != column)); | |
| 55 if (expectedBreakpointLocations.length) | |
| 56 return; | |
| 57 breakpointSourcesReceived = true; | |
| 58 maybeCompleteTest(); | |
| 59 } | 38 } |
| 60 } | 39 } |
| 61 | |
| 62 } | |
| 63 | |
| 64 var breakpointSourcesReceived = false; | |
| 65 var pageReloaded = false; | |
| 66 | |
| 67 function onPageReloaded() | |
| 68 { | |
| 69 pageReloaded = true; | |
| 70 maybeCompleteTest(); | |
| 71 } | |
| 72 | |
| 73 function maybeCompleteTest() | |
| 74 { | |
| 75 if (!pageReloaded || !breakpointSourcesReceived) | |
| 76 return; | |
| 77 InspectorTest.dumpBreakpointSidebarPane("Breakpoints after reload:"); | |
| 78 InspectorTest.completeDebuggerTest(); | |
| 79 } | 40 } |
| 80 } | 41 } |
| 81 | 42 |
| 82 </script> | 43 </script> |
| 83 </head> | 44 </head> |
| 84 | |
| 85 <body onload="runTest()"> | 45 <body onload="runTest()"> |
| 86 <p> | 46 <p>Tests "reload" from within inspector window while on pause.</p> |
| 87 Tests "reload" from within inspector window while on pause. | |
| 88 </p> | |
| 89 | |
| 90 </body> | 47 </body> |
| 91 </html> | 48 </html> |
| OLD | NEW |