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() | |
8 { | |
9 var callback; | |
10 var promise = new Promise((fulfill) => callback = fulfill); | |
11 var image = new Image(); | |
12 image.onload = bar; | |
13 image.src = "../resources/anImage.png"; | |
14 | |
15 function bar() | |
16 { | |
17 var image = new Image(); | |
18 image.onload = function(event) { callback(); } // do not pass event arg
ument to the callback. | |
19 image.src = "../resources/anotherImage.png"; | |
20 } | |
21 return promise; | |
22 } | |
23 | |
24 function test() | |
25 { | |
26 UI.viewManager.showView("timeline"); | |
27 UI.panels.timeline._model._currentTarget = SDK.targetManager.mainTarget(); | |
28 UI.panels.timeline._captureJSProfileSetting.set(false); | |
29 InspectorTest.invokeAsyncWithTimeline("performActions", finish); | |
30 | |
31 function finish() | |
32 { | |
33 var recordTypes = TimelineModel.TimelineModel.RecordType; | |
34 var typesToDump = new Set([recordTypes.ResourceSendRequest, recordTypes.
ResourceReceiveResponse, recordTypes.ResourceReceivedData, recordTypes.ResourceF
inish, | |
35 recordTypes.EventDispatch, recordTypes.FunctionCall]); | |
36 function dumpEvent(traceEvent, level) | |
37 { | |
38 // Ignore stray paint & rendering events for better stability. | |
39 var categoryName = Timeline.TimelineUIUtils.eventStyle(traceEvent).c
ategory.name; | |
40 if (categoryName !== "loading" && categoryName !== "scripting") | |
41 return; | |
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. | |
44 if (typesToDump.has(traceEvent.name) && (traceEvent.name !== "Functi
onCall" || traceEvent.args["data"]["url"])) | |
45 InspectorTest.addResult(" ".repeat(level - 1) + traceEvent.na
me); | |
46 } | |
47 InspectorTest.walkTimelineEventTree(dumpEvent); | |
48 InspectorTest.completeTest(); | |
49 } | |
50 } | |
51 | |
52 if (!window.testRunner) | |
53 setTimeout(performActions, 3000); | |
54 | |
55 </script> | |
56 </head> | |
57 | |
58 <body onload="runTest()"> | |
59 <p> | |
60 Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc. | |
61 </p> | |
62 | |
63 </body> | |
64 </html> | |
OLD | NEW |