OLD | NEW |
| (Empty) |
1 <!DOCTYPE HTML> | |
2 <html> | |
3 <head> | |
4 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
5 <script src="../../http/tests/inspector/timeline-test.js"></script> | |
6 <script> | |
7 function display(callback) | |
8 { | |
9 requestAnimationFrame(function() { | |
10 document.body.style.backgroundColor = "blue"; | |
11 document.getElementById("testElement").style.backgroundColor = "salmon"; | |
12 if (window.testRunner) | |
13 testRunner.layoutAndPaintAsyncThen(callback); | |
14 }); | |
15 } | |
16 | |
17 function updateSubframeAndDisplay(callback) | |
18 { | |
19 requestAnimationFrame(function() { | |
20 frames[0].document.body.children[0].style.backgroundColor = "green"; | |
21 if (window.testRunner) | |
22 testRunner.layoutAndPaintAsyncThen(callback); | |
23 }); | |
24 } | |
25 | |
26 function test() | |
27 { | |
28 var currentPanel = WebInspector.inspectorView.currentPanel(); | |
29 InspectorTest.assertEquals(currentPanel._panelName, "timeline", "Current pan
el should be the timeline."); | |
30 Runtime.experiments.enableForTest("timelineInvalidationTracking"); | |
31 | |
32 InspectorTest.runTestSuite([ | |
33 function testLocalFrame(next) | |
34 { | |
35 InspectorTest.invokeAsyncWithTimeline("display", function() { | |
36 var record = InspectorTest.findFirstTimelineRecord(WebInspector.
TimelineModel.RecordType.Paint); | |
37 InspectorTest.addArray(record._event.invalidationTrackingEvents,
InspectorTest.InvalidationFormatters, "", "first paint invalidations"); | |
38 | |
39 next(); | |
40 }); | |
41 }, | |
42 | |
43 function testSubframe(next) | |
44 { | |
45 InspectorTest.invokeAsyncWithTimeline("updateSubframeAndDisplay", fu
nction() { | |
46 // The first paint corresponds to the local frame and should hav
e no invalidations. | |
47 var firstPaintRecord = InspectorTest.findFirstTimelineRecord(Web
Inspector.TimelineModel.RecordType.Paint); | |
48 var firstInvalidations = firstPaintRecord._event.invalidationTra
ckingEvents; | |
49 InspectorTest.assertEquals(firstInvalidations, undefined); | |
50 | |
51 // The second paint corresponds to the subframe and should have
our style invalidations. | |
52 var secondPaintRecord = InspectorTest.findTimelineRecord(WebInsp
ector.TimelineModel.RecordType.Paint, 1); | |
53 InspectorTest.addArray(secondPaintRecord._event.invalidationTrac
kingEvents, InspectorTest.InvalidationFormatters, "", "second paint invalidation
s"); | |
54 | |
55 next(); | |
56 }); | |
57 } | |
58 ]); | |
59 } | |
60 </script> | |
61 </head> | |
62 <body onload="runTest()"> | |
63 <p>Tests the Timeline API instrumentation of paint events with style recalc inva
lidations.</p> | |
64 <div id="testElement">PASS</div> | |
65 <iframe src="resources/timeline-iframe-paint.html" style="position: absolute; le
ft: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe> | |
66 </body> | |
67 </html> | |
OLD | NEW |