Chromium Code Reviews| 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 var callback; | |
| 10 var promise = new Promise((fulfill) => callback = fulfill); | |
| 9 function onRequestFinished() | 11 function onRequestFinished() |
| 10 { | 12 { |
| 11 if (!--requestsPending) | 13 if (!--requestsPending) |
| 12 callback(); | 14 callback(); |
| 13 } | 15 } |
| 14 | 16 |
| 15 var requestsPending = 2; | 17 var requestsPending = 2; |
| 16 var image = new Image(); | 18 var image = new Image(); |
| 17 image.onload = onRequestFinished; | 19 image.onload = onRequestFinished; |
|
caseq
2016/08/05 17:56:42
... or maybe let's introduce something like
Inspec
kozy
2016/08/10 01:21:14
Acknowledged.
| |
| 18 image.src = "../resources/anImage.png"; | 20 image.src = "../resources/anImage.png"; |
| 19 | 21 |
| 20 var script = document.createElement("script"); | 22 var script = document.createElement("script"); |
| 21 script.src = "timeline-network-resource.js"; | 23 script.src = "timeline-network-resource.js"; |
| 22 document.body.appendChild(script); | 24 document.body.appendChild(script); |
| 23 window.timelineNetworkResourceEvaluated = onRequestFinished; | 25 window.timelineNetworkResourceEvaluated = onRequestFinished; |
| 26 return promise; | |
| 24 } | 27 } |
| 25 | 28 |
| 26 function test() | 29 function test() |
| 27 { | 30 { |
| 28 var model = WebInspector.panels.timeline._model; | 31 var model = WebInspector.panels.timeline._model; |
| 29 | 32 |
| 30 InspectorTest.invokeAsyncWithTimeline("performActions", finish); | 33 InspectorTest.invokeAsyncWithTimeline("performActions", finish); |
| 31 | 34 |
| 32 function finish() | 35 function finish() |
| 33 { | 36 { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 55 | 58 |
| 56 </script> | 59 </script> |
| 57 </head> | 60 </head> |
| 58 | 61 |
| 59 <body onload="runTest()"> | 62 <body onload="runTest()"> |
| 60 <p> | 63 <p> |
| 61 Tests the Timeline UI API for network requests. | 64 Tests the Timeline UI API for network requests. |
| 62 </p> | 65 </p> |
| 63 </body> | 66 </body> |
| 64 </html> | 67 </html> |
| OLD | NEW |