| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script src="../../http/tests/inspector/timeline-test.js"></script> | |
| 5 <script> | |
| 6 | |
| 7 function performActions(callback) | |
| 8 { | |
| 9 function onRequestFinished() | |
| 10 { | |
| 11 if (!--requestsPending) | |
| 12 callback(); | |
| 13 } | |
| 14 | |
| 15 var requestsPending = 2; | |
| 16 var image = new Image(); | |
| 17 image.onload = onRequestFinished; | |
| 18 image.src = "resources/anImage.png"; | |
| 19 | |
| 20 var script = document.createElement("script"); | |
| 21 script.src = "timeline-network-resource.js"; | |
| 22 document.body.appendChild(script); | |
| 23 window.timelineNetworkResourceEvaluated = onRequestFinished; | |
| 24 } | |
| 25 | |
| 26 function test() | |
| 27 { | |
| 28 var model = WebInspector.panels.timeline._model; | |
| 29 | |
| 30 InspectorTest.invokeAsyncWithTimeline("performActions", finish); | |
| 31 | |
| 32 function finish() | |
| 33 { | |
| 34 var linkifier = new WebInspector.Linkifier(); | |
| 35 function printRequestDetails(request) | |
| 36 { | |
| 37 return WebInspector.TimelineUIUtils.buildNetworkRequestDetails(reque
st, model, linkifier).then(printElement); | |
| 38 } | |
| 39 function printElement(element) | |
| 40 { | |
| 41 var rows = element.querySelectorAll(".timeline-details-view-row"); | |
| 42 for (var i = 0; i < rows.length; ++i) { | |
| 43 var title = rows[i].firstChild.firstChild.textContent; | |
| 44 var value = rows[i].lastChild.firstChild.textContent; | |
| 45 if (title === "Duration" || title === "Mime Type") | |
| 46 value = typeof value; | |
| 47 if (/^file:\/\//.test(value)) | |
| 48 value = /[^/]*$/.exec(value)[0]; | |
| 49 InspectorTest.addResult(title + ": " + value); | |
| 50 } | |
| 51 } | |
| 52 Promise.all(model.networkRequests().map(printRequestDetails)).then(Inspe
ctorTest.completeTest); | |
| 53 } | |
| 54 } | |
| 55 | |
| 56 </script> | |
| 57 </head> | |
| 58 | |
| 59 <body onload="runTest()"> | |
| 60 <p> | |
| 61 Tests the Timeline UI API for network requests. | |
| 62 </p> | |
| 63 </body> | |
| 64 </html> | |
| OLD | NEW |