Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / 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="../../http/tests/inspector/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() { testRunner.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._model._collectionEnabled = true;
24     InspectorTest.timelinePresentationModel().setGlueRecords(true);
25     WebInspector.panels.timeline._model._collectionEnabled = true;
26
27     TimelineAgent.start(step1);
28
29     function step1()
30     {
31         InspectorTest.evaluateInPage("performActions()");
32     }
33
34     window.step2 = function()
35     {
36         TimelineAgent.stop(step3);
37     }
38
39     function step3()
40     {
41         function dumpFormattedRecord(record, prefix)
42         {
43              prefix = prefix || "";
44              // Here and below: pretend coalesced record are just not there, as coalescation is time dependent and, hence, not stable.
45              if (!record.coalesced && record.type !== "GCEvent")
46                  InspectorTest.addResult(prefix + record.type);
47              // Ignore stray paint & rendering events for better stability.
48              if (record.category.name !== "loading" && record.category.name !== "scripting")
49                  return;
50              if (record._children) {
51                  var childPrefix = prefix + (record.coalesced ? "" : "    ");
52                  for (var i = 0; i < record._children.length; ++i)
53                      dumpFormattedRecord(record._children[i], childPrefix);
54              }
55         }
56         WebInspector.panels.timeline._model._collectionEnabled = false;
57
58         var records = WebInspector.panels.timeline._currentViews[0]._rootRecord().children;
59         for (var i = 0; i < records.length; ++i)
60             dumpFormattedRecord(records[i]);
61         InspectorTest.completeTest();
62     }
63 }
64
65 if (!window.testRunner)
66     setTimeout(performActions, 3000);
67
68 </script>
69 </head>
70
71 <body onload="runTest()">
72 <p>
73 Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc.
74 </p>
75
76 </body>
77 </html>