| 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() |
| 20 | 20 .then(waitUntilReady) |
| 21 .then(onBreakpointsReady); |
| 21 InspectorTest.setBreakpoint(sourceFrame, 14, "", true); | 22 InspectorTest.setBreakpoint(sourceFrame, 14, "", true); |
| 22 InspectorTest.setBreakpoint(sourceFrame, 15, "", true); | 23 InspectorTest.setBreakpoint(sourceFrame, 15, "", true); |
| 23 | 24 |
| 24 var counter = 2; | 25 function onBreakpointsReady() |
| 25 | |
| 26 function didSetBreakpointInDebugger() | |
| 27 { | 26 { |
| 28 counter--; | 27 InspectorTest.dumpBreakpointSidebarPane("before reload:"); |
| 29 if (counter) | 28 Promise.all([InspectorTest.waitBreakpointSidebarPane().then(waitUnti
lReady), new Promise(resolve => InspectorTest.reloadPage(resolve))]) |
| 30 return; | 29 .then(finishIfReady); |
| 31 //Both breakpoints are resolved before reload | |
| 32 InspectorTest.addSniffer(Sources.JavaScriptBreakpointsSidebarPane.pr
ototype, "didReceiveBreakpointLineForTest", onBreakpointsReady); | |
| 33 } | 30 } |
| 34 | 31 |
| 35 function onBreakpointsReady() | 32 function finishIfReady() { |
| 36 { | 33 InspectorTest.dumpBreakpointSidebarPane("after reload:"); |
| 37 InspectorTest.dumpBreakpointSidebarPane("Breakpoints before reload:"
); | 34 InspectorTest.completeDebuggerTest(); |
| 38 waitForBreakpoints(); | |
| 39 InspectorTest.reloadPage(onPageReloaded); | |
| 40 } | 35 } |
| 41 | |
| 42 function waitForBreakpoints() | |
| 43 { | |
| 44 var expectedBreakpointLocations = [[14, 0], [16, 4]]; | |
| 45 var jsBreakpoints = self.runtime.sharedInstance(Sources.JavaScriptBr
eakpointsSidebarPane); | |
| 46 jsBreakpoints.didReceiveBreakpointLineForTest = function(uiSourceCod
e, line, column) | |
| 47 { | |
| 48 if (Bindings.CompilerScriptMapping.StubProjectID === uiSourceCod
e.project().id()) | |
| 49 return; | |
| 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 } | |
| 60 } | |
| 61 | |
| 62 } | 36 } |
| 63 | 37 |
| 64 var breakpointSourcesReceived = false; | 38 function waitUntilReady() { |
| 65 var pageReloaded = false; | 39 var expectedBreakpointLocations = [[14, 0], [16, 4]]; |
| 66 | 40 var paneElement = self.runtime.sharedInstance(Sources.JavaScriptBreakpoi
ntsSidebarPane).contentElement; |
| 67 function onPageReloaded() | 41 var entries = Array.from(paneElement.querySelectorAll('.breakpoint-entry
')); |
| 68 { | 42 for (var entry of entries) { |
| 69 pageReloaded = true; | 43 var uiLocation = entry[Sources.JavaScriptBreakpointsSidebarPane._loc
ationSymbol]; |
| 70 maybeCompleteTest(); | 44 if (Bindings.CompilerScriptMapping.StubProjectID === uiLocation.uiSo
urceCode.project().id()) |
| 71 } | 45 return InspectorTest.waitBreakpointSidebarPane().then(waitUntilR
eady); |
| 72 | 46 if (!uiLocation.uiSourceCode.url().endsWith("source1.js")) |
| 73 function maybeCompleteTest() | 47 return InspectorTest.waitBreakpointSidebarPane().then(waitUntilR
eady); |
| 74 { | 48 expectedBreakpointLocations = |
| 75 if (!pageReloaded || !breakpointSourcesReceived) | 49 expectedBreakpointLocations.filter((location) => (location[0] !=
uiLocation.lineNumber && location[1] != uiLocation.columnNumber)); |
| 76 return; | 50 } |
| 77 InspectorTest.dumpBreakpointSidebarPane("Breakpoints after reload:"); | 51 if (expectedBreakpointLocations.length) |
| 78 InspectorTest.completeDebuggerTest(); | 52 return InspectorTest.waitBreakpointSidebarPane().then(waitUntilReady
); |
| 53 return Promise.resolve(); |
| 79 } | 54 } |
| 80 } | 55 } |
| 81 | 56 |
| 82 </script> | 57 </script> |
| 83 </head> | 58 </head> |
| 84 | |
| 85 <body onload="runTest()"> | 59 <body onload="runTest()"> |
| 86 <p> | 60 <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> | 61 </body> |
| 91 </html> | 62 </html> |
| OLD | NEW |