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(callback) | 7 function performActions(callback) |
8 { | 8 { |
9 var image = new Image(); | 9 var image = new Image(); |
10 image.onload = bar; | 10 image.onload = bar; |
11 image.src = "resources/anImage.png"; | 11 image.src = "resources/anImage.png"; |
12 | 12 |
13 function bar() | 13 function bar() |
14 { | 14 { |
15 var image = new Image(); | 15 var image = new Image(); |
16 image.onload = function(event) { callback(); } // do not pass event arg ument to the callback. | 16 image.onload = function(event) { callback(); } // do not pass event arg ument to the callback. |
17 image.src = "resources/anotherImage.png"; | 17 image.src = "resources/anotherImage.png"; |
18 } | 18 } |
19 } | 19 } |
20 | 20 |
21 function test() | 21 function test() |
22 { | 22 { |
23 WebInspector.TimelinePanel.show(); | 23 WebInspector.TimelinePanel.show(); |
24 WebInspector.panels.timeline._model._currentTarget = WebInspector.targetMana ger.mainTarget(); | 24 WebInspector.panels.timeline._model._currentTarget = WebInspector.targetMana ger.mainTarget(); |
25 InspectorTest.invokeAsyncWithTimeline("performActions", finish); | 25 InspectorTest.invokeAsyncWithTimeline("performActions", finish); |
26 | 26 |
27 function finish() | 27 function finish() |
28 { | 28 { |
29 var typesToDump = new Set(["ResourceSendRequest", "ResourceReceiveRespon se", "ResourceReceivedData", "ResourceFinish", "EventDispatch", "FunctionCall"]) ; | |
yurys
2015/09/21 18:49:32
Can we reference constants from TimelineModel.js i
| |
29 function dumpFormattedRecord(presentationRecord, prefix) | 30 function dumpFormattedRecord(presentationRecord, prefix) |
30 { | 31 { |
31 var record = presentationRecord.record(); | 32 var record = presentationRecord.record(); |
32 prefix = prefix || ""; | 33 prefix = prefix || ""; |
33 // Ignore stray paint & rendering events for better stability. | 34 // Ignore stray paint & rendering events for better stability. |
34 var categoryName = WebInspector.TimelineUIUtils.categoryForRecord(re cord).name; | 35 var categoryName = WebInspector.TimelineUIUtils.categoryForRecord(re cord).name; |
35 if (categoryName !== "loading" && categoryName !== "scripting") | 36 if (categoryName !== "loading" && categoryName !== "scripting") |
36 return; | 37 return; |
37 var childPrefix = prefix; | 38 var childPrefix = prefix; |
38 // Here and below: pretend coalesced record are just not there, as c oalescation is time dependent and, hence, not stable. | 39 // Here and below: pretend coalesced record are just not there, as c oalescation is time dependent and, hence, not stable. |
39 // Filter out InjectedScript function call because they happen out o f sync. | 40 // Filter out InjectedScript function call because they happen out o f sync. |
40 if (!presentationRecord.coalesced() | 41 if (!presentationRecord.coalesced() && typesToDump.has(record.type() ) |
41 && record.type() !== "GCEvent" | |
42 && (record.type() !== "FunctionCall" || record.traceEvent().args ["data"].scriptName)) { | 42 && (record.type() !== "FunctionCall" || record.traceEvent().args ["data"].scriptName)) { |
43 InspectorTest.addResult(prefix + record.type()); | 43 InspectorTest.addResult(prefix + record.type()); |
44 childPrefix = childPrefix + " "; | 44 childPrefix = childPrefix + " "; |
45 } | 45 } |
46 if (presentationRecord.presentationChildren()) { | 46 if (presentationRecord.presentationChildren()) { |
47 for (var i = 0; i < presentationRecord.presentationChildren().le ngth; ++i) | 47 for (var i = 0; i < presentationRecord.presentationChildren().le ngth; ++i) |
48 dumpFormattedRecord(presentationRecord.presentationChildren( )[i], childPrefix); | 48 dumpFormattedRecord(presentationRecord.presentationChildren( )[i], childPrefix); |
49 } | 49 } |
50 } | 50 } |
51 var records = InspectorTest.timelinePresentationModel().rootRecord().pre sentationChildren(); | 51 var records = InspectorTest.timelinePresentationModel().rootRecord().pre sentationChildren(); |
52 for (var i = 0; i < records.length; ++i) | 52 for (var i = 0; i < records.length; ++i) |
53 dumpFormattedRecord(records[i]); | 53 dumpFormattedRecord(records[i]); |
54 InspectorTest.completeTest(); | 54 InspectorTest.completeTest(); |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 if (!window.testRunner) | 58 if (!window.testRunner) |
59 setTimeout(performActions, 3000); | 59 setTimeout(performActions, 3000); |
60 | 60 |
61 </script> | 61 </script> |
62 </head> | 62 </head> |
63 | 63 |
64 <body onload="runTest()"> | 64 <body onload="runTest()"> |
65 <p> | 65 <p> |
66 Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc. | 66 Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc. |
67 </p> | 67 </p> |
68 | 68 |
69 </body> | 69 </body> |
70 </html> | 70 </html> |
OLD | NEW |