| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../inspector-test.js"></script> | 3 <script src="../inspector-test.js"></script> |
| 4 <script src="../timeline-test.js"></script> | 4 <script src="../timeline-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 function performActions() | 7 function performActions() |
| 8 { | 8 { |
| 9 var callback; | 9 var callback; |
| 10 var promise = new Promise((fulfill) => callback = fulfill); | 10 var promise = new Promise((fulfill) => callback = fulfill); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 UI.viewManager.showView("timeline"); | 26 UI.viewManager.showView("timeline"); |
| 27 UI.panels.timeline._model._currentTarget = SDK.targetManager.mainTarget(); | 27 UI.panels.timeline._model._currentTarget = SDK.targetManager.mainTarget(); |
| 28 UI.panels.timeline._captureJSProfileSetting.set(false); | 28 UI.panels.timeline._captureJSProfileSetting.set(false); |
| 29 InspectorTest.invokeAsyncWithTimeline("performActions", finish); | 29 InspectorTest.invokeAsyncWithTimeline("performActions", finish); |
| 30 | 30 |
| 31 function finish() | 31 function finish() |
| 32 { | 32 { |
| 33 var recordTypes = TimelineModel.TimelineModel.RecordType; | 33 var recordTypes = TimelineModel.TimelineModel.RecordType; |
| 34 var typesToDump = new Set([recordTypes.ResourceSendRequest, recordTypes.
ResourceReceiveResponse, recordTypes.ResourceReceivedData, recordTypes.ResourceF
inish, | 34 var typesToDump = new Set([recordTypes.ResourceSendRequest, recordTypes.
ResourceReceiveResponse, recordTypes.ResourceReceivedData, recordTypes.ResourceF
inish, |
| 35 recordTypes.EventDispatch, recordTypes.FunctionCall]); | 35 recordTypes.EventDispatch, recordTypes.FunctionCall]); |
| 36 let hasAlreadyDumptReceivedDataFor = new Map(); |
| 36 function dumpEvent(traceEvent, level) | 37 function dumpEvent(traceEvent, level) |
| 37 { | 38 { |
| 38 // Ignore stray paint & rendering events for better stability. | 39 // Ignore stray paint & rendering events for better stability. |
| 39 var categoryName = Timeline.TimelineUIUtils.eventStyle(traceEvent).c
ategory.name; | 40 var categoryName = Timeline.TimelineUIUtils.eventStyle(traceEvent).c
ategory.name; |
| 40 if (categoryName !== "loading" && categoryName !== "scripting") | 41 if (categoryName !== "loading" && categoryName !== "scripting") |
| 41 return; | 42 return; |
| 43 if (traceEvent.name === 'ResourceReceivedData') { |
| 44 const requestId = traceEvent.args['data']['requestId']; |
| 45 // Dump only the first ResourceReceivedData for a request for st
ability. |
| 46 if (hasAlreadyDumptReceivedDataFor[requestId]) |
| 47 return; |
| 48 hasAlreadyDumptReceivedDataFor[requestId] = true; |
| 49 } |
| 50 |
| 42 // Here and below: pretend coalesced record are just not there, as c
oalescation is time dependent and, hence, not stable. | 51 // Here and below: pretend coalesced record are just not there, as c
oalescation is time dependent and, hence, not stable. |
| 43 // Filter out InjectedScript function call because they happen out o
f sync. | 52 // Filter out InjectedScript function call because they happen out o
f sync. |
| 44 if (typesToDump.has(traceEvent.name) && (traceEvent.name !== "Functi
onCall" || traceEvent.args["data"]["url"])) | 53 if (typesToDump.has(traceEvent.name) && (traceEvent.name !== "Functi
onCall" || traceEvent.args["data"]["url"])) |
| 45 InspectorTest.addResult(" ".repeat(level - 1) + traceEvent.na
me); | 54 InspectorTest.addResult(" ".repeat(level - 1) + traceEvent.na
me); |
| 46 } | 55 } |
| 47 InspectorTest.walkTimelineEventTree(dumpEvent); | 56 InspectorTest.walkTimelineEventTree(dumpEvent); |
| 48 InspectorTest.completeTest(); | 57 InspectorTest.completeTest(); |
| 49 } | 58 } |
| 50 } | 59 } |
| 51 | 60 |
| 52 if (!window.testRunner) | 61 if (!window.testRunner) |
| 53 setTimeout(performActions, 3000); | 62 setTimeout(performActions, 3000); |
| 54 | 63 |
| 55 </script> | 64 </script> |
| 56 </head> | 65 </head> |
| 57 | 66 |
| 58 <body onload="runTest()"> | 67 <body onload="runTest()"> |
| 59 <p> | 68 <p> |
| 60 Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc. | 69 Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc. |
| 61 </p> | 70 </p> |
| 62 | 71 |
| 63 </body> | 72 </body> |
| 64 </html> | 73 </html> |
| OLD | NEW |