| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script src="../../../http/tests/inspector/elements-test.js"></script> | |
| 5 <script src="../../../http/tests/inspector/debugger-test.js"></script> | |
| 6 <script src="resources/framework.js"></script> | |
| 7 <script> | |
| 8 | |
| 9 function appendElement(parentId, childId) | |
| 10 { | |
| 11 var child = document.createElement("div"); | |
| 12 child.id = childId; | |
| 13 var parent = document.getElementById(parentId); | |
| 14 Framework.appendChild(parent, child); | |
| 15 } | |
| 16 | |
| 17 function sendXHR(url) | |
| 18 { | |
| 19 Framework.sendXHR(url); | |
| 20 } | |
| 21 | |
| 22 function addListenerAndClick(stop) | |
| 23 { | |
| 24 function testElementClicked() | |
| 25 { | |
| 26 return 0; | |
| 27 } | |
| 28 | |
| 29 var button = document.getElementById("test"); | |
| 30 var remover = Framework.addEventListener(button, "click", Framework.bind(Fra
mework.empty, null), true); // Should be ignored. | |
| 31 if (stop) | |
| 32 debugger; | |
| 33 button.click(); | |
| 34 remover(); | |
| 35 | |
| 36 remover = Framework.addEventListener(button, "click", Framework.bind(testEle
mentClicked, null), true); | |
| 37 button.click(); | |
| 38 remover(); | |
| 39 | |
| 40 // Test both handlers together. | |
| 41 var remover1 = Framework.addEventListener(button, "click", Framework.bind(Fr
amework.empty, null), true); // Should be ignored. | |
| 42 var remover2 = Framework.addEventListener(button, "click", Framework.bind(te
stElementClicked, null), true); | |
| 43 button.click(); | |
| 44 remover1(); | |
| 45 remover2(); | |
| 46 } | |
| 47 | |
| 48 function addFewBlackboxedListenersAndClick(addNonBlackboxedListener) | |
| 49 { | |
| 50 function testElementClicked() | |
| 51 { | |
| 52 return 0; | |
| 53 } | |
| 54 function inner() | |
| 55 { | |
| 56 var button = document.getElementById("test"); | |
| 57 var remover1 = Framework.addEventListener(button, "click", Framework.emp
ty, true); | |
| 58 var remover2 = Framework.addEventListener(button, "click", Framework.bin
d(Framework.throwFrameworkException, null, "EXPECTED"), true); | |
| 59 var remover3 = Framework.addEventListener(button, "click", Framework.bin
d(Framework.safeRun, null, Framework.empty, Framework.empty, Framework.empty), t
rue); | |
| 60 var remover4 = function() {}; | |
| 61 if (addNonBlackboxedListener) | |
| 62 remover4 = Framework.addEventListener(button, "click", Framework.bin
d(Framework.safeRun, null, Framework.empty, testElementClicked, Framework.empty)
, true); | |
| 63 debugger; | |
| 64 button.click(); | |
| 65 remover1(); | |
| 66 remover2(); | |
| 67 remover3(); | |
| 68 remover4(); | |
| 69 } | |
| 70 var result = inner(); | |
| 71 return result; | |
| 72 } | |
| 73 | |
| 74 function test() | |
| 75 { | |
| 76 var frameworkRegexString = "/framework\\.js$"; | |
| 77 WebInspector.settingForTest("skipStackFramesPattern").set(frameworkRegexStri
ng); | |
| 78 | |
| 79 InspectorTest.setQuiet(true); | |
| 80 | |
| 81 InspectorTest.runDebuggerTestSuite([ | |
| 82 function testDOMBreakpoint(next) | |
| 83 { | |
| 84 InspectorTest.nodeWithId("rootElement", step1); | |
| 85 | |
| 86 function step1(node) | |
| 87 { | |
| 88 var pane = WebInspector.domBreakpointsSidebarPane; | |
| 89 pane._setBreakpoint(node, pane._breakpointTypes.SubtreeModified,
true); | |
| 90 InspectorTest.evaluateInPageWithTimeout("appendElement('rootElem
ent', 'childElement')"); | |
| 91 InspectorTest.waitUntilPausedAndDumpStackAndResume(next); | |
| 92 } | |
| 93 }, | |
| 94 | |
| 95 function testXHRBreakpoint(next) | |
| 96 { | |
| 97 var pane = WebInspector.panels.sources.sidebarPanes.xhrBreakpoints; | |
| 98 pane._setBreakpoint("foo", true); | |
| 99 InspectorTest.evaluateInPageWithTimeout("sendXHR('/foo?a=b')"); | |
| 100 InspectorTest.waitUntilPausedAndDumpStackAndResume(next); | |
| 101 }, | |
| 102 | |
| 103 function testEventListenerBreakpoint(next) | |
| 104 { | |
| 105 var pane = WebInspector.panels.sources.sidebarPanes.eventListenerBre
akpoints; | |
| 106 pane._setBreakpoint("listener:click"); | |
| 107 InspectorTest.evaluateInPageWithTimeout("addListenerAndClick(false)"
); | |
| 108 InspectorTest.waitUntilPausedAndPerformSteppingActions([ | |
| 109 "Print", "Resume", | |
| 110 "Print", "Resume", | |
| 111 ], next); | |
| 112 }, | |
| 113 | |
| 114 function testSteppingThroughEventListenerBreakpoint(next) | |
| 115 { | |
| 116 var pane = WebInspector.panels.sources.sidebarPanes.eventListenerBre
akpoints; | |
| 117 pane._setBreakpoint("listener:click"); | |
| 118 InspectorTest.evaluateInPageWithTimeout("addListenerAndClick(true)")
; | |
| 119 InspectorTest.waitUntilPausedAndPerformSteppingActions([ | |
| 120 "StepOver", "Print", | |
| 121 "StepOver", "Print", // should break at the first "remover()" | |
| 122 "StepOver", "StepOver", "StepOver", "Print", // enter testElemen
tClicked() | |
| 123 "StepOut", "StepOver", "StepOver", "StepOver", "StepOver", "Prin
t", // enter testElementClicked() | |
| 124 "StepOver", "StepOver", "Print", | |
| 125 "Resume", | |
| 126 ], next); | |
| 127 }, | |
| 128 | |
| 129 function testSteppingOutOnEventListenerBreakpoint(next) | |
| 130 { | |
| 131 var pane = WebInspector.panels.sources.sidebarPanes.eventListenerBre
akpoints; | |
| 132 pane._setBreakpoint("listener:click"); | |
| 133 InspectorTest.evaluateInPageWithTimeout("addListenerAndClick(true)")
; | |
| 134 InspectorTest.waitUntilPausedAndPerformSteppingActions([ | |
| 135 "StepOut", "Print", // should be in testElementClicked() | |
| 136 "StepOut", "StepOut", "Print", // again in testElementClicked() | |
| 137 "StepOut", "Print", | |
| 138 "Resume", | |
| 139 ], next); | |
| 140 }, | |
| 141 | |
| 142 function testSteppingOutOnEventListenerBreakpointAllBlackboxed(next) | |
| 143 { | |
| 144 var pane = WebInspector.panels.sources.sidebarPanes.eventListenerBre
akpoints; | |
| 145 pane._setBreakpoint("listener:click"); | |
| 146 InspectorTest.evaluateInPageWithTimeout("addFewBlackboxedListenersAn
dClick(false)"); | |
| 147 InspectorTest.waitUntilPausedAndPerformSteppingActions([ | |
| 148 "StepOut", "Print", | |
| 149 "Resume", | |
| 150 ], next); | |
| 151 }, | |
| 152 | |
| 153 function testSteppingOutOnEventListenerBreakpointAllBlackboxedButOne(nex
t) | |
| 154 { | |
| 155 var pane = WebInspector.panels.sources.sidebarPanes.eventListenerBre
akpoints; | |
| 156 pane._setBreakpoint("listener:click"); | |
| 157 InspectorTest.evaluateInPageWithTimeout("addFewBlackboxedListenersAn
dClick(true)"); | |
| 158 InspectorTest.waitUntilPausedAndPerformSteppingActions([ | |
| 159 "StepOut", "Print", | |
| 160 "StepOut", "Print", | |
| 161 "StepOut", "Print", | |
| 162 "Resume", | |
| 163 ], next); | |
| 164 }, | |
| 165 | |
| 166 function tearDown(next) | |
| 167 { | |
| 168 WebInspector.panels.sources.sidebarPanes.xhrBreakpoints._removeBreak
point("foo"); | |
| 169 WebInspector.panels.sources.sidebarPanes.eventListenerBreakpoints._r
emoveBreakpoint("listener:click"); | |
| 170 next(); | |
| 171 } | |
| 172 ]); | |
| 173 } | |
| 174 | |
| 175 </script> | |
| 176 </head> | |
| 177 | |
| 178 <body onload="runTest()"> | |
| 179 <p> | |
| 180 Tests framework black-boxing on DOM, XHR and Event breakpoints. | |
| 181 </p> | |
| 182 <div id="rootElement"></div> | |
| 183 <input type=button id="test"></input> | |
| 184 </body> | |
| 185 </html> | |
| OLD | NEW |