Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <head> | 2 <head> |
| 3 <title>Performance Paint Timing Test</title> | 3 <title>Performance Paint Timing Test</title> |
| 4 </head> | 4 </head> |
| 5 <body> | 5 <body> |
| 6 <script src="../../resources/testharness.js"></script> | 6 <script src="../../resources/testharness.js"></script> |
| 7 <script src="../../resources/testharnessreport.js"></script> | 7 <script src="../../resources/testharnessreport.js"></script> |
| 8 <script> | 8 <script> |
| 9 | |
| 10 async_test(function (t) { | 9 async_test(function (t) { |
| 11 var observer = new PerformanceObserver( | 10 var observer = new PerformanceObserver( |
| 12 t.step_func(function (entryList) { | 11 t.step_func(function (entryList) { |
| 13 var entries = entryList.getEntries(); | 12 var entries = entryList.getEntries(); |
| 14 assert_equals(entries.length, 2, | 13 assert_equals(entries.length, 2, |
| 15 "There should be two paint timing instances."); | 14 "There should be two paint timing instances."); |
| 16 assert_equals(entries[0].entryType, "paint", | 15 assert_equals(entries[0].entryType, "paint", |
| 17 "Expected entryType to be: paint."); | 16 "Expected entryType to be: paint."); |
| 18 assert_equals(entries[0].duration, 0, | 17 assert_equals(entries[0].duration, 0, |
| 19 "Expected duration to be: 0."); | 18 "Expected duration to be: 0."); |
| 20 | 19 |
| 21 assert_equals(entries[1].entryType, "paint", | 20 assert_equals(entries[1].entryType, "paint", |
| 22 "Expected entryType to be: paint."); | 21 "Expected entryType to be: paint."); |
| 23 assert_equals(entries[1].duration, 0, | 22 assert_equals(entries[1].duration, 0, |
| 24 "Expected duration to be: 0."); | 23 "Expected duration to be: 0."); |
| 25 observer.disconnect(); | 24 observer.disconnect(); |
| 26 t.done(); | 25 t.done(); |
| 27 }) | 26 }) |
| 28 ); | 27 ); |
| 29 observer.observe({entryTypes: ["paint"]}); | 28 observer.observe({entryTypes: ["paint"]}); |
| 30 | 29 |
| 31 }, "Both first-paint-timing and first-contentful-paint timing entry are obse rvable."); | 30 }, "First contentful paint fires due to canvas render."); |
| 31 </script> | |
| 32 | 32 |
| 33 <script> | |
| 34 window.onload=function(){ | |
|
igrigorik
2017/05/08 20:37:04
May be redundant, but perhaps snapshot the time he
panicker
2017/05/09 17:55:05
As mentioned let's keep the sequence check in firs
| |
| 35 var c=document.getElementById("canvas"); | |
| 36 var ctx=c.getContext("2d"); | |
| 37 ctx.beginPath(); | |
| 38 ctx.moveTo(0,0); | |
| 39 ctx.lineTo(300,150); | |
| 40 ctx.stroke(); | |
| 41 } | |
| 33 </script> | 42 </script> |
| 34 <div style="background-color:black;color:white;padding:20px;">...test...</di v> | 43 |
| 44 <canvas id="canvas" width="200" height="200" ></canvas> | |
| 35 </body> | 45 </body> |
| 36 </html> | 46 </html> |
| OLD | NEW |