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