| 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 function performActions() | 7 function performActions() |
| 8 { | 8 { |
| 9 var image = new Image(); | 9 var image = new Image(); |
| 10 var imagePromise = new Promise((fulfill) => image.onload = fulfill); | 10 var imagePromise = new Promise((fulfill) => image.onload = fulfill); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 var linkifier = new Components.Linkifier(); | 28 var linkifier = new Components.Linkifier(); |
| 29 function printRequestDetails(request) | 29 function printRequestDetails(request) |
| 30 { | 30 { |
| 31 return Timeline.TimelineUIUtils.buildNetworkRequestDetails(request,
model, linkifier).then(printElement); | 31 return Timeline.TimelineUIUtils.buildNetworkRequestDetails(request,
model, linkifier).then(printElement); |
| 32 } | 32 } |
| 33 function printElement(element) | 33 function printElement(element) |
| 34 { | 34 { |
| 35 var rows = element.querySelectorAll(".timeline-details-view-row"); | 35 var rows = element.querySelectorAll(".timeline-details-view-row"); |
| 36 for (var i = 0; i < rows.length; ++i) { | 36 for (var i = 0; i < rows.length; ++i) { |
| 37 var title = rows[i].firstChild.firstChild.textContent; | 37 var title = rows[i].firstChild.firstChild.textContent; |
| 38 var value = rows[i].lastChild.firstChild.textContent; | 38 var value = rows[i].lastChild.firstChild; |
| 39 if (value.children && value.children.length) |
| 40 value = Array.from(value.children, element => element.textCont
ent).slice(1).join(''); |
| 41 else |
| 42 value = value.textContent; |
| 39 if (title === "Duration" || title === "Mime Type") | 43 if (title === "Duration" || title === "Mime Type") |
| 40 value = typeof value; | 44 value = typeof value; |
| 41 if (/^file:\/\//.test(value)) | 45 if (/^file:\/\//.test(value)) |
| 42 value = /[^/]*$/.exec(value)[0]; | 46 value = /[^/]*$/.exec(value)[0]; |
| 43 InspectorTest.addResult(title + ": " + value); | 47 InspectorTest.addResult(title + ": " + value); |
| 44 } | 48 } |
| 45 } | 49 } |
| 46 Promise.all(model.networkRequests().map(printRequestDetails)).then(Inspe
ctorTest.completeTest); | 50 Promise.all(model.networkRequests().map(printRequestDetails)).then(Inspe
ctorTest.completeTest); |
| 47 } | 51 } |
| 48 } | 52 } |
| 49 | 53 |
| 50 </script> | 54 </script> |
| 51 </head> | 55 </head> |
| 52 | 56 |
| 53 <body onload="runTest()"> | 57 <body onload="runTest()"> |
| 54 <p> | 58 <p> |
| 55 Tests the Timeline UI API for network requests. | 59 Tests the Timeline UI API for network requests. |
| 56 </p> | 60 </p> |
| 57 </body> | 61 </body> |
| 58 </html> | 62 </html> |
| OLD | NEW |