3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/timeline-test.js"></script>
7 function performActions(callback)
9 var image = new Image();
11 image.src = "resources/anImage.png";
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";
22 WebInspector.inspectorView.showPanel("timeline");
23 WebInspector.inspectorView.panel("timeline")._model._currentTarget = WebInspector.targetManager.mainTarget();
24 InspectorTest.invokeAsyncWithTimeline("performActions", finish);
28 function dumpFormattedRecord(presentationRecord, prefix)
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")
36 var childPrefix = prefix;
37 // Filter out InjectedScript function call because they happen out of sync.
38 if (!presentationRecord.coalesced()
39 && record.type() !== "GCEvent"
40 && (record.type() !== "FunctionCall" || record.data().scriptName !== "InjectedScript")) {
41 InspectorTest.addResult(prefix + record.type());
42 childPrefix = childPrefix + " ";
44 // Ignore stray paint & rendering events for better stability.
45 if (presentationRecord.presentationChildren()) {
46 for (var i = 0; i < presentationRecord.presentationChildren().length; ++i)
47 dumpFormattedRecord(presentationRecord.presentationChildren()[i], childPrefix);
50 var records = WebInspector.panels.timeline._currentViews[0]._rootRecord().presentationChildren();
51 for (var i = 0; i < records.length; ++i)
52 dumpFormattedRecord(records[i]);
53 InspectorTest.completeTest();
57 if (!window.testRunner)
58 setTimeout(performActions, 3000);
63 <body onload="runTest()">
65 Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc.