Initialize Tizen 2.3
[framework/web/webkit-efl.git] / LayoutTests / inspector / timeline / timeline-paint.html
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/timeline-test.js"></script>
5 <script>
6
7 function display()
8 {
9     if (window.testRunner)
10         testRunner.display();
11 }
12
13 function updateSubframeAndDisplay()
14 {
15     frames[0].document.body.children[0].style.backgroundColor = "green";
16     if (window.testRunner)
17         testRunner.displayInvalidatedRegion();
18 }
19
20 function test()
21 {
22     step1();
23
24     function step1()
25     {
26         InspectorTest.evaluateWithTimeline("display()", step2);
27     }
28
29     function step2(records)
30     {
31         for (var i = 0; i < records.length; ++i) {
32             var record = records[i];
33             if (record.type === WebInspector.TimelineModel.RecordType.Paint) {
34                 InspectorTest.printTimelineRecordProperties(record);
35                 break;
36             }
37         }
38         InspectorTest.evaluateWithTimeline("updateSubframeAndDisplay()", step3);
39     }
40
41     function step3(records)
42     {
43         var paintRecord;
44         for (var i = 0; i < records.length; ++i) {
45             var record = records[i];
46             if (record.type === WebInspector.TimelineModel.RecordType.Paint && record.children && record.children.length) {
47                 paintRecord = record;
48                 break;
49             }
50         }
51         InspectorTest.assertTrue(paintRecord, "Paint record with subframe paint not found");
52         var topQuad = paintRecord.data.clip;
53         var subframePaint = paintRecord.children[0];
54         var subframeQuad = subframePaint.data.clip;
55         InspectorTest.assertEquals(8, topQuad.length);
56         InspectorTest.assertEquals(8, subframeQuad.length);
57         InspectorTest.assertGreaterOrEqual(subframeQuad[0], topQuad[0]);
58         InspectorTest.assertGreaterOrEqual(subframeQuad[1], topQuad[1]);
59         InspectorTest.assertGreaterOrEqual(topQuad[2], subframeQuad[2]);
60         InspectorTest.assertGreaterOrEqual(subframeQuad[3], topQuad[3]);
61         InspectorTest.assertGreaterOrEqual(topQuad[4], subframeQuad[4]);
62         InspectorTest.assertGreaterOrEqual(topQuad[5], subframeQuad[5]);
63         InspectorTest.assertGreaterOrEqual(subframeQuad[6], topQuad[6]);
64         InspectorTest.assertGreaterOrEqual(topQuad[7], subframeQuad[7]);
65
66         InspectorTest.completeTest();
67     }
68 }
69
70 </script>
71 </head>
72
73 <body onload="runTest()">
74 <p>
75 Tests the Timeline API instrumentation of a paint event
76 </p>
77 <iframe src="resources/timeline-iframe-paint.html" style="position: absolute; left: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe>
78 </body>
79 </html>