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