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";
15 var image
= new Image();
16 image
.onload = function(event
) { callback(); } // do not pass event argument to the callback.
17 image
.src
= "resources/anotherImage.png";
23 WebInspector
.TimelinePanel
.show();
24 WebInspector
.panels
.timeline
._model
._currentTarget
= WebInspector
.targetManager
.mainTarget();
25 InspectorTest
.invokeAsyncWithTimeline("performActions", finish
);
29 function dumpFormattedRecord(presentationRecord
, prefix
)
31 var record
= presentationRecord
.record();
32 prefix
= prefix
|| "";
33 // Ignore stray paint & rendering events for better stability.
34 var categoryName
= WebInspector
.TimelineUIUtils
.categoryForRecord(record
).name
;
35 if (categoryName
!== "loading" && categoryName
!== "scripting")
37 var childPrefix
= prefix
;
38 // Here and below: pretend coalesced record are just not there, as coalescation is time dependent and, hence, not stable.
39 // Filter out InjectedScript function call because they happen out of sync.
40 if (!presentationRecord
.coalesced()
41 && record
.type() !== "GCEvent"
42 && (record
.type() !== "FunctionCall" || record
.traceEvent().args
["data"].scriptName
)) {
43 InspectorTest
.addResult(prefix
+ record
.type());
44 childPrefix
= childPrefix
+ " ";
46 if (presentationRecord
.presentationChildren()) {
47 for (var i
= 0; i
< presentationRecord
.presentationChildren().length
; ++i
)
48 dumpFormattedRecord(presentationRecord
.presentationChildren()[i
], childPrefix
);
51 var records
= InspectorTest
.timelinePresentationModel().rootRecord().presentationChildren();
52 for (var i
= 0; i
< records
.length
; ++i
)
53 dumpFormattedRecord(records
[i
]);
54 InspectorTest
.completeTest();
58 if (!window
.testRunner
)
59 setTimeout(performActions
, 3000);
64 <body onload=
"runTest()">
66 Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc.