Upstream version 9.38.198.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(callback)
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(event) { callback(); }  // do not pass event argument to the callback.
16         image.src = "resources/anotherImage.png";
17     }
18 }
19
20 function test()
21 {
22     WebInspector.inspectorView.showPanel("timeline");
23     WebInspector.inspectorView.panel("timeline")._model._currentTarget = WebInspector.targetManager.mainTarget();
24     InspectorTest.invokeAsyncWithTimeline("performActions", finish);
25
26     function finish()
27     {
28         function dumpFormattedRecord(presentationRecord, prefix)
29         {
30             var record = presentationRecord.record();
31             prefix = prefix || "";
32             // Here and below: pretend coalesced record are just not there, as coalescation is time dependent and, hence, not stable.
33             var categoryName = WebInspector.panels.timeline._uiUtils.categoryForRecord(record).name;
34             if (categoryName !== "loading" && categoryName !== "scripting")
35                 return;
36             if (!presentationRecord.coalesced() && record.type() !== "GCEvent")
37                 InspectorTest.addResult(prefix + record.type());
38             // Ignore stray paint & rendering events for better stability.
39             if (presentationRecord.presentationChildren()) {
40                 var childPrefix = prefix + (presentationRecord.coalesced() ? "" : "    ");
41                 for (var i = 0; i < presentationRecord.presentationChildren().length; ++i)
42                     dumpFormattedRecord(presentationRecord.presentationChildren()[i], childPrefix);
43             }
44         }
45         var records = WebInspector.panels.timeline._currentViews[0]._rootRecord().presentationChildren();
46         for (var i = 0; i < records.length; ++i)
47             dumpFormattedRecord(records[i]);
48         InspectorTest.completeTest();
49     }
50 }
51
52 if (!window.testRunner)
53     setTimeout(performActions, 3000);
54
55 </script>
56 </head>
57
58 <body onload="runTest()">
59 <p>
60 Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc.
61 </p>
62
63 </body>
64 </html>