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 var image = new Image(); | |
15 image.onload = function(event) { callback(); } // do not pass event arg
ument to the callback. | |
16 image.src = "resources/anotherImage.png"; | |
17 } | |
18 } | |
19 | |
20 function test() | |
21 { | |
22 WebInspector.TimelinePanel.show(); | |
23 WebInspector.panels.timeline._model._currentTarget = WebInspector.targetMana
ger.mainTarget(); | |
24 InspectorTest.invokeAsyncWithTimeline("performActions", finish); | |
25 | |
26 function finish() | |
27 { | |
28 function dumpFormattedRecord(presentationRecord, prefix) | |
29 { | |
30 var record = presentationRecord.record(); | |
31 prefix = prefix || ""; | |
32 // Here and below: pretend coalesced record are just not there, as c
oalescation is time dependent and, hence, not stable. | |
33 var categoryName = WebInspector.panels.timeline._uiUtils.categoryFor
Record(record).name; | |
34 if (categoryName !== "loading" && categoryName !== "scripting") | |
35 return; | |
36 if (!presentationRecord.coalesced() && record.type() !== "GCEvent") | |
37 InspectorTest.addResult(prefix + record.type()); | |
38 // Ignore stray paint & rendering events for better stability. | |
39 if (presentationRecord.presentationChildren()) { | |
40 var childPrefix = prefix + (presentationRecord.coalesced() ? ""
: " "); | |
41 for (var i = 0; i < presentationRecord.presentationChildren().le
ngth; ++i) | |
42 dumpFormattedRecord(presentationRecord.presentationChildren(
)[i], childPrefix); | |
43 } | |
44 } | |
45 var records = WebInspector.panels.timeline._currentViews[0]._rootRecord(
).presentationChildren(); | |
46 for (var i = 0; i < records.length; ++i) | |
47 dumpFormattedRecord(records[i]); | |
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 |