3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/timeline-test.js"></script>
7 function performActions()
9 var image = new Image();
11 image.src = "resources/anImage.png";
14 var image = new Image();
15 image.onload = function() { testRunner.evaluateInWebInspector(0, "window.step2()"); }
16 image.src = "resources/anotherImage.png";
22 WebInspector.inspectorView.showPanel("timeline");
23 WebInspector.panels.timeline._model._collectionEnabled = true;
25 TimelineAgent.start(step1);
29 InspectorTest.evaluateInPage("performActions()");
32 window.step2 = function()
34 TimelineAgent.stop(step3);
39 function dumpFormattedRecord(presentationRecord, prefix)
41 var record = presentationRecord.record();
42 prefix = prefix || "";
43 // Here and below: pretend coalesced record are just not there, as coalescation is time dependent and, hence, not stable.
44 if (!presentationRecord.coalesced() && record.type() !== "GCEvent")
45 InspectorTest.addResult(prefix + record.type());
46 // Ignore stray paint & rendering events for better stability.
47 if (record.category().name !== "loading" && record.category().name !== "scripting")
49 if (presentationRecord.presentationChildren()) {
50 var childPrefix = prefix + (presentationRecord.coalesced() ? "" : " ");
51 for (var i = 0; i < presentationRecord.presentationChildren().length; ++i)
52 dumpFormattedRecord(presentationRecord.presentationChildren()[i], childPrefix);
55 WebInspector.panels.timeline._model._collectionEnabled = false;
57 var records = WebInspector.panels.timeline._currentViews[0]._rootRecord().presentationChildren();
58 for (var i = 0; i < records.length; ++i)
59 dumpFormattedRecord(records[i]);
60 InspectorTest.completeTest();
64 if (!window.testRunner)
65 setTimeout(performActions, 3000);
70 <body onload="runTest()">
72 Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc.