| 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 callback; | 9 var callback; |
| 10 var promise = new Promise((fulfill) => callback = fulfill); | 10 var promise = new Promise((fulfill) => callback = fulfill); |
| 11 var image = new Image(); | 11 var image = new Image(); |
| 12 image.onload = bar; | 12 image.onload = bar; |
| 13 image.src = "../resources/anImage.png"; | 13 image.src = "../resources/anImage.png"; |
| 14 | 14 |
| 15 function bar() | 15 function bar() |
| 16 { | 16 { |
| 17 var image = new Image(); | 17 var image = new Image(); |
| 18 image.onload = function(event) { callback(); } // do not pass event arg
ument to the callback. | 18 image.onload = function(event) { callback(); } // do not pass event arg
ument to the callback. |
| 19 image.src = "../resources/anotherImage.png"; | 19 image.src = "../resources/anotherImage.png"; |
| 20 } | 20 } |
| 21 return promise; | 21 return promise; |
| 22 } | 22 } |
| 23 | 23 |
| 24 function test() | 24 function test() |
| 25 { | 25 { |
| 26 WebInspector.viewManager.showView("timeline"); | 26 UI.viewManager.showView("timeline"); |
| 27 WebInspector.panels.timeline._model._currentTarget = WebInspector.targetMana
ger.mainTarget(); | 27 UI.panels.timeline._model._currentTarget = SDK.targetManager.mainTarget(); |
| 28 WebInspector.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 = WebInspector.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 function dumpEvent(traceEvent, level) | 36 function dumpEvent(traceEvent, level) |
| 37 { | 37 { |
| 38 // Ignore stray paint & rendering events for better stability. | 38 // Ignore stray paint & rendering events for better stability. |
| 39 var categoryName = WebInspector.TimelineUIUtils.eventStyle(traceEven
t).category.name; | 39 var categoryName = Timeline.TimelineUIUtils.eventStyle(traceEvent).c
ategory.name; |
| 40 if (categoryName !== "loading" && categoryName !== "scripting") | 40 if (categoryName !== "loading" && categoryName !== "scripting") |
| 41 return; | 41 return; |
| 42 // Here and below: pretend coalesced record are just not there, as c
oalescation is time dependent and, hence, not stable. | 42 // 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. | 43 // 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"])) | 44 if (typesToDump.has(traceEvent.name) && (traceEvent.name !== "Functi
onCall" || traceEvent.args["data"]["url"])) |
| 45 InspectorTest.addResult(" ".repeat(level - 1) + traceEvent.na
me); | 45 InspectorTest.addResult(" ".repeat(level - 1) + traceEvent.na
me); |
| 46 } | 46 } |
| 47 InspectorTest.walkTimelineEventTree(dumpEvent); | 47 InspectorTest.walkTimelineEventTree(dumpEvent); |
| 48 InspectorTest.completeTest(); | 48 InspectorTest.completeTest(); |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 | 51 |
| 52 if (!window.testRunner) | 52 if (!window.testRunner) |
| 53 setTimeout(performActions, 3000); | 53 setTimeout(performActions, 3000); |
| 54 | 54 |
| 55 </script> | 55 </script> |
| 56 </head> | 56 </head> |
| 57 | 57 |
| 58 <body onload="runTest()"> | 58 <body onload="runTest()"> |
| 59 <p> | 59 <p> |
| 60 Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc. | 60 Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc. |
| 61 </p> | 61 </p> |
| 62 | 62 |
| 63 </body> | 63 </body> |
| 64 </html> | 64 </html> |
| OLD | NEW |