| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script src="../../http/tests/inspector/timeline-test.js"></script> | |
| 5 <script> | |
| 6 | |
| 7 function performActions(callback) | |
| 8 { | |
| 9 var image = new Image(); | |
| 10 image.onload = bar; | |
| 11 image.src = "resources/anImage.png"; | |
| 12 | |
| 13 function bar() | |
| 14 { | |
| 15 var image = new Image(); | |
| 16 image.onload = function(event) { callback(); } // do not pass event arg
ument to the callback. | |
| 17 image.src = "resources/anotherImage.png"; | |
| 18 } | |
| 19 } | |
| 20 | |
| 21 function test() | |
| 22 { | |
| 23 WebInspector.TimelinePanel.show(); | |
| 24 WebInspector.panels.timeline._model._currentTarget = WebInspector.targetMana
ger.mainTarget(); | |
| 25 WebInspector.panels.timeline._captureJSProfileSetting.set(false); | |
| 26 InspectorTest.invokeAsyncWithTimeline("performActions", finish); | |
| 27 | |
| 28 function finish() | |
| 29 { | |
| 30 var recordTypes = WebInspector.TimelineModel.RecordType; | |
| 31 var typesToDump = new Set([recordTypes.ResourceSendRequest, recordTypes.
ResourceReceiveResponse, recordTypes.ResourceReceivedData, recordTypes.ResourceF
inish, | |
| 32 recordTypes.EventDispatch, recordTypes.FunctionCall]); | |
| 33 function dumpEvent(traceEvent, level) | |
| 34 { | |
| 35 // Ignore stray paint & rendering events for better stability. | |
| 36 var categoryName = WebInspector.TimelineUIUtils.eventStyle(traceEven
t).category.name; | |
| 37 if (categoryName !== "loading" && categoryName !== "scripting") | |
| 38 return; | |
| 39 // Here and below: pretend coalesced record are just not there, as c
oalescation is time dependent and, hence, not stable. | |
| 40 // Filter out InjectedScript function call because they happen out o
f sync. | |
| 41 if (typesToDump.has(traceEvent.name) && (traceEvent.name !== "Functi
onCall" || traceEvent.args["data"].scriptName)) | |
| 42 InspectorTest.addResult(" ".repeat(level - 1) + traceEvent.na
me); | |
| 43 } | |
| 44 InspectorTest.walkTimelineEventTree(dumpEvent); | |
| 45 InspectorTest.completeTest(); | |
| 46 } | |
| 47 } | |
| 48 | |
| 49 if (!window.testRunner) | |
| 50 setTimeout(performActions, 3000); | |
| 51 | |
| 52 </script> | |
| 53 </head> | |
| 54 | |
| 55 <body onload="runTest()"> | |
| 56 <p> | |
| 57 Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc. | |
| 58 </p> | |
| 59 | |
| 60 </body> | |
| 61 </html> | |
| OLD | NEW |