<script src="../../http/tests/inspector/timeline-test.js"></script>
<script>
-function performActions()
+function performActions(callback)
{
var image = new Image();
image.onload = bar;
function bar() {
var image = new Image();
- image.onload = function() { testRunner.evaluateInWebInspector(0, "window.step2()"); }
+ image.onload = function(event) { callback(); } // do not pass event argument to the callback.
image.src = "resources/anotherImage.png";
}
}
function test()
{
- WebInspector.showPanel("timeline");
- WebInspector.panels.timeline._model._collectionEnabled = true;
- InspectorTest.timelinePresentationModel().setGlueRecords(true);
- WebInspector.panels.timeline._model._collectionEnabled = true;
+ WebInspector.TimelinePanel.show();
+ WebInspector.panels.timeline._model._currentTarget = WebInspector.targetManager.mainTarget();
+ InspectorTest.invokeAsyncWithTimeline("performActions", finish);
- TimelineAgent.start(step1);
-
- function step1()
- {
- InspectorTest.evaluateInPage("performActions()");
- }
-
- window.step2 = function()
+ function finish()
{
- TimelineAgent.stop(step3);
- }
-
- function step3()
- {
- function dumpFormattedRecord(record, prefix)
+ function dumpFormattedRecord(presentationRecord, prefix)
{
- prefix = prefix || "";
- // Here and below: pretend coalesced record are just not there, as coalescation is time dependent and, hence, not stable.
- if (!record.coalesced && record.type !== "GCEvent")
- InspectorTest.addResult(prefix + record.type);
- // Ignore stray paint & rendering events for better stability.
- if (record.category.name !== "loading" && record.category.name !== "scripting")
- return;
- if (record._children) {
- var childPrefix = prefix + (record.coalesced ? "" : " ");
- for (var i = 0; i < record._children.length; ++i)
- dumpFormattedRecord(record._children[i], childPrefix);
- }
+ var record = presentationRecord.record();
+ prefix = prefix || "";
+ // Here and below: pretend coalesced record are just not there, as coalescation is time dependent and, hence, not stable.
+ var categoryName = WebInspector.panels.timeline._uiUtils.categoryForRecord(record).name;
+ if (categoryName !== "loading" && categoryName !== "scripting")
+ return;
+ if (!presentationRecord.coalesced() && record.type() !== "GCEvent")
+ InspectorTest.addResult(prefix + record.type());
+ // Ignore stray paint & rendering events for better stability.
+ if (presentationRecord.presentationChildren()) {
+ var childPrefix = prefix + (presentationRecord.coalesced() ? "" : " ");
+ for (var i = 0; i < presentationRecord.presentationChildren().length; ++i)
+ dumpFormattedRecord(presentationRecord.presentationChildren()[i], childPrefix);
+ }
}
- WebInspector.panels.timeline._model._collectionEnabled = false;
-
- var records = WebInspector.panels.timeline._currentView._rootRecord().children;
+ var records = WebInspector.panels.timeline._currentViews[0]._rootRecord().presentationChildren();
for (var i = 0; i < records.length; ++i)
dumpFormattedRecord(records[i]);
InspectorTest.completeTest();