3 <script src=
"inspector-test.js"></script>
4 <script src=
"timeline-test.js"></script>
7 var scriptUrl
= "timeline-network-resource.js";
9 function runAfterScriptIsEvaluated(continuation
)
13 if (!window
.scriptEvaluated
)
14 setTimeout(step
, 100);
18 setTimeout(step
, 100);
21 function printRecord(record
)
24 printTimelineRecordProperties(record
);
27 function printSend(record
)
30 window
.resourceId
= record
.data
.identifier
;
31 if (record
.data
.url
=== undefined)
32 output("* No 'url' property in record");
33 else if (record
.data
.url
.indexOf(scriptUrl
) === -1)
34 output("* Didn't find URL: " + scriptUrl
);
37 function printReceive(record
)
40 if (window
.resourceId
!== record
.data
.identifier
)
41 output("Didn't find matching resourceId: " + window
.resourceId
);
42 if (record
.data
.statusCode
!== 0)
43 output("Response received status: " + record
.data
.statusCode
);
46 function printFinish(record
)
49 if (window
.resourceId
!== record
.data
.identifier
)
50 output("Didn't find matching resourceId: " + window
.resourceId
);
51 if (record
.data
.didFail
)
52 output("Request failed.");
57 if (window
.layoutTestController
)
58 layoutTestController
.setTimelineProfilingEnabled(true);
60 var script
= document
.createElement("script");
61 script
.src
= scriptUrl
;
62 document
.body
.appendChild(script
);
63 runAfterScriptIsEvaluated(function() {
64 printTimelineRecords(null, null, function(record
) {
65 if (record
.type
=== timelineAgentRecordType
["ResourceSendRequest"])
68 else if (record
.type
=== timelineAgentRecordType
["ResourceReceiveResponse"])
70 else if (record
.type
=== timelineAgentRecordType
["ResourceFinish"])
79 <body onload=
"onload()">
81 Tests the Timeline API instrumentation of a network resource load