| <html> |
| <head> |
| <script src="../../http/tests/inspector/inspector-test.js"></script> |
| <script src="../../http/tests/inspector/debugger-test.js"></script> |
| <script> |
| |
| function sendRequest(url) |
| { |
| var request = new XMLHttpRequest(); |
| request.open("GET", url, true); |
| request.send() |
| } |
| |
| function test() |
| { |
| WebInspector.showPanel("scripts"); |
| var pane = WebInspector.panels.scripts.sidebarPanes.xhrBreakpoints; |
| InspectorTest.runDebuggerTestSuite([ |
| function testXHRBreakpoint(next) |
| { |
| pane._setBreakpoint("foo", true); |
| InspectorTest.waitUntilPaused(step1); |
| InspectorTest.evaluateInPageWithTimeout("sendRequest('/foo?a=b')"); |
| |
| function step1(callFrames) |
| { |
| InspectorTest.captureStackTrace(callFrames); |
| InspectorTest.resumeExecution(step2); |
| } |
| |
| function step2() |
| { |
| InspectorTest.evaluateInPage("sendRequest('/bar?a=b')", step3); |
| } |
| |
| function step3() |
| { |
| pane._removeBreakpoint("foo"); |
| InspectorTest.evaluateInPage("sendRequest('/foo?a=b')", next); |
| } |
| }, |
| |
| function testPauseOnAnyXHR(next) |
| { |
| pane._setBreakpoint("", true); |
| InspectorTest.waitUntilPaused(pausedFoo); |
| InspectorTest.evaluateInPageWithTimeout("sendRequest('/foo?a=b')"); |
| |
| function pausedFoo(callFrames) |
| { |
| function resumed() |
| { |
| InspectorTest.waitUntilPaused(pausedBar); |
| InspectorTest.evaluateInPage("sendRequest('/bar?a=b')"); |
| } |
| InspectorTest.resumeExecution(resumed); |
| } |
| |
| function pausedBar(callFrames) |
| { |
| function resumed() |
| { |
| pane._removeBreakpoint(""); |
| InspectorTest.evaluateInPage("sendRequest('/baz?a=b')", next); |
| } |
| InspectorTest.resumeExecution(resumed); |
| } |
| }, |
| |
| function testDisableBreakpoint(next) |
| { |
| pane._setBreakpoint("", true); |
| InspectorTest.waitUntilPaused(paused); |
| InspectorTest.evaluateInPage("sendRequest('/foo')"); |
| |
| function paused(callFrames) |
| { |
| function resumed() |
| { |
| pane._breakpointElements[""]._checkboxElement.click(); |
| InspectorTest.waitUntilPaused(pausedAgain); |
| InspectorTest.evaluateInPage("sendRequest('/foo')", next); |
| } |
| InspectorTest.resumeExecution(resumed); |
| } |
| |
| function pausedAgain(callFrames) |
| { |
| InspectorTest.addResult("Fail, paused again after breakpoint was removed."); |
| next(); |
| } |
| } |
| ]); |
| } |
| |
| </script> |
| </head> |
| |
| <body onload="runTest()"> |
| <p> |
| Tests XHR breakpoints. |
| </p> |
| |
| </body> |
| </html> |