Commit e49aedca authored by yurys@chromium.org's avatar yurys@chromium.org

Do not use raw protocol types in inspector/timeline/timeline-network-resource.html

In preparation to switching to tracing backend the test is changed to use higher level abstractions.

BUG=398785
R=pfeldman@chromium.org

Review URL: https://codereview.chromium.org/480013002

git-svn-id: svn://svn.chromium.org/blink/trunk@180451 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 9c614e9c
......@@ -169,7 +169,7 @@ InspectorTest.dumpTimelineRecord = function(record, detailsCallback, level, filt
}
if (detailsCallback)
suffix += " " + detailsCallback(record);
InspectorTest.addResult(prefix + InspectorTest._timelineAgentTypeToString(record.type()) + suffix);
InspectorTest.addResult(prefix + record.type() + suffix);
var children = record.children();
var numChildren = children.length;
......@@ -216,7 +216,7 @@ InspectorTest.dumpPresentationRecord = function(presentationRecord, detailsCallb
}
if (detailsCallback)
suffix += " " + detailsCallback(presentationRecord);
var typeString = record ? InspectorTest._timelineAgentTypeToString(record.type()) : "Root";
var typeString = record ? record.type() : "Root";
InspectorTest.addResult(prefix + typeString + suffix);
var numChildren = presentationRecord.presentationChildren() ? presentationRecord.presentationChildren().length : 0;
......@@ -235,23 +235,13 @@ InspectorTest.dumpTimelineRecords = function(timelineRecords)
InspectorTest.printTimelineRecordProperties = function(record)
{
var recordType = (typeof record.type === "string") ? record.type : record.type();
InspectorTest.addResult(InspectorTest._timelineAgentTypeToString(recordType) + " Properties:");
InspectorTest.addResult(record.type() + " Properties:");
// Use this recursive routine to print the properties
if (record instanceof WebInspector.TimelineModel.RecordImpl)
record = record._record;
InspectorTest.addObject(record, InspectorTest.timelinePropertyFormatters);
};
InspectorTest._timelineAgentTypeToString = function(numericType)
{
for (var prop in WebInspector.TimelineModel.RecordType) {
if (WebInspector.TimelineModel.RecordType[prop] === numericType)
return prop;
}
return undefined;
};
InspectorTest.findFirstTimelineRecord = function(type)
{
var result;
......
......@@ -30,16 +30,20 @@ function test()
function format(record)
{
if (record.type() === WebInspector.TimelineModel.RecordType.ResourceSendRequest)
printSend(record._record);
printSend(record);
else if (record.type() === WebInspector.TimelineModel.RecordType.ResourceReceiveResponse)
printReceive(record._record);
printReceive(record);
else if (record.type() === WebInspector.TimelineModel.RecordType.ResourceFinish)
printFinish(record._record);
printFinish(record);
if (record.parent && record.parent.type() === WebInspector.TimelineModel.RecordType.Root) {
if (lastRecordStartTime)
InspectorTest.assertGreaterOrEqual(record.startTime(), lastRecordStartTime, "Top level records order violation");
lastRecordStartTime = record.startTime();
var presentationRecord = presentationModel.toPresentationRecord(record);
if (presentationRecord && record.thread() === WebInspector.TimelineModel.MainThreadName) {
var parentIsRoot = presentationRecord.presentationParent() && !presentationRecord.presentationParent().presentationParent();
if (parentIsRoot) {
if (lastRecordStartTime)
InspectorTest.assertGreaterOrEqual(record.startTime(), lastRecordStartTime, "Top level records order violation");
lastRecordStartTime = record.startTime();
}
}
}
model.forAllRecords(format);
......@@ -55,28 +59,28 @@ function test()
function printSend(record)
{
printRecord(record);
requestId = record.data.requestId;
if (record.data.url === undefined)
requestId = record.data().requestId;
if (record.data().url === undefined)
InspectorTest.addResult("* No 'url' property in record");
else if (record.data.url.indexOf(scriptUrl) === -1)
else if (record.data().url.indexOf(scriptUrl) === -1)
InspectorTest.addResult("* Didn't find URL: " + scriptUrl);
}
function printReceive(record)
{
printRecord(record);
if (requestId !== record.data.requestId)
if (requestId !== record.data().requestId)
InspectorTest.addResult("Didn't find matching requestId: " + requestId);
if (record.data.statusCode !== 0)
InspectorTest.addResult("Response received status: " + record.data.statusCode);
if (record.data().statusCode !== 0)
InspectorTest.addResult("Response received status: " + record.data().statusCode);
}
function printFinish(record)
{
printRecord(record);
if (requestId !== record.data.requestId)
if (requestId !== record.data().requestId)
InspectorTest.addResult("Didn't find matching requestId: " + requestId);
if (record.data.didFail)
if (record.data().didFail)
InspectorTest.addResult("Request failed.");
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment