| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../http/tests/inspector/timeline-test.js"></script> | 4 <script src="../../../http/tests/inspector/timeline-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 var scriptUrl = "timeline-network-resource.js"; | 7 var scriptUrl = "timeline-network-resource.js"; |
| 8 | 8 |
| 9 function performActions() | 9 function performActions() |
| 10 { | 10 { |
| 11 var promise = new Promise((fulfill) => window.timelineNetworkResourceEvaluat
ed = fulfill); | 11 var promise = new Promise((fulfill) => window.timelineNetworkResourceEvaluat
ed = fulfill); |
| 12 var script = document.createElement("script"); | 12 var script = document.createElement("script"); |
| 13 script.src = scriptUrl; | 13 script.src = scriptUrl; |
| 14 document.body.appendChild(script); | 14 document.body.appendChild(script); |
| 15 return promise; | 15 return promise; |
| 16 } | 16 } |
| 17 | 17 |
| 18 function test() | 18 function test() |
| 19 { | 19 { |
| 20 var requestId; | 20 var requestId; |
| 21 var scriptUrl = "timeline-network-resource.js"; | 21 var scriptUrl = "timeline-network-resource.js"; |
| 22 | 22 |
| 23 var model = WebInspector.panels.timeline._model; | 23 var model = UI.panels.timeline._model; |
| 24 | 24 |
| 25 InspectorTest.invokeAsyncWithTimeline("performActions", finish); | 25 InspectorTest.invokeAsyncWithTimeline("performActions", finish); |
| 26 | 26 |
| 27 function finish() | 27 function finish() |
| 28 { | 28 { |
| 29 var lastRecordStartTime; | 29 var lastRecordStartTime; |
| 30 function format(record) | 30 function format(record) |
| 31 { | 31 { |
| 32 if (record.type() === WebInspector.TimelineModel.RecordType.Resource
SendRequest) | 32 if (record.type() === TimelineModel.TimelineModel.RecordType.Resourc
eSendRequest) |
| 33 printSend(record); | 33 printSend(record); |
| 34 else if (record.type() === WebInspector.TimelineModel.RecordType.Res
ourceReceiveResponse) | 34 else if (record.type() === TimelineModel.TimelineModel.RecordType.Re
sourceReceiveResponse) |
| 35 printReceive(record); | 35 printReceive(record); |
| 36 else if (record.type() === WebInspector.TimelineModel.RecordType.Res
ourceFinish) | 36 else if (record.type() === TimelineModel.TimelineModel.RecordType.Re
sourceFinish) |
| 37 printFinish(record); | 37 printFinish(record); |
| 38 } | 38 } |
| 39 model.forAllRecords(format); | 39 model.forAllRecords(format); |
| 40 InspectorTest.completeTest(); | 40 InspectorTest.completeTest(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 function printRecord(record) | 43 function printRecord(record) |
| 44 { | 44 { |
| 45 InspectorTest.addResult(""); | 45 InspectorTest.addResult(""); |
| 46 InspectorTest.printTimelineRecordProperties(record); | 46 InspectorTest.printTimelineRecordProperties(record); |
| 47 InspectorTest.addResult("Text details for " + record.type() + ": " + Web
Inspector.TimelineUIUtils.buildDetailsTextForTraceEvent(record.traceEvent())); | 47 InspectorTest.addResult("Text details for " + record.type() + ": " + Tim
eline.TimelineUIUtils.buildDetailsTextForTraceEvent(record.traceEvent())); |
| 48 } | 48 } |
| 49 | 49 |
| 50 function printSend(record) | 50 function printSend(record) |
| 51 { | 51 { |
| 52 printRecord(record); | 52 printRecord(record); |
| 53 var data = record.traceEvent().args["data"]; | 53 var data = record.traceEvent().args["data"]; |
| 54 requestId = data.requestId; | 54 requestId = data.requestId; |
| 55 if (data.url === undefined) | 55 if (data.url === undefined) |
| 56 InspectorTest.addResult("* No 'url' property in record"); | 56 InspectorTest.addResult("* No 'url' property in record"); |
| 57 else if (data.url.indexOf(scriptUrl) === -1) | 57 else if (data.url.indexOf(scriptUrl) === -1) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 81 | 81 |
| 82 </script> | 82 </script> |
| 83 </head> | 83 </head> |
| 84 | 84 |
| 85 <body onload="runTest()"> | 85 <body onload="runTest()"> |
| 86 <p> | 86 <p> |
| 87 Tests the Timeline API instrumentation of a network resource load | 87 Tests the Timeline API instrumentation of a network resource load |
| 88 </p> | 88 </p> |
| 89 </body> | 89 </body> |
| 90 </html> | 90 </html> |
| OLD | NEW |