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() | 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 var image = new Image(); | 14 var image = new Image(); |
15 image.onload = function() { testRunner.evaluateInWebInspector(0, "window
.step2()"); } | 15 image.onload = function(event) { callback(); } // do not pass event arg
ument to the callback. |
16 image.src = "resources/anotherImage.png"; | 16 image.src = "resources/anotherImage.png"; |
17 } | 17 } |
18 } | 18 } |
19 | 19 |
20 function test() | 20 function test() |
21 { | 21 { |
22 WebInspector.inspectorView.showPanel("timeline"); | 22 WebInspector.inspectorView.showPanel("timeline"); |
23 WebInspector.panels.timeline._model._collectionEnabled = true; | |
24 WebInspector.inspectorView.panel("timeline")._model._currentTarget = WebInsp
ector.targetManager.mainTarget(); | 23 WebInspector.inspectorView.panel("timeline")._model._currentTarget = WebInsp
ector.targetManager.mainTarget(); |
| 24 InspectorTest.invokeAsyncWithTimeline("performActions", finish); |
25 | 25 |
26 TimelineAgent.start(step1); | 26 function finish() |
27 | |
28 function step1() | |
29 { | |
30 InspectorTest.evaluateInPage("performActions()"); | |
31 } | |
32 | |
33 window.step2 = function() | |
34 { | |
35 TimelineAgent.stop(step3); | |
36 } | |
37 | |
38 function step3() | |
39 { | 27 { |
40 function dumpFormattedRecord(presentationRecord, prefix) | 28 function dumpFormattedRecord(presentationRecord, prefix) |
41 { | 29 { |
42 var record = presentationRecord.record(); | 30 var record = presentationRecord.record(); |
43 prefix = prefix || ""; | 31 prefix = prefix || ""; |
44 // Here and below: pretend coalesced record are just not there, as c
oalescation is time dependent and, hence, not stable. | 32 // Here and below: pretend coalesced record are just not there, as c
oalescation is time dependent and, hence, not stable. |
45 var categoryName = WebInspector.panels.timeline._uiUtils.categoryFor
Record(record).name; | 33 var categoryName = WebInspector.panels.timeline._uiUtils.categoryFor
Record(record).name; |
46 if (categoryName !== "loading" && categoryName !== "scripting") | 34 if (categoryName !== "loading" && categoryName !== "scripting") |
47 return; | 35 return; |
48 if (!presentationRecord.coalesced() && record.type() !== "GCEvent") | 36 if (!presentationRecord.coalesced() && record.type() !== "GCEvent") |
49 InspectorTest.addResult(prefix + record.type()); | 37 InspectorTest.addResult(prefix + record.type()); |
50 // Ignore stray paint & rendering events for better stability. | 38 // Ignore stray paint & rendering events for better stability. |
51 if (presentationRecord.presentationChildren()) { | 39 if (presentationRecord.presentationChildren()) { |
52 var childPrefix = prefix + (presentationRecord.coalesced() ? ""
: " "); | 40 var childPrefix = prefix + (presentationRecord.coalesced() ? ""
: " "); |
53 for (var i = 0; i < presentationRecord.presentationChildren().le
ngth; ++i) | 41 for (var i = 0; i < presentationRecord.presentationChildren().le
ngth; ++i) |
54 dumpFormattedRecord(presentationRecord.presentationChildren(
)[i], childPrefix); | 42 dumpFormattedRecord(presentationRecord.presentationChildren(
)[i], childPrefix); |
55 } | 43 } |
56 } | 44 } |
57 WebInspector.panels.timeline._model._collectionEnabled = false; | |
58 | |
59 var records = WebInspector.panels.timeline._currentViews[0]._rootRecord(
).presentationChildren(); | 45 var records = WebInspector.panels.timeline._currentViews[0]._rootRecord(
).presentationChildren(); |
60 for (var i = 0; i < records.length; ++i) | 46 for (var i = 0; i < records.length; ++i) |
61 dumpFormattedRecord(records[i]); | 47 dumpFormattedRecord(records[i]); |
62 InspectorTest.completeTest(); | 48 InspectorTest.completeTest(); |
63 } | 49 } |
64 } | 50 } |
65 | 51 |
66 if (!window.testRunner) | 52 if (!window.testRunner) |
67 setTimeout(performActions, 3000); | 53 setTimeout(performActions, 3000); |
68 | 54 |
69 </script> | 55 </script> |
70 </head> | 56 </head> |
71 | 57 |
72 <body onload="runTest()"> | 58 <body onload="runTest()"> |
73 <p> | 59 <p> |
74 Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc. | 60 Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc. |
75 </p> | 61 </p> |
76 | 62 |
77 </body> | 63 </body> |
78 </html> | 64 </html> |
OLD | NEW |