Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / sources / debugger / xhr-breakpoints.html
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/debugger-test.js"></script>
5 <script>
6
7 function sendRequest(url)
8 {
9     var request = new XMLHttpRequest();
10     request.open("GET", url, true);
11     request.send()
12 }
13
14 function test()
15 {
16     var pane = WebInspector.panels.sources.sidebarPanes.xhrBreakpoints;
17     InspectorTest.runDebuggerTestSuite([
18         function testXHRBreakpoint(next)
19         {
20             pane._setBreakpoint("foo", true);
21             InspectorTest.waitUntilPaused(step1);
22             InspectorTest.evaluateInPageWithTimeout("sendRequest('/foo?a=b')");
23
24             function step1(callFrames)
25             {
26                 InspectorTest.captureStackTrace(callFrames);
27                 InspectorTest.resumeExecution(step2);
28             }
29
30             function step2()
31             {
32                 InspectorTest.evaluateInPage("sendRequest('/bar?a=b')", step3);
33             }
34
35             function step3()
36             {
37                 pane._removeBreakpoint("foo");
38                 InspectorTest.evaluateInPage("sendRequest('/foo?a=b')", next);
39             }
40         },
41
42         function testPauseOnAnyXHR(next)
43         {
44             pane._setBreakpoint("", true);
45             InspectorTest.waitUntilPaused(pausedFoo);
46             InspectorTest.evaluateInPageWithTimeout("sendRequest('/foo?a=b')");
47
48             function pausedFoo(callFrames)
49             {
50                 function resumed()
51                 {
52                     InspectorTest.waitUntilPaused(pausedBar);
53                     InspectorTest.evaluateInPage("sendRequest('/bar?a=b')");
54                 }
55                 InspectorTest.resumeExecution(resumed);
56             }
57
58             function pausedBar(callFrames)
59             {
60                 function resumed()
61                 {
62                     pane._removeBreakpoint("");
63                     InspectorTest.evaluateInPage("sendRequest('/baz?a=b')", next);
64                 }
65                 InspectorTest.resumeExecution(resumed);
66             }
67         },
68
69         function testDisableBreakpoint(next)
70         {
71             pane._setBreakpoint("", true);
72             InspectorTest.waitUntilPaused(paused);
73             InspectorTest.evaluateInPage("sendRequest('/foo')");
74
75             function paused(callFrames)
76             {
77                 function resumed()
78                 {
79                     pane._breakpointElements[""]._checkboxElement.click();
80                     InspectorTest.waitUntilPaused(pausedAgain);
81                     InspectorTest.evaluateInPage("sendRequest('/foo')", next);
82                 }
83                 InspectorTest.resumeExecution(resumed);
84             }
85
86             function pausedAgain(callFrames)
87             {
88                 InspectorTest.addResult("Fail, paused again after breakpoint was removed.");
89                 next();
90             }
91         }
92     ]);
93 }
94
95 </script>
96 </head>
97
98 <body onload="runTest()">
99 <p>
100 Tests XHR breakpoints.
101 </p>
102
103 </body>
104 </html>