| 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(callback) | 7 function performActions() |
| 8 { | 8 { |
| 9 function onRequestFinished() | |
| 10 { | |
| 11 if (!--requestsPending) | |
| 12 callback(); | |
| 13 } | |
| 14 | |
| 15 var requestsPending = 2; | |
| 16 var image = new Image(); | 9 var image = new Image(); |
| 17 image.onload = onRequestFinished; | 10 var imagePromise = new Promise((fulfill) => image.onload = fulfill); |
| 18 image.src = "../resources/anImage.png"; | 11 image.src = "../resources/anImage.png"; |
| 19 | 12 |
| 20 var script = document.createElement("script"); | 13 var script = document.createElement("script"); |
| 21 script.src = "timeline-network-resource.js"; | 14 script.src = "timeline-network-resource.js"; |
| 22 document.body.appendChild(script); | 15 document.body.appendChild(script); |
| 23 window.timelineNetworkResourceEvaluated = onRequestFinished; | 16 var scriptPromise = new Promise((fulfill) => window.timelineNetworkResourceE
valuated = fulfill); |
| 17 |
| 18 return Promise.all([imagePromise, scriptPromise]); |
| 24 } | 19 } |
| 25 | 20 |
| 26 function test() | 21 function test() |
| 27 { | 22 { |
| 28 var model = WebInspector.panels.timeline._model; | 23 var model = WebInspector.panels.timeline._model; |
| 29 | 24 |
| 30 InspectorTest.invokeAsyncWithTimeline("performActions", finish); | 25 InspectorTest.invokeAsyncWithTimeline("performActions", finish); |
| 31 | 26 |
| 32 function finish() | 27 function finish() |
| 33 { | 28 { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 55 | 50 |
| 56 </script> | 51 </script> |
| 57 </head> | 52 </head> |
| 58 | 53 |
| 59 <body onload="runTest()"> | 54 <body onload="runTest()"> |
| 60 <p> | 55 <p> |
| 61 Tests the Timeline UI API for network requests. | 56 Tests the Timeline UI API for network requests. |
| 62 </p> | 57 </p> |
| 63 </body> | 58 </body> |
| 64 </html> | 59 </html> |
| OLD | NEW |