Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / inspector / timeline-test.js
index c1ee5f0..a8c5796 100644 (file)
@@ -9,6 +9,7 @@ InspectorTest.timelinePropertyFormatters = {
     stackTrace: "formatAsTypeName",
     url: "formatAsURL",
     scriptName: "formatAsTypeName",
+    scriptId: "formatAsTypeName",
     usedHeapSizeDelta: "skip",
     mimeType: "formatAsTypeName",
     id: "formatAsTypeName",
@@ -17,14 +18,13 @@ InspectorTest.timelinePropertyFormatters = {
     scriptLine: "formatAsTypeName",
     layerId: "formatAsTypeName",
     lineNumber: "formatAsTypeName",
+    columnNumber: "formatAsTypeName",
     frameId: "formatAsTypeName",
     encodedDataLength: "formatAsTypeName",
     identifier: "formatAsTypeName",
     clip: "formatAsTypeName",
     root: "formatAsTypeName",
-    rootNode: "formatAsTypeName",
-    layerRootNode: "formatAsTypeName",
-    elementId: "formatAsTypeName",
+    backendNodeId: "formatAsTypeName",
     networkTime: "formatAsTypeName",
     thread: "formatAsTypeName"
 };
@@ -105,6 +105,20 @@ InspectorTest.evaluateWithTimeline = function(actions, doneCallback)
     }
 }
 
+InspectorTest.invokeAsyncWithTimeline = function(functionName, doneCallback)
+{
+    InspectorTest.startTimeline(step1);
+    function step1()
+    {
+        InspectorTest.invokePageFunctionAsync(functionName, step2);
+    }
+
+    function step2()
+    {
+       InspectorTest.stopTimeline(doneCallback);
+    }
+}
+
 InspectorTest.loadTimelineRecords = function(records)
 {
     var model = WebInspector.inspectorView.showPanel("timeline")._model;
@@ -123,7 +137,7 @@ InspectorTest.performActionsAndPrint = function(actions, typeName, includeTimeSt
         }
         InspectorTest.completeTest();
     }
-    InspectorTest.evaluateWithTimeline(actions, callback)
+    InspectorTest.evaluateWithTimeline(actions, callback);
 };
 
 InspectorTest.printTimelineRecords = function(typeName, formatter)
@@ -131,6 +145,11 @@ InspectorTest.printTimelineRecords = function(typeName, formatter)
     InspectorTest.innerPrintTimelineRecords(InspectorTest._timelineRecords, typeName, formatter);
 };
 
+InspectorTest.printTimelinePresentationRecords = function(typeName, formatter)
+{
+    InspectorTest.innerPrintTimelinePresentationRecords(WebInspector.panels.timeline._model.records(), typeName, formatter);
+};
+
 InspectorTest.printTimestampRecords = function(typeName, formatter)
 {
     InspectorTest.innerPrintTimelineRecords(InspectorTest.timelineModel().eventDividerRecords(), typeName, formatter);
@@ -139,10 +158,22 @@ InspectorTest.printTimestampRecords = function(typeName, formatter)
 InspectorTest.innerPrintTimelineRecords = function(records, typeName, formatter)
 {
     for (var i = 0; i < records.length; ++i) {
-        if (typeName && records[i].type === WebInspector.TimelineModel.RecordType[typeName])
+        var recordTypeName = (typeof records[i].type === "string") ? records[i].type : records[i].type();
+        if (typeName && recordTypeName === WebInspector.TimelineModel.RecordType[typeName])
+            InspectorTest.printTimelineRecordProperties(records[i]);
+        if (formatter)
+            formatter(records[i]);
+    }
+};
+
+InspectorTest.innerPrintTimelinePresentationRecords = function(records, typeName, formatter)
+{
+    for (var i = 0; i < records.length; ++i) {
+        if (typeName && records[i].type() === WebInspector.TimelineModel.RecordType[typeName])
             InspectorTest.printTimelineRecordProperties(records[i]);
         if (formatter)
             formatter(records[i]);
+        InspectorTest.innerPrintTimelinePresentationRecords(records[i].children(), typeName, formatter);
     }
 };
 
@@ -187,17 +218,17 @@ InspectorTest.dumpPresentationRecord = function(presentationRecord, detailsCallb
         prefix = prefix + "> ";
     if (presentationRecord.coalesced()) {
         suffix = " x " + presentationRecord.presentationChildren().length;
-    } else if (record.type === WebInspector.TimelineModel.RecordType.TimeStamp
-        || record.type === WebInspector.TimelineModel.RecordType.ConsoleTime) {
-        suffix = " : " + record.data.message;
+    } else if (record.type() === WebInspector.TimelineModel.RecordType.TimeStamp
+        || record.type() === WebInspector.TimelineModel.RecordType.ConsoleTime) {
+        suffix = " : " + record.data().message;
     }
     if (detailsCallback)
         suffix += " " + detailsCallback(record);
-    InspectorTest.addResult(prefix + InspectorTest._timelineAgentTypeToString(record.type) + suffix);
+    InspectorTest.addResult(prefix + InspectorTest._timelineAgentTypeToString(record.type()) + suffix);
 
     var numChildren = presentationRecord.presentationChildren() ? presentationRecord.presentationChildren().length : 0;
     for (var i = 0; i < numChildren; ++i) {
-        if (filterTypes && filterTypes.indexOf(presentationRecord.presentationChildren()[i].record().type) == -1)
+        if (filterTypes && filterTypes.indexOf(presentationRecord.presentationChildren()[i].record().type()) == -1)
             continue;
         InspectorTest.dumpPresentationRecord(presentationRecord.presentationChildren()[i], detailsCallback, level + 1, filterTypes);
     }
@@ -211,9 +242,10 @@ InspectorTest.dumpTimelineRecords = function(timelineRecords)
 
 InspectorTest.printTimelineRecordProperties = function(record)
 {
-    InspectorTest.addResult(InspectorTest._timelineAgentTypeToString(record.type) + " Properties:");
+    var recordType = (typeof record.type === "string") ? record.type : record.type();
+    InspectorTest.addResult(InspectorTest._timelineAgentTypeToString(recordType) + " Properties:");
     // Use this recursive routine to print the properties
-    if (record instanceof WebInspector.TimelineModel.Record)
+    if (record instanceof WebInspector.TimelineModel.RecordImpl)
         record = record._record;
     InspectorTest.addObject(record, InspectorTest.timelinePropertyFormatters);
 };
@@ -232,7 +264,7 @@ InspectorTest.findPresentationRecord = function(type)
     var result;
     function findByType(record)
     {
-        if (record.type !== type)
+        if (record.type() !== type)
             return false;
         result = record;
         return true;