Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger-frameworks / frameworks-dom-xhr-event-breakpoints.html
blob704455cc2893fba3af74ec61c73900d15bff8b7a
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="../debugger/resources/framework.js"></script>
7 <script>
9 function appendElement(parentId, childId)
11 var child = document.createElement("div");
12 child.id = childId;
13 var parent = document.getElementById(parentId);
14 Framework.appendChild(parent, child);
17 function sendXHR(url)
19 Framework.sendXHR(url);
22 function addListenerAndClick(stop)
24 function testElementClicked()
26 return 0;
29 var button = document.getElementById("test");
30 var remover = Framework.addEventListener(button, "click", Framework.bind(Framework.empty, null), true); // Should be ignored.
31 if (stop)
32 debugger;
33 button.click();
34 remover();
36 remover = Framework.addEventListener(button, "click", Framework.bind(testElementClicked, null), true);
37 button.click();
38 remover();
40 // Test both handlers together.
41 var remover1 = Framework.addEventListener(button, "click", Framework.bind(Framework.empty, null), true); // Should be ignored.
42 var remover2 = Framework.addEventListener(button, "click", Framework.bind(testElementClicked, null), true);
43 button.click();
44 remover1();
45 remover2();
48 function addFewBlackboxedListenersAndClick(addNonBlackboxedListener)
50 function testElementClicked()
52 return 0;
54 function inner()
56 var button = document.getElementById("test");
57 var remover1 = Framework.addEventListener(button, "click", Framework.empty, true);
58 var remover2 = Framework.addEventListener(button, "click", Framework.bind(Framework.throwFrameworkException, null, "EXPECTED"), true);
59 var remover3 = Framework.addEventListener(button, "click", Framework.bind(Framework.safeRun, null, Framework.empty, Framework.empty, Framework.empty), true);
60 var remover4 = function() {};
61 if (addNonBlackboxedListener)
62 remover4 = Framework.addEventListener(button, "click", Framework.bind(Framework.safeRun, null, Framework.empty, testElementClicked, Framework.empty), true);
63 debugger;
64 button.click();
65 remover1();
66 remover2();
67 remover3();
68 remover4();
70 var result = inner();
71 return result;
74 function test()
76 var frameworkRegexString = "/framework\\.js$";
77 WebInspector.settingForTest("skipStackFramesPattern").set(frameworkRegexString);
79 InspectorTest.setQuiet(true);
81 InspectorTest.runDebuggerTestSuite([
82 function testDOMBreakpoint(next)
84 InspectorTest.nodeWithId("rootElement", step1);
86 function step1(node)
88 var pane = WebInspector.domBreakpointsSidebarPane;
89 pane._setBreakpoint(node, pane._breakpointTypes.SubtreeModified, true);
90 InspectorTest.evaluateInPageWithTimeout("appendElement('rootElement', 'childElement')");
91 InspectorTest.waitUntilPausedAndDumpStackAndResume(next);
95 function testXHRBreakpoint(next)
97 var pane = WebInspector.panels.sources.sidebarPanes.xhrBreakpoints;
98 pane._setBreakpoint("foo", true);
99 InspectorTest.evaluateInPageWithTimeout("sendXHR('/foo?a=b')");
100 InspectorTest.waitUntilPausedAndDumpStackAndResume(next);
103 function testEventListenerBreakpoint(next)
105 var pane = WebInspector.panels.sources.sidebarPanes.eventListenerBreakpoints;
106 pane._setBreakpoint("listener:click");
107 InspectorTest.evaluateInPageWithTimeout("addListenerAndClick(false)");
108 InspectorTest.waitUntilPausedAndPerformSteppingActions([
109 "Print", "Resume",
110 "Print", "Resume",
111 ], next);
114 function testSteppingThroughEventListenerBreakpoint(next)
116 var pane = WebInspector.panels.sources.sidebarPanes.eventListenerBreakpoints;
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 testElementClicked()
123 "StepOut", "StepOver", "StepOver", "StepOver", "StepOver", "Print", // enter testElementClicked()
124 "StepOver", "StepOver", "Print",
125 "Resume",
126 ], next);
129 function testSteppingOutOnEventListenerBreakpoint(next)
131 var pane = WebInspector.panels.sources.sidebarPanes.eventListenerBreakpoints;
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);
142 function testSteppingOutOnEventListenerBreakpointAllBlackboxed(next)
144 var pane = WebInspector.panels.sources.sidebarPanes.eventListenerBreakpoints;
145 pane._setBreakpoint("listener:click");
146 InspectorTest.evaluateInPageWithTimeout("addFewBlackboxedListenersAndClick(false)");
147 InspectorTest.waitUntilPausedAndPerformSteppingActions([
148 "StepOut", "Print",
149 "Resume",
150 ], next);
153 function testSteppingOutOnEventListenerBreakpointAllBlackboxedButOne(next)
155 var pane = WebInspector.panels.sources.sidebarPanes.eventListenerBreakpoints;
156 pane._setBreakpoint("listener:click");
157 InspectorTest.evaluateInPageWithTimeout("addFewBlackboxedListenersAndClick(true)");
158 InspectorTest.waitUntilPausedAndPerformSteppingActions([
159 "StepOut", "Print",
160 "StepOut", "Print",
161 "StepOut", "Print",
162 "Resume",
163 ], next);
166 function tearDown(next)
168 WebInspector.panels.sources.sidebarPanes.xhrBreakpoints._removeBreakpoint("foo");
169 WebInspector.panels.sources.sidebarPanes.eventListenerBreakpoints._removeBreakpoint("listener:click");
170 next();
175 </script>
176 </head>
178 <body onload="runTest()">
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>