Web Inspector: sometimes ReceiveResponse event is attached to wrong parent.
[WebKit-https.git] / LayoutTests / inspector / timeline / timeline-receive-response-event.html
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="timeline-test.js"></script>
5 <script>
6
7 function performActions()
8 {
9     var image = new Image();
10     image.onload = bar;
11     image.src = "resources/anImage.png";
12
13     function bar() {
14         var image = new Image();
15         image.onload = function() { layoutTestController.evaluateInWebInspector(0, "window.step2()"); }
16         image.src = "resources/anotherImage.png";
17     }
18 }
19
20 function test()
21 {
22     WebInspector.showPanel("timeline");
23     WebInspector.panels.timeline.toggleTimelineButton.toggled = true;
24     TimelineAgent.start(step1);
25
26     function step1()
27     {
28         InspectorTest.evaluateInPage("performActions()");
29     }
30
31     window.step2 = function()
32     {
33         TimelineAgent.stop(step3);
34     }
35
36     function step3()
37     {
38         function dumpFormattedRecord(record, prefix)
39         {
40              prefix = prefix || "";
41              InspectorTest.addResult(prefix + record.type);
42              if (record._children) {
43                  var childPrefix = prefix + "    ";
44                  for (var i = 0; i < record._children.length; ++i)
45                      dumpFormattedRecord(record._children[i], childPrefix);
46              }
47         }
48         WebInspector.panels.timeline.toggleTimelineButton.toggled = false;
49
50         var records = WebInspector.panels.timeline._rootRecord.children;
51         for (var i = 0; i < records.length; ++i)
52             dumpFormattedRecord(records[i]);
53         InspectorTest.completeTest();
54     }
55 }
56
57 if (!window.layoutTestController)
58     setTimeout(performActions, 3000);
59
60 </script>
61 </head>
62
63 <body onload="runTest()">
64 <p>
65 Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc.
66 </p>
67
68 </body>
69 </html>