OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <style> | |
4 </style> | |
5 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
6 <script src="../../http/tests/inspector/timeline-test.js"></script> | |
7 <script src="../tracing-test.js"></script> | |
8 <script> | |
9 | |
10 function doActions(callback) | |
11 { | |
12 document.getElementById("a").style.visibility = "visible"; | |
13 requestAnimationFrame(function() { | |
14 testRunner.layoutAndPaintAsyncThen(callback); | |
15 }); | |
16 } | |
17 | |
18 function test() | |
19 { | |
20 var imageCount = 0; | |
21 | |
22 InspectorTest.invokeWithTracing("doActions", onTracingComplete, "disabled-by
-default-blink.graphics_context_annotations"); | |
23 | |
24 var inFlightPictures = 0; | |
25 function onTracingComplete() | |
26 { | |
27 var events = InspectorTest.tracingTimelineModel().inspectedTargetEvents(
); | |
28 for (var i = 0; i < events.length; ++i) { | |
29 var event = events[i]; | |
30 if (event.name !== WebInspector.TimelineModel.RecordType.Paint) | |
31 continue; | |
32 if (!event.picture) | |
33 continue; | |
34 ++inFlightPictures; | |
35 new WebInspector.LayerPaintEvent(event, InspectorTest.timelineModel(
).target()).loadSnapshot(onSnapshotLoaded); | |
36 } | |
37 if (!inFlightPictures) | |
38 InspectorTest.completeTest(); | |
39 } | |
40 | |
41 function onSnapshotLoaded(rect, snapshot) | |
42 { | |
43 snapshot.commandLog(InspectorTest.safeWrap(onGotLog)); | |
44 } | |
45 | |
46 function onGotLog(log) | |
47 { | |
48 var nodesToRequest = new Set(); | |
49 for (var i = 0; i < log.length; ++i) { | |
50 if (!log[i].annotations) | |
51 continue; | |
52 var nodeId = Number(log[i].annotations["INSPECTOR_ID"]); | |
53 if (nodeId) | |
54 nodesToRequest.add(nodeId); | |
55 } | |
56 InspectorTest.domModel.pushNodesByBackendIdsToFrontend(nodesToRequest, o
nNodesResolved.bind(this, log)); | |
57 } | |
58 | |
59 function onNodesResolved(log, nodeMap) | |
60 { | |
61 InspectorTest.addResult("Paint command log:"); | |
62 for (var i = 0; i < log.length; ++i) { | |
63 if (!log[i].annotations) | |
64 continue; | |
65 if (!/^draw/.test(log[i].method)) | |
66 continue; | |
67 var nodeId = Number(log[i].annotations["INSPECTOR_ID"]); | |
68 if (!nodeId || !nodeMap.get(nodeId)) | |
69 continue; | |
70 InspectorTest.addResult(" " + WebInspector.DOMPresentationUtils.s
impleSelector(nodeMap.get(nodeId)) + " " + log[i].method); | |
71 } | |
72 if (!--inFlightPictures) | |
73 InspectorTest.completeTest(); | |
74 } | |
75 | |
76 } | |
77 | |
78 </script> | |
79 </head> | |
80 | |
81 <body onload="runTestAfterDisplay()"> | |
82 <p> | |
83 Tests snapshot command log for trace-based Timeline paint event | |
84 </p> | |
85 <div id="a" style="visibility:hidden; transform: translateZ(0px); background-col
or:blue; width:100px; height:100px;"> | |
86 <div id="b" style="width:50px; height:50px; background-color:red;"></div> | |
87 <img id="c" src="resources/test.png"> | |
88 <svg id="d"> | |
89 <rect id="e" x="0" y="0" width="10" height="10" style="opacity:0.5"/> | |
90 </svg> | |
91 </div> | |
92 </body> | |
93 </html> | |
OLD | NEW |